Re: [PATCH 08/19] VFS: introduce lookup_and_lock() and friends

From: Al Viro
Date: Wed Feb 12 2025 - 15:11:43 EST


On Wed, Feb 12, 2025 at 03:51:32PM +0000, Al Viro wrote:

> And _that_ is really useful, provided that it's reliable. What we
> need to avoid is d_drop()/d_rehash() windows, when that "operated
> upon" dentry ceases to be visible.

... which is easier to do these days - NFS doesn't do it anymore
(AFS still does, though). There's also a bit of magical mystery shite
in exfat_lookup()...

IIRC, we used to have something similar in VFAT as well, and it
had been bloody bogus...

Actually, this one is worse - this
/*
* Unhashed alias is able to exist because of revalidate()
* called by lookup_fast. You can easily make this status
* by calling create and lookup concurrently
* In such case, we reuse an alias instead of new dentry
*/
in there is utter nonsense - exfat_d_revalidate() never tells you to
drop positive dentries, to start with. Check for disconnected stuff
is also bogus (reasoning in "vfat: simplify checks in vfat_lookup()"
applies), d_drop(dentry) is pointless (->lookup() argument is not
hashed), for directories we don't give a rat's arse whether it's
hashed or not (d_splice_alias() will DTRT) and for non-directories
the next case in there (d_move() and return alias) will work,
hashed or unhashed.

Now, the case of alias dentry being locked is interesting (both for
exfat and vfat)...