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. Signed-off-by: Jori Koolstra --- fs/namei.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 293592a4d011..a8c247e0bb65 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4533,17 +4533,11 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file, goto out_dput; } - /* but break the directory lease first! */ - error = try_break_deleg(dir_inode, delegated_inode); + error = vfs_create_no_perm(idmap, dentry, mode, delegated_inode, + open_flag & O_EXCL); 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; } -- 2.54.0