From: <zyjzyj2000@gmail.com>
To: <j.vosburgh@gmail.com>, <vfalico@gmail.com>,
<gospo@cumulusnetworks.com>, <netdev@vger.kernel.org>,
<zyjzyj2000@gmail.com>
Subject: [PATCH 1/1] bond: relocate rcu_read_lock and rcu_read_unlock
Date: Mon, 1 Feb 2016 11:31:12 +0800 [thread overview]
Message-ID: <1454297472-24261-1-git-send-email-zyjzyj2000@gmail.com> (raw)
From: Zhu Yanjun <zyjzyj2000@gmail.com>
rcu_read_lock and rcu_read_unlock are to protect the function
bond_miimon_inspect. As such, moving rcu_read_lock and rcu_read_unlock
to the function bond_miimon_inspect to make the source code compact.
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <gospo@cumulusnetworks.com>
Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com>
---
drivers/net/bonding/bond_main.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 56b5605..4043181 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2022,6 +2022,7 @@ static int bond_miimon_inspect(struct bonding *bond)
struct slave *slave;
bool ignore_updelay;
+ rcu_read_lock();
ignore_updelay = !rcu_dereference(bond->curr_active_slave);
bond_for_each_slave_rcu(bond, slave, iter) {
@@ -2113,6 +2114,8 @@ static int bond_miimon_inspect(struct bonding *bond)
}
}
+ rcu_read_unlock();
+
return commit;
}
@@ -2231,12 +2234,9 @@ static void bond_mii_monitor(struct work_struct *work)
if (!bond_has_slaves(bond))
goto re_arm;
- rcu_read_lock();
-
should_notify_peers = bond_should_notify_peers(bond);
if (bond_miimon_inspect(bond)) {
- rcu_read_unlock();
/* Race avoidance with bond_close cancel of workqueue */
if (!rtnl_trylock()) {
@@ -2248,8 +2248,7 @@ static void bond_mii_monitor(struct work_struct *work)
bond_miimon_commit(bond);
rtnl_unlock(); /* might sleep, hold no other locks */
- } else
- rcu_read_unlock();
+ }
re_arm:
if (bond->params.miimon)
--
1.9.1
next reply other threads:[~2016-02-01 3:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 3:31 zyjzyj2000 [this message]
2016-02-01 11:01 ` [PATCH 1/1] bond: relocate rcu_read_lock and rcu_read_unlock Nikolay Aleksandrov
2016-02-01 11:08 ` Nikolay Aleksandrov
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=1454297472-24261-1-git-send-email-zyjzyj2000@gmail.com \
--to=zyjzyj2000@gmail.com \
--cc=gospo@cumulusnetworks.com \
--cc=j.vosburgh@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.com \
/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