aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-10-26 16:13:35 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-02-06 16:59:18 -0500
commitb98158e3b36645305363a598d91c544fa31446f1 (patch)
tree0bef1102cf7010554b0937caef31c2fb35678bca /net/tipc
parent0232c5a566ff52d5c9fc1dda70253c942628ca66 (diff)
tipc: Add missing locks in broadcast link statistics accumulation
Ensures that all attempts to update broadcast link statistics are done only while holding the lock that protects the link's main data structures, to prevent interference by simultaneous updates caused by messages arriving on other interfaces. 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.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 035b350be5c6..facc216c6a92 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -520,6 +520,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
520 520
521 if (likely(seqno == next_in)) { 521 if (likely(seqno == next_in)) {
522receive: 522receive:
523 spin_lock_bh(&bc_lock);
523 bcl->stats.recv_info++; 524 bcl->stats.recv_info++;
524 node->bclink.last_in++; 525 node->bclink.last_in++;
525 bclink_set_gap(node); 526 bclink_set_gap(node);
@@ -527,7 +528,9 @@ receive:
527 bclink_send_ack(node); 528 bclink_send_ack(node);
528 bcl->stats.sent_acks++; 529 bcl->stats.sent_acks++;
529 } 530 }
531
530 if (likely(msg_isdata(msg))) { 532 if (likely(msg_isdata(msg))) {
533 spin_unlock_bh(&bc_lock);
531 tipc_node_unlock(node); 534 tipc_node_unlock(node);
532 if (likely(msg_mcast(msg))) 535 if (likely(msg_mcast(msg)))
533 tipc_port_recv_mcast(buf, NULL); 536 tipc_port_recv_mcast(buf, NULL);
@@ -536,6 +539,7 @@ receive:
536 } else if (msg_user(msg) == MSG_BUNDLER) { 539 } else if (msg_user(msg) == MSG_BUNDLER) {
537 bcl->stats.recv_bundles++; 540 bcl->stats.recv_bundles++;
538 bcl->stats.recv_bundled += msg_msgcnt(msg); 541 bcl->stats.recv_bundled += msg_msgcnt(msg);
542 spin_unlock_bh(&bc_lock);
539 tipc_node_unlock(node); 543 tipc_node_unlock(node);
540 tipc_link_recv_bundle(buf); 544 tipc_link_recv_bundle(buf);
541 } else if (msg_user(msg) == MSG_FRAGMENTER) { 545 } else if (msg_user(msg) == MSG_FRAGMENTER) {
@@ -543,12 +547,15 @@ receive:
543 if (tipc_link_recv_fragment(&node->bclink.defragm, 547 if (tipc_link_recv_fragment(&node->bclink.defragm,
544 &buf, &msg)) 548 &buf, &msg))
545 bcl->stats.recv_fragmented++; 549 bcl->stats.recv_fragmented++;
550 spin_unlock_bh(&bc_lock);
546 tipc_node_unlock(node); 551 tipc_node_unlock(node);
547 tipc_net_route_msg(buf); 552 tipc_net_route_msg(buf);
548 } else if (msg_user(msg) == NAME_DISTRIBUTOR) { 553 } else if (msg_user(msg) == NAME_DISTRIBUTOR) {
554 spin_unlock_bh(&bc_lock);
549 tipc_node_unlock(node); 555 tipc_node_unlock(node);
550 tipc_named_recv(buf); 556 tipc_named_recv(buf);
551 } else { 557 } else {
558 spin_unlock_bh(&bc_lock);
552 tipc_node_unlock(node); 559 tipc_node_unlock(node);
553 buf_discard(buf); 560 buf_discard(buf);
554 } 561 }
@@ -601,11 +608,15 @@ receive:
601 } else 608 } else
602 deferred = 0; 609 deferred = 0;
603 610
611 spin_lock_bh(&bc_lock);
612
604 if (deferred) 613 if (deferred)
605 bcl->stats.deferred_recv++; 614 bcl->stats.deferred_recv++;
606 else 615 else
607 bcl->stats.duplicates++; 616 bcl->stats.duplicates++;
608 617
618 spin_unlock_bh(&bc_lock);
619
609unlock: 620unlock:
610 tipc_node_unlock(node); 621 tipc_node_unlock(node);
611exit: 622exit: