netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: "David S. Miller" <davem@davemloft.net>
Cc: fubar@us.ibm.com, netdev@oss.sgi.com, jgarzik@pobox.com
Subject: Re: [PATCH 2.6.12-rc2] bonding: partially back out dev_set_mac_address
Date: Mon, 25 Apr 2005 22:41:36 +1000	[thread overview]
Message-ID: <20050425124136.GA20159@gondor.apana.org.au> (raw)
In-Reply-To: <20050424185149.278ffb93.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

On Sun, Apr 24, 2005 at 06:51:49PM -0700, David S. Miller wrote:
>
> > So if you want a quick and dirty fix, why not make bonding call
> > dev_set_mac_address from a work queue?
> 
> I'd say we still have at least two weeks until 2.6.12 final goes out.
> So if you want to work on the proper long-term fix now, by all means
> please do so.

Well I had a go at it but I realised that this isn't something that
can be fixed properly in two weeks.  The work queue hack can
probably be done in that time frame but it'll be darn ugly.

I found another reason why we need to defer the dev_set_mac_address to
process context: We need to hold the RTNL while it's taking place.
Otherwise someone else could come along and change the slave's MAC
address at the same time.  Because device drivers tend to rely on the
RTNL to guarantee non-reentrancy, this is likely to break.

I also managed to find a little bug along the way though so let's quash
it :) bond_alb_set_mac_address did not acquire bond->lock before
operating on the slaves.  As it can be done at any time by the user,
this could interfere with the timers.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 533 bytes --]

drivers/net/bonding/bond_alb.c: 5ce606d9dc03f9b145c3024abecfca20ec65fd9d
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1666,6 +1666,7 @@ int bond_alb_set_mac_address(struct net_
 		}
 	}
 
+	write_lock_bh(&bond->lock);
 	if (swap_slave) {
 		alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
 	} else {
@@ -1678,6 +1679,7 @@ int bond_alb_set_mac_address(struct net_
 			rlb_req_update_slave_clients(bond, bond->curr_active_slave);
 		}
 	}
+	write_unlock_bh(&bond->lock);
 
 	return 0;
 }

  parent reply	other threads:[~2005-04-25 12:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-07 19:59 [PATCH 2.6.12-rc2] bonding: partially back out dev_set_mac_address Jay Vosburgh
2005-04-07 20:31 ` David S. Miller
2005-04-07 20:55   ` Jay Vosburgh
2005-04-07 20:57     ` David S. Miller
2005-04-07 21:35       ` Jay Vosburgh
2005-04-08 12:36         ` Herbert Xu
2005-04-08 20:58           ` Jay Vosburgh
2005-04-08 22:16             ` Herbert Xu
2005-04-08 23:55               ` Jay Vosburgh
2005-04-09  0:21                 ` Herbert Xu
2005-04-09  0:31                   ` Herbert Xu
     [not found]                     ` <20050424185149.278ffb93.davem@davemloft.net>
2005-04-25 12:41                       ` Herbert Xu [this message]
2005-04-08  3:50 ` Jeff Garzik
2005-04-08  4:45   ` David S. Miller
     [not found] <20050426011907.GA13846@gondor.apana.org.au>
     [not found] ` <200504260411.j3Q4BYke004030@death.nxdomain.ibm.com>
2005-04-26 11:18   ` Herbert Xu
2005-04-27  2:09     ` Jay Vosburgh
2005-04-27  2:15       ` Herbert Xu

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=20050425124136.GA20159@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).