aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-05-04 20:56:09 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-05 17:26:43 -0400
commit5356f3d7d48af72eb2a14b643d5563f068c44fe0 (patch)
treee0ad9803f7fbf71b467ea9bb3e24f64dc673939a /net/tipc
parent5b579e212fc77b6731e2767a0658ae7b64a67a10 (diff)
tipc: always use tipc_node_lock() to hold node lock
Although we obtain node lock with tipc_node_lock() in most time, there are still places where we directly use native spin lock interface to grab node lock. But as we will do more jobs in the future when node lock is released, we should ensure that tipc_node_lock() is always called when node lock is taken. Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/link.c12
-rw-r--r--net/tipc/name_distr.c6
2 files changed, 9 insertions, 9 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index c723ee90219d..3a801452643d 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -297,14 +297,14 @@ void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down)
297 297
298 rcu_read_lock(); 298 rcu_read_lock();
299 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) { 299 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
300 spin_lock_bh(&n_ptr->lock); 300 tipc_node_lock(n_ptr);
301 l_ptr = n_ptr->links[bearer_id]; 301 l_ptr = n_ptr->links[bearer_id];
302 if (l_ptr) { 302 if (l_ptr) {
303 tipc_link_reset(l_ptr); 303 tipc_link_reset(l_ptr);
304 if (shutting_down || !tipc_node_is_up(n_ptr)) { 304 if (shutting_down || !tipc_node_is_up(n_ptr)) {
305 tipc_node_detach_link(l_ptr->owner, l_ptr); 305 tipc_node_detach_link(l_ptr->owner, l_ptr);
306 tipc_link_reset_fragments(l_ptr); 306 tipc_link_reset_fragments(l_ptr);
307 spin_unlock_bh(&n_ptr->lock); 307 tipc_node_unlock(n_ptr);
308 308
309 /* Nobody else can access this link now: */ 309 /* Nobody else can access this link now: */
310 del_timer_sync(&l_ptr->timer); 310 del_timer_sync(&l_ptr->timer);
@@ -312,12 +312,12 @@ void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down)
312 } else { 312 } else {
313 /* Detach/delete when failover is finished: */ 313 /* Detach/delete when failover is finished: */
314 l_ptr->flags |= LINK_STOPPED; 314 l_ptr->flags |= LINK_STOPPED;
315 spin_unlock_bh(&n_ptr->lock); 315 tipc_node_unlock(n_ptr);
316 del_timer_sync(&l_ptr->timer); 316 del_timer_sync(&l_ptr->timer);
317 } 317 }
318 continue; 318 continue;
319 } 319 }
320 spin_unlock_bh(&n_ptr->lock); 320 tipc_node_unlock(n_ptr);
321 } 321 }
322 rcu_read_unlock(); 322 rcu_read_unlock();
323} 323}
@@ -474,11 +474,11 @@ void tipc_link_reset_list(unsigned int bearer_id)
474 474
475 rcu_read_lock(); 475 rcu_read_lock();
476 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) { 476 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
477 spin_lock_bh(&n_ptr->lock); 477 tipc_node_lock(n_ptr);
478 l_ptr = n_ptr->links[bearer_id]; 478 l_ptr = n_ptr->links[bearer_id];
479 if (l_ptr) 479 if (l_ptr)
480 tipc_link_reset(l_ptr); 480 tipc_link_reset(l_ptr);
481 spin_unlock_bh(&n_ptr->lock); 481 tipc_node_unlock(n_ptr);
482 } 482 }
483 rcu_read_unlock(); 483 rcu_read_unlock();
484} 484}
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 974a73f3d876..8465263246c3 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -135,18 +135,18 @@ void named_cluster_distribute(struct sk_buff *buf)
135 135
136 rcu_read_lock(); 136 rcu_read_lock();
137 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) { 137 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
138 spin_lock_bh(&n_ptr->lock); 138 tipc_node_lock(n_ptr);
139 l_ptr = n_ptr->active_links[n_ptr->addr & 1]; 139 l_ptr = n_ptr->active_links[n_ptr->addr & 1];
140 if (l_ptr) { 140 if (l_ptr) {
141 buf_copy = skb_copy(buf, GFP_ATOMIC); 141 buf_copy = skb_copy(buf, GFP_ATOMIC);
142 if (!buf_copy) { 142 if (!buf_copy) {
143 spin_unlock_bh(&n_ptr->lock); 143 tipc_node_unlock(n_ptr);
144 break; 144 break;
145 } 145 }
146 msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); 146 msg_set_destnode(buf_msg(buf_copy), n_ptr->addr);
147 __tipc_link_xmit(l_ptr, buf_copy); 147 __tipc_link_xmit(l_ptr, buf_copy);
148 } 148 }
149 spin_unlock_bh(&n_ptr->lock); 149 tipc_node_unlock(n_ptr);
150 } 150 }
151 rcu_read_unlock(); 151 rcu_read_unlock();
152 152