From: Ying Xue <ying.xue@windriver.com>
To: <davem@davemloft.net>
Cc: <jon.maloy@ericsson.com>, <Paul.Gortmaker@windriver.com>,
<erik.hugne@ericsson.com>, <netdev@vger.kernel.org>,
<tipc-discussion@lists.sourceforge.net>
Subject: [PATCH net-next 01/10] tipc: always use tipc_node_lock() to hold node lock
Date: Mon, 5 May 2014 08:56:09 +0800 [thread overview]
Message-ID: <1399251378-23842-2-git-send-email-ying.xue@windriver.com> (raw)
In-Reply-To: <1399251378-23842-1-git-send-email-ying.xue@windriver.com>
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>
---
net/tipc/link.c | 12 ++++++------
net/tipc/name_distr.c | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/tipc/link.c b/net/tipc/link.c
index c723ee9..3a80145 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)
rcu_read_lock();
list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
- spin_lock_bh(&n_ptr->lock);
+ tipc_node_lock(n_ptr);
l_ptr = n_ptr->links[bearer_id];
if (l_ptr) {
tipc_link_reset(l_ptr);
if (shutting_down || !tipc_node_is_up(n_ptr)) {
tipc_node_detach_link(l_ptr->owner, l_ptr);
tipc_link_reset_fragments(l_ptr);
- spin_unlock_bh(&n_ptr->lock);
+ tipc_node_unlock(n_ptr);
/* Nobody else can access this link now: */
del_timer_sync(&l_ptr->timer);
@@ -312,12 +312,12 @@ void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down)
} else {
/* Detach/delete when failover is finished: */
l_ptr->flags |= LINK_STOPPED;
- spin_unlock_bh(&n_ptr->lock);
+ tipc_node_unlock(n_ptr);
del_timer_sync(&l_ptr->timer);
}
continue;
}
- spin_unlock_bh(&n_ptr->lock);
+ tipc_node_unlock(n_ptr);
}
rcu_read_unlock();
}
@@ -474,11 +474,11 @@ void tipc_link_reset_list(unsigned int bearer_id)
rcu_read_lock();
list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
- spin_lock_bh(&n_ptr->lock);
+ tipc_node_lock(n_ptr);
l_ptr = n_ptr->links[bearer_id];
if (l_ptr)
tipc_link_reset(l_ptr);
- spin_unlock_bh(&n_ptr->lock);
+ tipc_node_unlock(n_ptr);
}
rcu_read_unlock();
}
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 974a73f..8465263 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)
rcu_read_lock();
list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
- spin_lock_bh(&n_ptr->lock);
+ tipc_node_lock(n_ptr);
l_ptr = n_ptr->active_links[n_ptr->addr & 1];
if (l_ptr) {
buf_copy = skb_copy(buf, GFP_ATOMIC);
if (!buf_copy) {
- spin_unlock_bh(&n_ptr->lock);
+ tipc_node_unlock(n_ptr);
break;
}
msg_set_destnode(buf_msg(buf_copy), n_ptr->addr);
__tipc_link_xmit(l_ptr, buf_copy);
}
- spin_unlock_bh(&n_ptr->lock);
+ tipc_node_unlock(n_ptr);
}
rcu_read_unlock();
--
1.7.9.5
next prev parent reply other threads:[~2014-05-05 0:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 0:56 [PATCH net-next 00/10] purge signal handler infrastructure Ying Xue
2014-05-05 0:56 ` Ying Xue [this message]
2014-05-05 0:56 ` [PATCH net-next 02/10] tipc: adjust order of variables in tipc_node structure Ying Xue
2014-05-05 0:56 ` [PATCH net-next 03/10] tipc: rename setup_blocked variable of node struct to flags Ying Xue
2014-05-05 0:56 ` [PATCH net-next 04/10] tipc: avoid to asynchronously notify subscriptions Ying Xue
2014-05-05 0:56 ` [PATCH net-next 05/10] tipc: remove TIPC_NAMES_GONE node flag Ying Xue
2014-05-05 0:56 ` [PATCH net-next 06/10] tipc: avoid to asynchronously deliver name tables to peer node Ying Xue
2014-05-05 0:56 ` [PATCH net-next 07/10] tipc: define new functions to operate bc_lock Ying Xue
2014-05-05 0:56 ` [PATCH net-next 08/10] tipc: convert allocations of global variables associated with bclink Ying Xue
2014-05-05 0:56 ` [PATCH net-next 09/10] tipc: avoid to asynchronously reset all links Ying Xue
2014-05-05 0:56 ` [PATCH net-next 10/10] tipc: purge signal handler infrastructure Ying Xue
2014-05-05 21:27 ` [PATCH net-next 00/10] " David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399251378-23842-2-git-send-email-ying.xue@windriver.com \
--to=ying.xue@windriver.com \
--cc=Paul.Gortmaker@windriver.com \
--cc=davem@davemloft.net \
--cc=erik.hugne@ericsson.com \
--cc=jon.maloy@ericsson.com \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).