aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-10-26 15:33:44 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-02-06 16:59:17 -0500
commit8a275a6a30ba871eb34ea41c1fbb507039f4c0dc (patch)
tree249a3987649b2e7c35c5099071ecaf1355308c80 /net/tipc
parent57732560d1aa7d454d10e557f8959d19d1454174 (diff)
tipc: Fix node lock reclamation issues in broadcast link reception
Fixes a pair of problems in broadcast link message reception code relating to the reclamation of the node lock after consuming an in-sequence message. 1) Now retests to see if the sending node is still up after reclaiming the node lock, and bails out if it is non-operational. 2) Now manipulates the node's deferred message queue only after reclaiming the node lock, rather than using queue head pointer information that was cached previously. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bcast.c58
1 files changed, 40 insertions, 18 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 7342abc2cfa1..e7df313020ce 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -474,7 +474,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
474 struct tipc_node *node; 474 struct tipc_node *node;
475 u32 next_in; 475 u32 next_in;
476 u32 seqno; 476 u32 seqno;
477 struct sk_buff *deferred; 477 int deferred;
478 478
479 /* Screen out unwanted broadcast messages */ 479 /* Screen out unwanted broadcast messages */
480 480
@@ -489,6 +489,8 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
489 if (unlikely(!node->bclink.supported)) 489 if (unlikely(!node->bclink.supported))
490 goto unlock; 490 goto unlock;
491 491
492 /* Handle broadcast protocol message */
493
492 if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) { 494 if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) {
493 if (msg_type(msg) != STATE_MSG) 495 if (msg_type(msg) != STATE_MSG)
494 goto unlock; 496 goto unlock;
@@ -513,11 +515,11 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
513 515
514 /* Handle in-sequence broadcast message */ 516 /* Handle in-sequence broadcast message */
515 517
516receive:
517 next_in = mod(node->bclink.last_in + 1);
518 seqno = msg_seqno(msg); 518 seqno = msg_seqno(msg);
519 next_in = mod(node->bclink.last_in + 1);
519 520
520 if (likely(seqno == next_in)) { 521 if (likely(seqno == next_in)) {
522receive:
521 bcl->stats.recv_info++; 523 bcl->stats.recv_info++;
522 node->bclink.last_in++; 524 node->bclink.last_in++;
523 bclink_set_gap(node); 525 bclink_set_gap(node);
@@ -551,23 +553,40 @@ receive:
551 buf_discard(buf); 553 buf_discard(buf);
552 } 554 }
553 buf = NULL; 555 buf = NULL;
556
557 /* Determine new synchronization state */
558
554 tipc_node_lock(node); 559 tipc_node_lock(node);
555 deferred = node->bclink.deferred_head; 560 if (unlikely(!tipc_node_is_up(node)))
556 if (deferred && (buf_seqno(deferred) == mod(next_in + 1))) { 561 goto unlock;
557 buf = deferred; 562
558 msg = buf_msg(buf); 563 if (!node->bclink.deferred_head)
559 node->bclink.deferred_head = deferred->next; 564 goto unlock;
560 goto receive; 565
561 } 566 msg = buf_msg(node->bclink.deferred_head);
562 } else if (less(next_in, seqno)) { 567 seqno = msg_seqno(msg);
568 next_in = mod(next_in + 1);
569 if (seqno != next_in)
570 goto unlock;
571
572 /* Take in-sequence message from deferred queue & deliver it */
573
574 buf = node->bclink.deferred_head;
575 node->bclink.deferred_head = buf->next;
576 goto receive;
577 }
578
579 /* Handle out-of-sequence broadcast message */
580
581 if (less(next_in, seqno)) {
563 u32 gap_after = node->bclink.gap_after; 582 u32 gap_after = node->bclink.gap_after;
564 u32 gap_to = node->bclink.gap_to; 583 u32 gap_to = node->bclink.gap_to;
565 584
566 if (tipc_link_defer_pkt(&node->bclink.deferred_head, 585 deferred = tipc_link_defer_pkt(&node->bclink.deferred_head,
567 &node->bclink.deferred_tail, 586 &node->bclink.deferred_tail,
568 buf)) { 587 buf);
588 if (deferred) {
569 node->bclink.nack_sync++; 589 node->bclink.nack_sync++;
570 bcl->stats.deferred_recv++;
571 if (seqno == mod(gap_after + 1)) 590 if (seqno == mod(gap_after + 1))
572 node->bclink.gap_after = seqno; 591 node->bclink.gap_after = seqno;
573 else if (less(gap_after, seqno) && less(seqno, gap_to)) 592 else if (less(gap_after, seqno) && less(seqno, gap_to))
@@ -579,9 +598,12 @@ receive:
579 bclink_send_nack(node); 598 bclink_send_nack(node);
580 bclink_set_gap(node); 599 bclink_set_gap(node);
581 } 600 }
582 } else { 601 } else
583 bcl->stats.duplicates++; 602 deferred = 0;
584 } 603
604 if (deferred)
605 bcl->stats.deferred_recv++;
606
585unlock: 607unlock:
586 tipc_node_unlock(node); 608 tipc_node_unlock(node);
587exit: 609exit: