From: Jeff Layton <jlayton@kernel.org>
To: NeilBrown <neil@brown.name>,
Christian Brauner <brauner@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
David Howells <dhowells@redhat.com>, Jan Kara <jack@suse.cz>,
Chuck Lever <chuck.lever@oracle.com>,
Miklos Szeredi <miklos@szeredi.hu>,
Amir Goldstein <amir73il@gmail.com>,
John Johansen <john.johansen@canonical.com>,
Paul Moore <paul@paul-moore.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Stephen Smalley <stephen.smalley.work@gmail.com>,
"Darrick J. Wong" <djwong@kernel.org>
Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev,
linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org,
linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com,
linux-security-module@vger.kernel.org, selinux@vger.kernel.org
Subject: Re: [PATCH v3 01/15] VFS: note error returns in documentation for various lookup functions
Date: Mon, 02 Mar 2026 15:11:00 -0500 [thread overview]
Message-ID: <df3a0c1d7c2aa4653725a20401264de2ca1645b3.camel@kernel.org> (raw)
In-Reply-To: <20260224222542.3458677-2-neilb@ownmail.net>
On Wed, 2026-02-25 at 09:16 +1100, NeilBrown wrote:
> From: NeilBrown <neil@brown.name>
>
> Darrick recently noted that try_lookup_noperm() is documented as
> "Look up a dentry by name in the dcache, returning NULL if it does not
> currently exist." but it can in fact return an error.
>
> So update the documentation for that and related functions.
>
> Link: https://lore.kernel.org/all/20260218234917.GA6490@frogsfrogsfrogs/
> Cc: "Darrick J. Wong" <djwong@kernel.org>
> Signed-off-by: NeilBrown <neil@brown.name>
> ---
> fs/namei.c | 29 ++++++++++++++++++++++++++++-
> 1 file changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 58f715f7657e..6f595f58acfe 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -3124,7 +3124,8 @@ static int lookup_one_common(struct mnt_idmap *idmap,
> * @base: base directory to lookup from
> *
> * Look up a dentry by name in the dcache, returning NULL if it does not
> - * currently exist. The function does not try to create a dentry and if one
> + * currently exist or an error if there is a problem with the name.
> + * The function does not try to create a dentry and if one
> * is found it doesn't try to revalidate it.
> *
> * Note that this routine is purely a helper for filesystem usage and should
> @@ -3132,6 +3133,11 @@ static int lookup_one_common(struct mnt_idmap *idmap,
> *
> * No locks need be held - only a counted reference to @base is needed.
> *
> + * Returns:
> + * - ref-counted dentry on success, or
> + * - %NULL if name could not be found, or
> + * - ERR_PTR(-EACCES) if name is dot or dotdot or contains a slash or nul, or
> + * - ERR_PTR() if fs provide ->d_hash, and this returned an error.
> */
> struct dentry *try_lookup_noperm(struct qstr *name, struct dentry *base)
> {
> @@ -3208,6 +3214,11 @@ EXPORT_SYMBOL(lookup_one);
> *
> * Unlike lookup_one, it should be called without the parent
> * i_rwsem held, and will take the i_rwsem itself if necessary.
> + *
> + * Returns: - A dentry, possibly negative, or
> + * - same errors as try_lookup_noperm() or
> + * - ERR_PTR(-ENOENT) if parent has been removed, or
> + * - ERR_PTR(-EACCES) if parent directory is not searchable.
> */
> struct dentry *lookup_one_unlocked(struct mnt_idmap *idmap, struct qstr *name,
> struct dentry *base)
> @@ -3244,6 +3255,10 @@ EXPORT_SYMBOL(lookup_one_unlocked);
> * It should be called without the parent i_rwsem held, and will take
> * the i_rwsem itself if necessary. If a fatal signal is pending or
> * delivered, it will return %-EINTR if the lock is needed.
> + *
> + * Returns: A dentry, possibly negative, or
> + * - same errors as lookup_one_unlocked() or
> + * - ERR_PTR(-EINTR) if a fatal signal is pending.
> */
> struct dentry *lookup_one_positive_killable(struct mnt_idmap *idmap,
> struct qstr *name,
Claude says:
lookup_one_positive_killable() documentation says "A dentry, possibly negative" but the function
explicitly converts negative dentries to ERR_PTR(-ENOENT). It should say "A positive dentry" like
the companion functions lookup_one_positive_unlocked() and lookup_noperm_positive_unlocked().
...but that seems to be the only "regression" it found.
Aside from that nit, this looks fine to me.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-03-02 20:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 22:16 [PATCH v3 00/15] Further centralising of directory locking for name ops NeilBrown
2026-02-24 22:16 ` [PATCH v3 01/15] VFS: note error returns in documentation for various lookup functions NeilBrown
2026-03-02 20:11 ` Jeff Layton [this message]
2026-03-02 20:28 ` NeilBrown
2026-02-24 22:16 ` [PATCH v3 02/15] fs/proc: Don't lock root inode when creating "self" and "thread-self" NeilBrown
2026-02-24 22:16 ` [PATCH v3 03/15] VFS: move the start_dirop() kerndoc comment to before start_dirop() NeilBrown
2026-02-24 22:16 ` [PATCH v3 04/15] libfs: change simple_done_creating() to use end_creating() NeilBrown
2026-03-02 20:11 ` Jeff Layton
2026-02-24 22:16 ` [PATCH v3 05/15] Apparmor: Use simple_start_creating() / simple_done_creating() NeilBrown
2026-03-06 9:42 ` Christian Brauner
2026-03-06 21:12 ` NeilBrown
2026-02-24 22:16 ` [PATCH v3 06/15] selinux: " NeilBrown
2026-02-24 22:16 ` [PATCH v3 07/15] nfsd: switch purge_old() to use start_removing_noperm() NeilBrown
2026-02-24 22:16 ` [PATCH v3 08/15] VFS: make lookup_one_qstr_excl() static NeilBrown
2026-02-24 22:16 ` [PATCH v3 09/15] ovl: Simplify ovl_lookup_real_one() NeilBrown
2026-02-24 22:16 ` [PATCH v3 10/15] cachefiles: change cachefiles_bury_object to use start_renaming_dentry() NeilBrown
2026-03-06 10:03 ` Christian Brauner
2026-03-08 20:57 ` [PATCH] FIXUP: " NeilBrown
2026-03-09 8:43 ` Christian Brauner
2026-02-24 22:16 ` [PATCH v3 11/15] ovl: pass name buffer to ovl_start_creating_temp() NeilBrown
2026-02-24 22:16 ` [PATCH v3 12/15] ovl: change ovl_create_real() to get a new lock when re-opening created file NeilBrown
2026-02-24 22:16 ` [PATCH v3 13/15] ovl: use is_subdir() for testing if one thing is a subdir of another NeilBrown
2026-02-24 22:16 ` [PATCH v3 14/15] ovl: remove ovl_lock_rename_workdir() NeilBrown
2026-02-24 22:17 ` [PATCH v3 15/15] VFS: unexport lock_rename(), lock_rename_child(), unlock_rename() NeilBrown
2026-03-05 1:24 ` [PATCH v3 00/15] Further centralising of directory locking for name ops NeilBrown
2026-03-06 10:40 ` Christian Brauner
2026-03-06 21:16 ` NeilBrown
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=df3a0c1d7c2aa4653725a20401264de2ca1645b3.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=amir73il@gmail.com \
--cc=apparmor@lists.ubuntu.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dhowells@redhat.com \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=neil@brown.name \
--cc=netfs@lists.linux.dev \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=stephen.smalley.work@gmail.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