Re: [PATCH 08/11] VFS: allow d_splice_alias() and d_add() to work on hashed dentries.

From: NeilBrown

Date: Wed Feb 25 2026 - 20:34:41 EST


On Thu, 26 Feb 2026, NeilBrown wrote:
>
> d_add_hashed() would be much the same as d_instantiate(), and that
> could be used for d_splice_alias() when the dentry is hashed.
> There aren't any cases where d_splice_alias() is called with a directory
> inode and a hashed dentry.

There are of course... mkdir() is given a hashed negative dentry and may
need to use d_splice_alias() if there is any chance the inode was
accessible (e.g. by fhandle) before the splice can happen.

Maybe we could always give mkdir a d_in_lookup() alias?

As it is, generic "create object" code inside a filesystem may need to
handle three cases:

d_in_lookup() - use d_splice_alias()
otherwise if non-dir: - use d_instantiate
otherwise - use some new d_add_or_obtain (name taken from NFS) which
does the right thing with directories.

Currently most d_drop() and use d_splice_alias() but I need to avoid the
d_drop().

Thanks,
NeilBrown