Skip to content

Commit 3655959

Browse files
ajstephensPaul Gortmaker
authored andcommitted
tipc: Ignore broadcast acknowledgements that are out-of-range
Adds checks to TIPC's broadcast link so that it ignores any acknowledgement message containing a sequence number that does not correspond to an unacknowledged message currently in the broadcast link's transmit queue. This change prevents the broadcast link from becoming stalled if a newly booted node receives stale broadcast link acknowledgement information from another node that has not yet fully synchronized its end of the broadcast link to reflect the current state of the new node's end. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
1 parent 10745cd commit 3655959

4 files changed

Lines changed: 37 additions & 13 deletions

File tree

‎net/tipc/bcast.c‎

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,36 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
237237
struct sk_buff *next;
238238
unsigned int released = 0;
239239

240-
if (less_eq(acked, n_ptr->bclink.acked))
241-
return;
242-
243240
spin_lock_bh(&bc_lock);
244241

245-
/* Skip over packets that node has previously acknowledged */
246-
242+
/* Bail out if tx queue is empty (no clean up is required) */
247243
crs = bcl->first_out;
244+
if (!crs)
245+
goto exit;
246+
247+
/* Determine which messages need to be acknowledged */
248+
if (acked == INVALID_LINK_SEQ) {
249+
/*
250+
* Contact with specified node has been lost, so need to
251+
* acknowledge sent messages only (if other nodes still exist)
252+
* or both sent and unsent messages (otherwise)
253+
*/
254+
if (bclink->bcast_nodes.count)
255+
acked = bcl->fsm_msg_cnt;
256+
else
257+
acked = bcl->next_out_no;
258+
} else {
259+
/*
260+
* Bail out if specified sequence number does not correspond
261+
* to a message that has been sent and not yet acknowledged
262+
*/
263+
if (less(acked, buf_seqno(crs)) ||
264+
less(bcl->fsm_msg_cnt, acked) ||
265+
less_eq(acked, n_ptr->bclink.acked))
266+
goto exit;
267+
}
268+
269+
/* Skip over packets that node has previously acknowledged */
248270
while (crs && less_eq(buf_seqno(crs), n_ptr->bclink.acked))
249271
crs = crs->next;
250272

@@ -255,8 +277,6 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
255277

256278
if (crs != bcl->next_out)
257279
bcbuf_decr_acks(crs);
258-
else if (bclink->bcast_nodes.count)
259-
break;
260280
else {
261281
bcbuf_set_acks(crs, 0);
262282
bcl->next_out = next;
@@ -281,6 +301,7 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
281301
}
282302
if (unlikely(released && !list_empty(&bcl->waiting_ports)))
283303
tipc_link_wakeup_ports(bcl, 0);
304+
exit:
284305
spin_unlock_bh(&bc_lock);
285306
}
286307

‎net/tipc/link.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,10 +1733,8 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr)
17331733

17341734
/* Release acked messages */
17351735

1736-
if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) {
1737-
if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported)
1738-
tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
1739-
}
1736+
if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported)
1737+
tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
17401738

17411739
crs = l_ptr->first_out;
17421740
while ((crs != l_ptr->next_out) &&

‎net/tipc/link.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
#define PUSH_FAILED 1
4545
#define PUSH_FINISHED 2
4646

47+
/*
48+
* Out-of-range value for link sequence numbers
49+
*/
50+
51+
#define INVALID_LINK_SEQ 0x10000
52+
4753
/*
4854
* Link states
4955
*/

‎net/tipc/node.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,7 @@ static void node_lost_contact(struct tipc_node *n_ptr)
351351
}
352352

353353
tipc_bclink_remove_node(n_ptr->addr);
354-
tipc_bclink_acknowledge(n_ptr,
355-
mod(n_ptr->bclink.acked + 10000));
354+
tipc_bclink_acknowledge(n_ptr, INVALID_LINK_SEQ);
356355
if (n_ptr->addr < tipc_own_addr)
357356
tipc_own_tag--;
358357

0 commit comments

Comments
 (0)