diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2015-11-19 14:30:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-20 14:06:10 -0500 |
commit | 2312bf61ae365fdd6b9bfb24558a417859759447 (patch) | |
tree | 182ac3a58a25951a475c3bc88a32b0e82662201e /net/tipc/link.c | |
parent | 1d7e1c2595bd20c5274a8e49d89cf0cf483759de (diff) |
tipc: introduce per-link spinlock
As a preparation to allow parallel links to work more independently
from each other we introduce a per-link spinlock, to be stored in the
struct nodes's link entry area. Since the node lock still is a regular
spinlock there is no increase in parallellism at this stage.
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index fa452fb5f34e..b5e895c6f1aa 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1995,6 +1995,7 @@ int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info) struct tipc_node *node; struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; struct net *net = sock_net(skb->sk); + struct tipc_link_entry *le; if (!info->attrs[TIPC_NLA_LINK]) return -EINVAL; @@ -2020,17 +2021,17 @@ int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info) node = tipc_link_find_owner(net, link_name, &bearer_id); if (!node) return -EINVAL; - + le = &node->links[bearer_id]; tipc_node_lock(node); - - link = node->links[bearer_id].link; + spin_lock_bh(&le->lock); + link = le->link; if (!link) { tipc_node_unlock(node); return -EINVAL; } link_reset_statistics(link); - + spin_unlock_bh(&le->lock); tipc_node_unlock(node); return 0; |