All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Thomas Graf <tgraf@suug.ch>
Cc: netdev@vger.kernel.org
Subject: Re: rhashtable: Fix reader/rehash race
Date: Fri, 13 Mar 2015 21:36:15 +1100	[thread overview]
Message-ID: <20150313103615.GB1559@gondor.apana.org.au> (raw)
In-Reply-To: <20150313103259.GC11089@casper.infradead.org>

On Fri, Mar 13, 2015 at 10:32:59AM +0000, Thomas Graf wrote:
>
> One last question though. What about rhashtable_remove()?
> The spin_unlock_bh() in __rhashtable_remove() only guarantees
> for loads before the release to be completed. The future_tbl
> load could still be reordered before the traversal is complete.
> I think it needs an smp_rmb() as well.

rhashtable_remove is fine because the rehasher has to take the
same lock to move things over.  That's what guarantees the new
future_tbl to be visible if it moved the to-be-removed object
over to the new table.

IOW if rhashtable_remove couldn't see the future_tbl then that
can only mean that the rehasher has yet to take the lock on that
bucket which implies that the object if it existed at all is still
in that bucket.

Cheers,
-- 
Email: Herbert Xu <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:[~2015-03-13 10:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12 11:07 rhashtable: Fix reader/rehash race Herbert Xu
2015-03-12 13:37 ` Thomas Graf
2015-03-12 16:33   ` [PATCH net-next] rhashtable: Fix race between rehashing and readers Thomas Graf
2015-03-12 21:50     ` Herbert Xu
2015-03-12 21:49   ` rhashtable: Fix reader/rehash race Herbert Xu
2015-03-13 10:32     ` Thomas Graf
2015-03-13 10:36       ` Herbert Xu [this message]
2015-03-13 10:54         ` Thomas Graf
2015-03-13  3:01 ` 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=20150313103615.GB1559@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.