[PATCH 07/12] vfs: lookup_open(): use vfs_create_no_perm()
From: Jori Koolstra
Date: Sun Jun 14 2026 - 12:44:14 EST
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 | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 15bf28b85a4e..50eb357fc0ff 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4535,17 +4535,10 @@ 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);
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