tipc: three small fixes
Subsystems (3)
cover tipc: three small fixes
Fixes for some broadcast link problems that may occur in large systems.
Jon Maloy (3):
tipc: extend broadcast link initialization criteria
tipc: ensure correct broadcast send buffer release when peer is lost
tipc: reset all unicast links when broadcast send link fails
net/tipc/bearer.c | 15 +++++++++++++++ net/tipc/bearer.h | 1 + net/tipc/link.c | 9 ++++++++- net/tipc/node.c | 15 +++++++++++---- 4 files changed, 35 insertions(+), 5 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/3 tipc: extend broadcast link initialization criteria
At first contact between two nodes, an endpoint might sometimes have time to send out a LINK_PROTOCOL/STATE packet before it has received the broadcast initialization packet from the peer, i.e., before it has received a valid broadcast packet number to add to the 'bc_ack' field of the protocol message.
This means that the peer endpoint will receive a protocol packet with an invalid broadcast acknowledge value of 0. Under unlucky circumstances this may lead to the original, already received acknowledge value being overwritten, so that the whole broadcast link goes stale after a while.
We fix this by delaying the setting of the link field 'bc_peer_is_up' until we know that the peer really has received our own broadcast initialization message. The latter is always sent out as the first unicast message on a link, and always with seqeunce number 1. Because of this, we only need to look for a non-zero unicast acknowledge value in the arriving STATE messages, and once that is confirmed we know we are safe and can set the mentioned field. Before this moment, we must ignore all broadcast acknowledges from the peer.
--- net/tipc/link.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/tipc/link.c +6 -1
@@ -1559,7 +1559,12 @@ void tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr,if (!msg_peer_node_is_up (hdr))return ; - l->bc_peer_is_up = true; +/* Open when peer ackowledges our bcast init msg (pkt #1) */ +if (msg_ack (hdr)) + l->bc_peer_is_up = true; + +if (!l->bc_peer_is_up) +return ;/* Ignore if peers_snd_nxt goes beyond receive window */ if (more (peers_snd_nxt, l->rcv_nxt + l->window))
Signature · 9 lines
1.9.1 ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape
PATCH 2/3 tipc: ensure correct broadcast send buffer release when peer is lost
In reply to Jon MaloyAfter a new receiver peer has been added to the broadcast transmission link, we allow immediate transmission of new broadcast packets, trusting that the new peer will not accept the packets until it has received the previously sent unicast broadcast initialiation message. In the same way, the sender must not accept any acknowledges until it has itself received the broadcast initialization from the peer, as well as confirmation of the reception of its own initialization message.
Furthermore, when a receiver peer goes down, the sender has to produce the missing acknowledges from the lost peer locally, in order ensure correct release of the buffers that were expected to be acknowledged by the said peer.
In a highly stressed system we have observed that contact with a peer may come up and be lost before the above mentioned broadcast initial- ization and confirmation have been received. This leads to the locally produced acknowledges being rejected, and the non-acknowledged buffers to linger in the broadcast link transmission queue until it fills up and the link goes into permanent congestion.
In this commit, we remedy this by temporarily setting the corresponding broadcast receive link state to ESTABLISHED and the 'bc_peer_is_up' state to true before we issue the local acknowledges. This ensures that those acknowledges will always be accepted. The mentioned state values are restored immediately afterwards when the link is reset.
--- net/tipc/link.c | 2 ++ 1 file changed, 2 insertions(+)
net/tipc/link.c +2 -0
@@ -349,6 +349,8 @@ void tipc_link_remove_bc_peer(struct tipc_link *snd_l,u16 ack = snd_l->snd_nxt -1 ; snd_l->ackers--; + rcv_l->bc_peer_is_up = true; + rcv_l->state =LINK_ESTABLISHED ;tipc_link_bc_ack_rcv (rcv_l, ack, xmitq);tipc_link_reset (rcv_l); rcv_l->state =LINK_RESET ;
Signature · 9 lines
1.9.1 ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape
PATCH 3/3 tipc: reset all unicast links when broadcast send link fails
In reply to Jon MaloyIn test situations with many nodes and a heavily stressed system we have observed that the transmission broadcast link may fail due to an excessive number of retransmissions of the same packet. In such situations we need to reset all unicast links to all peers, in order to reset and re-synchronize the broadcast link.
In this commit, we add a new function tipc_bearer_reset_all() to be used in such situations. The function scans across all bearers and resets all their pertaining links.
--- net/tipc/bearer.c | 15 +++++++++++++++ net/tipc/bearer.h | 1 + net/tipc/node.c | 15 +++++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-)
net/tipc/bearer.c +15 -0
@@ -330,6 +330,21 @@ static int tipc_reset_bearer(struct net *net, struct tipc_bearer *b)return 0 ; } +/* tipc_bearer_reset_all - reset all links on all bearers +*/ +void tipc_bearer_reset_all (struct net *net) +{ +struct tipc_net *tn =tipc_net (net); +struct tipc_bearer *b; +int i; + +for (i =0 ; i <MAX_BEARERS ; i++) { + b =rcu_dereference_rtnl (tn->bearer_list[i]); +if (b) +tipc_reset_bearer (net, b); + } +} +/** * bearer_disable *
net/tipc/bearer.h +1 -0
@@ -198,6 +198,7 @@ void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest);void tipc_bearer_remove_dest (struct net *net,u32 bearer_id,u32 dest);struct tipc_bearer *tipc_bearer_find (struct net *net,const char *name);struct tipc_media *tipc_media_find (const char *name); +void tipc_bearer_reset_all (struct net *net);int tipc_bearer_setup (void );void tipc_bearer_cleanup (void );void tipc_bearer_stop (struct net *net);
net/tipc/node.c +11 -4
@@ -1297,10 +1297,6 @@ static void tipc_node_bc_rcv(struct net *net, struct sk_buff *skb, int bearer_id rc =tipc_bcast_rcv (net, be->link, skb); -/* Broadcast link reset may happen at reassembly failure */ -if (rc &TIPC_LINK_DOWN_EVT ) -tipc_node_reset_links (n); -/* Broadcast ACKs are sent on a unicast link */ if (rc &TIPC_LINK_SND_BC_ACK ) {tipc_node_read_lock (n);
@@ -1320,6 +1316,17 @@ static void tipc_node_bc_rcv(struct net *net, struct sk_buff *skb, int bearer_idspin_unlock_bh (&be->inputq2.lock);tipc_sk_mcast_rcv (net, &be->arrvq, &be->inputq2); } + +if (rc &TIPC_LINK_DOWN_EVT ) { +/* Reception reassembly failure => reset all links to peer */ +if (!tipc_link_is_up (be->link)) +tipc_node_reset_links (n); + +/* Retransmission failure => reset all links to all peers */ +if (!tipc_link_is_up (tipc_bc_sndlink (net))) +tipc_bearer_reset_all (net); + } +tipc_node_put (n); }
Signature · 9 lines
1.9.1 ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape
David Miller
maintainerFrom: Jon Maloy <[email protected]>
Date: Mon, 11 Jul 2016 16:08:34 -0400
Quoted 1 line
Fixes for some broadcast link problems that may occur in large systems.
Series applied, thanks Jon.