Skip to content

Commit e66ccd3

Browse files
neilbrownbrauner
authored andcommitted
VFS: discard err2 in filename_create()
Since 204a575 "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. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 17eb98d commit e66ccd3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

fs/namei.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4169,7 +4169,6 @@ static struct dentry *filename_create(int dfd, struct filename *name,
41694169
unsigned int reval_flag = lookup_flags & LOOKUP_REVAL;
41704170
unsigned int create_flags = LOOKUP_CREATE | LOOKUP_EXCL;
41714171
int type;
4172-
int err2;
41734172
int error;
41744173

41754174
error = filename_parentat(dfd, name, reval_flag, path, &last, &type);
@@ -4184,7 +4183,7 @@ static struct dentry *filename_create(int dfd, struct filename *name,
41844183
goto out;
41854184

41864185
/* don't fail immediately if it's r/o, at least try to report other errors */
4187-
err2 = mnt_want_write(path->mnt);
4186+
error = mnt_want_write(path->mnt);
41884187
/*
41894188
* Do the final lookup. Suppress 'create' if there is a trailing
41904189
* '/', and a directory wasn't requested.
@@ -4197,17 +4196,16 @@ static struct dentry *filename_create(int dfd, struct filename *name,
41974196
if (IS_ERR(dentry))
41984197
goto unlock;
41994198

4200-
if (unlikely(err2)) {
4201-
error = err2;
4199+
if (unlikely(error))
42024200
goto fail;
4203-
}
4201+
42044202
return dentry;
42054203
fail:
42064204
dput(dentry);
42074205
dentry = ERR_PTR(error);
42084206
unlock:
42094207
inode_unlock(path->dentry->d_inode);
4210-
if (!err2)
4208+
if (!error)
42114209
mnt_drop_write(path->mnt);
42124210
out:
42134211
path_put(path);

0 commit comments

Comments
 (0)