Thread (16 messages) 16 messages, 2 authors, 10d ago

[PATCH v7 04/12] vfs: move ->create check in lookup_open() to before try_break_deleg()

flat view
COOLING10d SUPERSEDED: 1 (1M)

From: Jori Koolstra <jkoolstra@xs4all.nl>
Date: 2026-10-16 14:37:14
Also in: linux-fsdevel, lkml
Subsystem: filesystems (vfs and infrastructure), the rest · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds

Status: Superseded by v8 (posted 2026-10-24). [go to v8]

Revision v7 (7 revisions archived); 1 review trailer.

Revisions (7)
  1. v6 re-posted go to this post
  2. v1 [diff against previous] re-posted go to this post
  3. v2 [diff against previous]
  4. v3 [diff against previous]
  5. v5 [diff against previous]
  6. v7 current [diff against previous]
  7. v8 [diff against previous]
The i_op->create check in lookup_open() takes place after the
try_break_deleg() call. This does not match the order when doing a
regular file create via mknod(2). There the call order is:

	filename_mknodat()
	vfs_create()
	i_op->create check
	try_break_deleg()

Move the i_op->create check to before try_break_deleg() in
lookup_open().

Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
 fs/namei.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index a979488c2167..000d8841a8ec 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4605,15 +4605,15 @@ 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);
-	if (error)
-		goto out_dput;
-
 	if (!dir_inode->i_op->create) {
 		error = -EACCES;
 		goto out_dput;
 	}
 
+	error = try_break_deleg(dir_inode, LEASE_BREAK_DIR_CREATE, &delegated_inode);
+	if (error)
+		goto out_dput;
+
 	error = dir_inode->i_op->create(idmap, dir_inode, dentry, mode);
 	if (error)
 		goto out_dput;
-- 
2.56.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help