Re: [PATCH] First casuality of hlist poisoning in 2.5.70

viro@parcelfarce.linux.theplanet.co.uk
Thu, 12 Jun 2003 17:26:27 +0100


On Wed, Jun 11, 2003 at 10:22:25PM -0700, Linus Torvalds wrote:

> HOWEVER, I actually suspect that the target really _cannot_ be unhashed,
> and that the test makes no sense, and the sequence should just be
>
> /* Rehash the dentry onto the same hash as the target */
> hlist_del_rcu(&dentry->d_hash);
> hlist_add_head_rcu(&dentry->d_hash, target->d_bucket);
> dentry->d_vfs_flags &= ~DCACHE_UNHASHED;

> But I suspect that neither dentry nor target should really ever be
> unhashed by the time we call d_move(). That's reinforced by the fact that
> it looks like a unhashed dentry in d_move() would have been a silent bug
> previously - staying unhashed if it just shared the bucket.

> Al, I'll be really happy having you go over this code too. And whatever we
> decide is right (enforcing hashedness or whatever), we should assert it,
> because clearly d_move() has been a bit too subtle for us so far.

Sigh... The real problem is not in d_move(), but in the way NFS drops
dentries. That, and the fact that we are eating the consequences of
RCU use in dcache - it had predictably made the entire thing _far_ too
subtle.

We probably should accept that both d_move() arguments can be unhashed.
After the move hashed status of source should remain as it is and
victim^Wtarget should get unhashed.

We _do_ need to sort out the situation with unhashing stuff in NFS - in
particular, the way it deals with mountpoints and with directories is
a mess. I'm looking through that code, but it's bloody slow analysis
due to RCU. Premature optimizations and all such...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/