Unverified Commit 3f90030e authored by NeilBrown's avatar NeilBrown Committed by Christian Brauner
Browse files

hostfs: store inode in dentry after mkdir if possible.



After handling a mkdir, get the inode for the name and use
d_splice_alias() to store the correct dentry in the dcache.

Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Link: https://lore.kernel.org/r/20250227013949.536172-3-neilb@suse.de


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 88d5baf6
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -682,14 +682,22 @@ static int hostfs_symlink(struct mnt_idmap *idmap, struct inode *ino,
static struct dentry *hostfs_mkdir(struct mnt_idmap *idmap, struct inode *ino,
				   struct dentry *dentry, umode_t mode)
{
	struct inode *inode;
	char *file;
	int err;

	if ((file = dentry_name(dentry)) == NULL)
		return ERR_PTR(-ENOMEM);
	err = do_mkdir(file, mode);
	if (err) {
		dentry = ERR_PTR(err);
	} else {
		inode = hostfs_iget(dentry->d_sb, file);
		d_drop(dentry);
		dentry = d_splice_alias(inode, dentry);
	}
	__putname(file);
	return ERR_PTR(err);
	return dentry;
}

static int hostfs_rmdir(struct inode *ino, struct dentry *dentry)