linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: neil@brown.name, Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 2/7] VFS: discard err2 in filename_create()
Date: Tue, 09 Sep 2025 07:24:34 -0400	[thread overview]
Message-ID: <cd3a851dac93204929c0743fbf0fc9ce05b72fef.camel@kernel.org> (raw)
In-Reply-To: <20250909044637.705116-3-neilb@ownmail.net>

On Tue, 2025-09-09 at 14:43 +1000, NeilBrown wrote:
> From: NeilBrown <neil@brown.name>
> 
> Since 204a575e91f3 "VFS: add common error checks to lookup_one_qstr_excl()"
> filename_create() does not need to stash the error value from mnt_want_write()
> into a separate variable - the logic that used to clobber 'error' after the
> call of mnt_want_write() has migrated into lookup_one_qstr_excl().
> 
> So there is no need for two different err variables.
> This patch discards "err2" and uses "error' throughout.
> 
> Signed-off-by: NeilBrown <neil@brown.name>
> ---
>  fs/namei.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index c7c6b255db2c..e2c2ab286bc0 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -4169,7 +4169,6 @@ static struct dentry *filename_create(int dfd, struct filename *name,
>  	unsigned int reval_flag = lookup_flags & LOOKUP_REVAL;
>  	unsigned int create_flags = LOOKUP_CREATE | LOOKUP_EXCL;
>  	int type;
> -	int err2;
>  	int error;
>  
>  	error = filename_parentat(dfd, name, reval_flag, path, &last, &type);
> @@ -4184,7 +4183,7 @@ static struct dentry *filename_create(int dfd, struct filename *name,
>  		goto out;
>  
>  	/* don't fail immediately if it's r/o, at least try to report other errors */
> -	err2 = mnt_want_write(path->mnt);
> +	error = mnt_want_write(path->mnt);
>  	/*
>  	 * Do the final lookup.  Suppress 'create' if there is a trailing
>  	 * '/', and a directory wasn't requested.
> @@ -4197,17 +4196,16 @@ static struct dentry *filename_create(int dfd, struct filename *name,
>  	if (IS_ERR(dentry))
>  		goto unlock;
>  
> -	if (unlikely(err2)) {
> -		error = err2;
> +	if (unlikely(error))
>  		goto fail;
> -	}
> +
>  	return dentry;
>  fail:
>  	dput(dentry);
>  	dentry = ERR_PTR(error);
>  unlock:
>  	inode_unlock(path->dentry->d_inode);
> -	if (!err2)
> +	if (!error)
>  		mnt_drop_write(path->mnt);
>  out:
>  	path_put(path);

Nice cleanup.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

IMO, Christian should go ahead and take in patches 2 and 3 in this
series. They make sense on their own.

  reply	other threads:[~2025-09-09 11:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09  4:43 [PATCH v2 0/8] VFS: more prep for change to directory locking NeilBrown
2025-09-09  4:43 ` [PATCH v2 1/7] VFS/ovl: add lookup_one_positive_killable() NeilBrown
2025-09-11 20:05   ` Al Viro
2025-09-11 23:02     ` NeilBrown
2025-09-09  4:43 ` [PATCH v2 2/7] VFS: discard err2 in filename_create() NeilBrown
2025-09-09 11:24   ` Jeff Layton [this message]
2025-09-09  4:43 ` [PATCH v2 3/7] VFS: unify old_mnt_idmap and new_mnt_idmap in renamedata NeilBrown
2025-09-09  4:43 ` [PATCH v2 4/7] VFS/audit: introduce kern_path_parent() for audit NeilBrown
2025-09-09  4:43 ` [PATCH v2 5/7] VFS: rename kern_path_locked() and related functions NeilBrown
2025-09-09 14:07   ` Amir Goldstein
2025-09-10  2:49     ` NeilBrown
2025-09-09  4:43 ` [PATCH v2 6/7] VFS: introduce simple_end_creating() and simple_failed_creating() NeilBrown
2025-09-09  8:20   ` Al Viro
2025-09-09  4:43 ` [PATCH v2 7/7] Use simple_start_creating() in various places NeilBrown
2025-09-09  8:19   ` Al Viro
2025-09-10  3:01     ` NeilBrown
2025-09-10  4:12       ` Al Viro
2025-09-10  4:16         ` Al Viro
2025-09-10  7:37           ` Al Viro
2025-09-10 11:04             ` Jeff Layton
2025-09-10 11:30               ` NeilBrown
2025-09-10 11:54                 ` Jeff Layton
2025-09-10 18:28                   ` Al Viro
2025-09-10 12:34             ` Jeff Layton
2025-09-10 23:13           ` 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=cd3a851dac93204929c0743fbf0fc9ce05b72fef.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=neil@brown.name \
    --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;
as well as URLs for NNTP newsgroup(s).