From: Jori Koolstra <jkoolstra@xs4all.nl>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Paul Moore <paul@paul-moore.com>, Eric Paris <eparis@redhat.com>
Cc: Jan Kara <jack@suse.cz>, NeilBrown <neil@brown.name>,
linux-fsdevel@vger.kernel.org, audit@vger.kernel.org,
linux-kernel@vger.kernel.org, Jori Koolstra <jkoolstra@xs4all.nl>
Subject: [PATCH 3/3] fs/namei.c: update kerneldoc of atomic_open()
Date: Fri, 10 Jul 2026 18:42:33 +0200 [thread overview]
Message-ID: <20260710164233.827744-4-jkoolstra@xs4all.nl> (raw)
In-Reply-To: <20260710164233.827744-1-jkoolstra@xs4all.nl>
The comments above atomic_open() contain several errors:
- atomic_open() does not return 0 if successful
- @path is not updated
Fix those and be more explicit about when FMODE_OPENED and FMODE_CREATED
are set. Change to a full kerneldoc.
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/namei.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index fe5d59c6f925..2eef2a49d3f4 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4336,18 +4336,26 @@ static int may_o_create(struct mnt_idmap *idmap,
return security_inode_create(dir->dentry->d_inode, dentry, mode);
}
-/*
- * Attempt to atomically look up, create and open a file from a negative
- * dentry.
- *
- * Returns 0 if successful. The file will have been created and attached to
- * @file by the filesystem calling finish_open().
- *
- * If the file was looked up only or didn't need creating, FMODE_OPENED won't
- * be set. The caller will need to perform the open themselves. @path will
- * have been updated to point to the new dentry. This may be negative.
- *
- * Returns an error code otherwise.
+/**
+ * atomic_open() - attempt to atomically look up, create and open a file
+ * from a negative dentry.
+ * @path: parent directory path
+ * @dentry: child to ->atomic_open()
+ * @file: file to attach child to
+ * @open_flag: open flags
+ * @mode: create mode
+ * @create_error: return value from may_o_create()
+ *
+ * If a non-error dentry is returned then: when FMODE_OPENED is set,
+ * the file will have been attached to @file by the filesystem calling
+ * finish_open(). If FMODE_OPENED isn't set, the filesystem instead called
+ * finish_no_open() and the caller will need to perform the open themselves.
+ *
+ * FMODE_CREATED is set when the call to ->atomic_open() actually created
+ * the file.
+ *
+ * Returns the opened/looked-up dentry on success or ERR_PTR(-E) on failure.
+ * On error, atomic_open() consumes @dentry.
*/
static struct dentry *atomic_open(const struct path *path, struct dentry *dentry,
struct file *file,
--
2.55.0
next prev parent reply other threads:[~2026-07-10 16:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 16:42 [PATCH 0/3] vfs: call audit_inode_child() in lookup_open() on failure Jori Koolstra
2026-07-10 16:42 ` [PATCH 1/3] vfs: move create error && negative dentry case in lookup_open() up Jori Koolstra
2026-07-24 21:10 ` Paul Moore
2026-07-10 16:42 ` [PATCH 2/3] vfs: call audit_inode_child() in lookup_open() on failure Jori Koolstra
2026-07-24 21:10 ` Paul Moore
2026-07-27 21:59 ` Jori Koolstra
2026-07-10 16:42 ` Jori Koolstra [this message]
2026-07-24 21:10 ` [PATCH 3/3] fs/namei.c: update kerneldoc of atomic_open() Paul Moore
2026-07-22 14:40 ` [PATCH 0/3] vfs: call audit_inode_child() in lookup_open() on failure Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260710164233.827744-4-jkoolstra@xs4all.nl \
--to=jkoolstra@xs4all.nl \
--cc=audit@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=eparis@redhat.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil@brown.name \
--cc=paul@paul-moore.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®