diff options
| author | Ying Xue <ying.xue@windriver.com> | 2014-03-27 00:54:38 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-03-27 13:08:37 -0400 |
| commit | 2220646a53aa588798653232e26172ec36ab06cd (patch) | |
| tree | d42b0b3357846cbd1c4fa15f94e7a671c50de84d /net/tipc | |
| parent | 6c7a762e70637a256229f9dc9ca793908e8bd01b (diff) | |
tipc: use node_list_lock to protect tipc_num_nodes variable
As tipc_node_list is protected by rcu read lock on read side, it's
unnecessary to hold node_list_lock to protect tipc_node_list in
tipc_node_get_links(). Instead, node_list_lock should just protects
tipc_num_nodes in the function.
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/node.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 4f517ff783d9..85405a6e3076 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
| @@ -352,11 +352,11 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
| 352 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 352 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
| 353 | " (too many nodes)"); | 353 | " (too many nodes)"); |
| 354 | } | 354 | } |
| 355 | spin_unlock_bh(&node_list_lock); | ||
| 356 | |||
| 355 | buf = tipc_cfg_reply_alloc(payload_size); | 357 | buf = tipc_cfg_reply_alloc(payload_size); |
| 356 | if (!buf) { | 358 | if (!buf) |
| 357 | spin_unlock_bh(&node_list_lock); | ||
| 358 | return NULL; | 359 | return NULL; |
| 359 | } | ||
| 360 | 360 | ||
| 361 | /* Add TLVs for all nodes in scope */ | 361 | /* Add TLVs for all nodes in scope */ |
| 362 | rcu_read_lock(); | 362 | rcu_read_lock(); |
| @@ -369,7 +369,6 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
| 369 | &node_info, sizeof(node_info)); | 369 | &node_info, sizeof(node_info)); |
| 370 | } | 370 | } |
| 371 | rcu_read_unlock(); | 371 | rcu_read_unlock(); |
| 372 | spin_unlock_bh(&node_list_lock); | ||
| 373 | return buf; | 372 | return buf; |
| 374 | } | 373 | } |
| 375 | 374 | ||
