On Tue, Nov 16, 2010 at 6:09 AM, Nick Piggin <npiggin@xxxxxxxxx> wrote: > Index: linux-2.6/fs/dcache.c > =================================================================== > --- linux-2.6.orig/fs/dcache.c 2010-11-17 00:52:37.000000000 +1100 > +++ linux-2.6/fs/dcache.c 2010-11-17 01:05:44.000000000 +1100 > @@ -217,24 +219,22 @@ static void dentry_lru_move_tail(struct > * > * If this is the root of the dentry tree, return NULL. > * > - * dcache_lock and d_lock must be held by caller, are dropped by d_kill. > + * dcache_lock and d_lock and d_parent->d_lock must be held by caller, and > + * are dropped by d_kill. > */ > -static struct dentry *d_kill(struct dentry *dentry) > +static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) > __releases(dentry->d_lock) > + __releases(parent->d_lock) > __releases(dcache_lock) > { > - struct dentry *parent; > - > list_del(&dentry->d_u.d_child); > + if (parent) > + spin_unlock(&parent->d_lock); > dentry_iput(dentry); > /* > * dentry_iput drops the locks, at which point nobody (except > * transient RCU lookups) can reach this dentry. > */ > - if (IS_ROOT(dentry)) > - parent = NULL; > - else > - parent = dentry->d_parent; > d_free(dentry); > return parent; > } > @@ -270,6 +270,7 @@ static struct dentry *d_kill(struct dent > > void dput(struct dentry *dentry) > { > + struct dentry *parent; > if (!dentry) > return; > > @@ -277,6 +278,10 @@ void dput(struct dentry *dentry) > if (dentry->d_count == 1) > might_sleep(); > spin_lock(&dentry->d_lock); > + if (IS_ROOT(dentry)) > + parent = NULL; > + else > + parent = dentry->d_parent; > if (dentry->d_count == 1) { > if (!spin_trylock(&dcache_lock)) { > /* Removed one and added three of the IS_ROOT() checks I think...Maybe add a macro for setting the local parent pointer? Ah never mind. In patch 28 they collapse back into a single instance. In this patch the nested locking starts to feel a little more natural to me. The last number of patches in the series end up re-simplifying a lot of intermediate complexity. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html