Re: [PATCH v3 08/14] vfs: lookup_open(): use vfs_create_no_perm()

From: NeilBrown

Date: Mon Jul 06 2026 - 01:41:59 EST


On Sun, 05 Jul 2026, Jori Koolstra wrote:
> We can replace the code in the no create_error/negative dentry found
> from lookup case in lookup_open() with the vfs_create_no_perm() helper.
>
> It is safe here to always pass excl=true to ->create via
> vfs_create_no_perm(). Local filesystems always ignore the excl flag,
> and cluster filesystems implement ->atomic_open, so that the ->create
> call is never reached in lookup_open().
>
> Signed-off-by: Jori Koolstra <jkoolstra@xxxxxxxxx>
> ---
> fs/namei.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 6601460d2772..eaa0ade4a1b0 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -4553,16 +4553,10 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file,
> goto out_dput;
> }
>
> - error = try_break_deleg(dir_inode, LEASE_BREAK_DIR_CREATE, delegated_inode);
> + error = vfs_create_no_perm(idmap, dentry, mode, delegated_inode);
> if (error)
> goto out_dput;
>
> - error = dir_inode->i_op->create(idmap, dir_inode, dentry,
> - mode, open_flag & O_EXCL);
> - if (error)
> - goto out_dput;
> -
> - fsnotify_create(dir_inode, dentry);
> file->f_mode |= FMODE_CREATED;
>
> return dentry;
> --
> 2.55.0
>
>

Reviewed-by: NeilBrown <neil@xxxxxxxxxx>

Thanks,
NeilBrown