From: Jay Vosburgh <fubar@us.ibm.com>
To: netdev@vger.kernel.org, jgarzik@pobox.com
Cc: andy@greyhouse.net, Jay Vosburgh <fubar@us.ibm.com>
Subject: [PATCH 6/6] Acquire correct locks in alb for promisc change
Date: Wed, 10 Oct 2007 21:14:09 -0700 [thread overview]
Message-ID: <11920760543809-git-send-email-fubar@us.ibm.com> (raw)
In-Reply-To: <11920760533281-git-send-email-fubar@us.ibm.com>
Update ALB mode monitor to hold correct locks (RTNL and nothing
else) when calling dev_set_promiscuity.
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_alb.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 6db5d76..25b8dbf 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1455,16 +1455,16 @@ void bond_alb_monitor(struct work_struct *work)
/* handle rlb stuff */
if (bond_info->rlb_enabled) {
- /* the following code changes the promiscuity of the
- * the curr_active_slave. It needs to be locked with a
- * write lock to protect from other code that also
- * sets the promiscuity.
- */
- write_lock_bh(&bond->curr_slave_lock);
-
if (bond_info->primary_is_promisc &&
(++bond_info->rlb_promisc_timeout_counter >= RLB_PROMISC_TIMEOUT)) {
+ /*
+ * dev_set_promiscuity requires rtnl and
+ * nothing else.
+ */
+ read_unlock(&bond->lock);
+ rtnl_lock();
+
bond_info->rlb_promisc_timeout_counter = 0;
/* If the primary was set to promiscuous mode
@@ -1473,9 +1473,10 @@ void bond_alb_monitor(struct work_struct *work)
*/
dev_set_promiscuity(bond->curr_active_slave->dev, -1);
bond_info->primary_is_promisc = 0;
- }
- write_unlock_bh(&bond->curr_slave_lock);
+ rtnl_unlock();
+ read_lock(&bond->lock);
+ }
if (bond_info->rlb_rebalance) {
bond_info->rlb_rebalance = 0;
--
1.5.3.1
next prev parent reply other threads:[~2007-10-11 4:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-11 4:14 [PATCH 0/6] bonding workqueue and lock rework Jay Vosburgh
2007-10-11 4:14 ` [PATCH 1/6] Convert bonding timers to workqueues Jay Vosburgh
2007-10-11 4:14 ` [PATCH 2/6] Convert balance-rr transmit to new locking Jay Vosburgh
2007-10-11 4:14 ` [PATCH 3/6] Convert miimon " Jay Vosburgh
2007-10-11 4:14 ` [PATCH 4/6] Convert locks to _bh, rework alb locking for " Jay Vosburgh
2007-10-11 4:14 ` [PATCH 5/6] Convert more locks to _bh, acquire rtnl, " Jay Vosburgh
2007-10-11 4:14 ` Jay Vosburgh [this message]
2007-10-15 18:41 ` [PATCH 1/6] Convert bonding timers to workqueues Jeff Garzik
2007-10-15 19:08 ` Jay Vosburgh
2007-10-22 14:55 ` Mike Snitzer
2007-10-22 18:34 ` Jeff Garzik
2007-10-22 18:57 ` Jay Vosburgh
-- strict thread matches above, loose matches on Subject: below --
2007-10-18 0:37 [PATCH 0/6] bonding workqueue and lock rework Jay Vosburgh
2007-10-18 0:37 ` [PATCH 1/6] Convert bonding timers to workqueues Jay Vosburgh
2007-10-18 0:37 ` [PATCH] Two small fixes to IPoIB support for bonding: Jay Vosburgh
2007-10-18 0:37 ` [PATCH 2/6] Convert balance-rr transmit to new locking Jay Vosburgh
2007-10-18 0:37 ` [PATCH 3/6] Convert miimon " Jay Vosburgh
2007-10-18 0:37 ` [PATCH 4/6] Convert locks to _bh, rework alb locking for " Jay Vosburgh
2007-10-18 0:37 ` [PATCH 5/6] Convert more locks to _bh, acquire rtnl, " Jay Vosburgh
2007-10-18 0:37 ` [PATCH 6/6] Acquire correct locks in alb for promisc change Jay Vosburgh
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=11920760543809-git-send-email-fubar@us.ibm.com \
--to=fubar@us.ibm.com \
--cc=andy@greyhouse.net \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
/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).