Ethernet Bridge development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Pavel Emelyanov <xemul@openvz.org>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	bridge@lists.osdl.org, devel@openvz.org
Subject: Re: [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook
Date: Fri, 30 Nov 2007 00:04:20 +1100	[thread overview]
Message-ID: <20071129130420.GA8487@gondor.apana.org.au> (raw)
In-Reply-To: <474C43F4.5080704@openvz.org>

On Tue, Nov 27, 2007 at 07:21:08PM +0300, Pavel Emelyanov wrote:
> This hook is protected with the RCU, so simple
> 
> 	if (br_should_route_hook)
> 		br_should_route_hook(...)
> 
> is not enough on some architectures.
> 
> Use the rcu_dereference/rcu_assign_pointer in this case.
> 
> Fixed Stephen's comment concerning using the typeof().
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied to net-2.6.  Thanks Pavel!

>  static void __exit ebtable_broute_fini(void)
>  {
> -	br_should_route_hook = NULL;
> +	rcu_assign_pointer(br_should_route_hook, NULL);

Just for the record, rcu_assign_pointer is never necessary when
you're assigning NULL.  The reason is that rcu_assign_pointer serves
as a barrier between the initialisation of the content of what you're
assigning and the actual assignment.  Since NULL does not need to be
initialised you don't need the barrier :)

Hmm, perhaps we could even build this logic into rcu_assign_pointer.

Then again, who still uses an Alpha? Mine died years ago :)

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

  reply	other threads:[~2007-11-29 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27 16:21 [PATCH (resubmit)][BRIDGE] Properly dereference the br_should_route_hook Pavel Emelyanov
2007-11-29 13:04 ` Herbert Xu [this message]
2007-11-29 14:36   ` Paul E. McKenney
2007-11-29 23:49     ` Herbert Xu
2007-11-30  1:25       ` Paul E. McKenney
2007-11-30  2:31         ` 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=20071129130420.GA8487@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=bridge@lists.osdl.org \
    --cc=devel@openvz.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=xemul@openvz.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