[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6df6e94e5a8623182aa7ed398270e817d4102303.camel@kernel.org>
Date: Fri, 21 Feb 2025 08:17:47 -0500
From: Jeff Layton <jlayton@...nel.org>
To: NeilBrown <neilb@...e.de>, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, Miklos
Szeredi <miklos@...redi.hu>, Xiubo Li <xiubli@...hat.com>, Ilya Dryomov
<idryomov@...il.com>, Richard Weinberger <richard@....at>, Anton Ivanov
<anton.ivanov@...bridgegreys.com>, Johannes Berg
<johannes@...solutions.net>, Trond Myklebust <trondmy@...nel.org>, Anna
Schumaker <anna@...nel.org>, Chuck Lever <chuck.lever@...cle.com>, Olga
Kornievskaia <okorniev@...hat.com>, Dai Ngo <Dai.Ngo@...cle.com>, Tom
Talpey <tom@...pey.com>, Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-cifs@...r.kernel.org, linux-nfs@...r.kernel.org,
linux-um@...ts.infradead.org, ceph-devel@...r.kernel.org,
netfs@...ts.linux.dev
Subject: Re: [PATCH 2/6] hostfs: store inode in dentry after mkdir if
possible.
On Fri, 2025-02-21 at 10:36 +1100, NeilBrown wrote:
> After handling a mkdir, get the inode for the name and use
> d_splice_alias() to store the correct dentry in the dcache.
>
> Signed-off-by: NeilBrown <neilb@...e.de>
> ---
> fs/hostfs/hostfs_kern.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
> index ccbb48fe830d..a2c6b9051c5b 100644
> --- a/fs/hostfs/hostfs_kern.c
> +++ b/fs/hostfs/hostfs_kern.c
> @@ -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)
Reviewed-by: Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists