Re: [PATCH 4/7] configfs: remove d_add() calls before configfs_attach_group()

From: Al Viro

Date: Tue Sep 29 2026 - 01:08:15 EST


On Tue, Sep 29, 2026 at 01:36:04PM +1000, NeilBrown wrote:
> From: NeilBrown <neil@xxxxxxxxxx>
>
> These d_add() calls cannot be necessary. The inode given is NULL so all
> they do is attach the dentry to the hash table.
>
> If configfs_attach_group() fails, then d_drop() is called so the dentry
> will be detached.
> If configfs_attach_group() succeeds, then
> configfs_attach_group -> configfs_attach_item ->configfs_create_dir
> must have succeeded, so d_instantiate() will have been called and the
> dentry hashed there.

Neither in mainline, nor in -next...

d_add() _is_ wrong there, but this is not the right solution. What
we really ought to do is build the subtree first, then either dissolve
it (without any pathname resolution having ever seen it) or move it
in place once we are sure that everything worked.