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 --- fs/namei.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 063d40d5753e..b1b43c85651a 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4551,16 +4551,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.54.0