All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Dave Chinner <david@fromorbit.com>
Cc: David Howells <dhowells@redhat.com>,
	paulmck@linux.vnet.ibm.com, corbet@lwn.net,
	linux-kernel@vger.kernel.org, linux-cachefs@redhat.com
Subject: Re: An incorrect assumption over radix_tree_tag_get()
Date: Wed, 7 Apr 2010 17:57:30 +1000	[thread overview]
Message-ID: <20100407075730.GA5433@laptop> (raw)
In-Reply-To: <20100406233438.GH11036@dastard>

On Wed, Apr 07, 2010 at 09:34:38AM +1000, Dave Chinner wrote:
> On Wed, Apr 07, 2010 at 03:09:03AM +1000, Nick Piggin wrote:
> > On Tue, Apr 06, 2010 at 05:19:49PM +0100, David Howells wrote:
> > > 
> > > Hi,
> > > 
> > > I think I've made a bad assumption over my usage of radix_tree_tag_get() in
> > > fs/fscache/page.c.
> > > 
> > > I've assumed that radix_tree_tag_get() is protected from radix_tree_tag_set()
> > > and radix_tree_tag_clear() by the RCU read lock.  However, now I'm not so
> > > sure.  I think it's only protected against removal of part of the tree.
> > > 
> > > Can you confirm?
> > 
> > It is safe. Synchronization requirements for using the radix tree API
> > are documented.
> 
> I don't think it is safe - I made modifications to XFS that modified
> radix tree tags under a read lock (not RCU), but this resulted in
> corrupted tag state as concurrent tag set/clear operations for
> different slots propagated through the tree and got mixed up.
> Christoph fixed the problem (f1f724e4b523d444c5a598d74505aefa3d6844d2)
> by putting all tag modifications under the write lock.  I can't see
> how doing tag modifications under RCU read locks is any safer than
> doing it under a spinning read lock....

No the modifications must all be serialized, but they can run in
parallel with a radix_tree_tag_get().


      reply	other threads:[~2010-04-07  7:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06 16:19 An incorrect assumption over radix_tree_tag_get() David Howells
2010-04-06 17:09 ` Nick Piggin
2010-04-06 18:52   ` David Howells
2010-04-06 19:16     ` David Howells
2010-04-06 23:34   ` Dave Chinner
2010-04-07  7:57     ` Nick Piggin [this message]

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=20100407075730.GA5433@laptop \
    --to=npiggin@suse.de \
    --cc=corbet@lwn.net \
    --cc=david@fromorbit.com \
    --cc=dhowells@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.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 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.