summaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-03-27 05:54:38 +0100
committerDavid S. Miller <davem@davemloft.net>2014-03-27 18:08:37 +0100
commit2220646a53aa588798653232e26172ec36ab06cd (patch)
treed42b0b3357846cbd1c4fa15f94e7a671c50de84d /net/tipc/node.c
parenttipc: tipc: convert node list and node hlist to RCU lists (diff)
downloadlinux-2220646a53aa588798653232e26172ec36ab06cd.tar.xz
linux-2220646a53aa588798653232e26172ec36ab06cd.zip
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/node.c')
-rw-r--r--net/tipc/node.c7
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)
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (too many nodes)");
}
+ spin_unlock_bh(&node_list_lock);
+
buf = tipc_cfg_reply_alloc(payload_size);
- if (!buf) {
- spin_unlock_bh(&node_list_lock);
+ if (!buf)
return NULL;
- }
/* Add TLVs for all nodes in scope */
rcu_read_lock();
@@ -369,7 +369,6 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
&node_info, sizeof(node_info));
}
rcu_read_unlock();
- spin_unlock_bh(&node_list_lock);
return buf;
}