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>
This commit is contained in:
committed by
David S. Miller
parent
6c7a762e70
commit
2220646a53
@@ -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
|
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
|
||||||
" (too many nodes)");
|
" (too many nodes)");
|
||||||
}
|
}
|
||||||
buf = tipc_cfg_reply_alloc(payload_size);
|
|
||||||
if (!buf) {
|
|
||||||
spin_unlock_bh(&node_list_lock);
|
spin_unlock_bh(&node_list_lock);
|
||||||
|
|
||||||
|
buf = tipc_cfg_reply_alloc(payload_size);
|
||||||
|
if (!buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* Add TLVs for all nodes in scope */
|
/* Add TLVs for all nodes in scope */
|
||||||
rcu_read_lock();
|
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));
|
&node_info, sizeof(node_info));
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
spin_unlock_bh(&node_list_lock);
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user