lkml.org 
[lkml]   [2010]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: An incorrect assumption over radix_tree_tag_get()
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().



\
 
 \ /
  Last update: 2010-04-07 10:01    [W:0.113 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site