summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2020-01-09 22:30:08 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2020-03-13 01:15:42 +0300
commite73cabff591706d7eb643d4c6981a236cb9d76ff (patch)
tree3ba82d96c51d6cab3a0d0fb79ec2d8d50d2ca257
parentda5ebf5aa676c4106d1e7032d22679831cb6ba72 (diff)
downloadlinux-e73cabff591706d7eb643d4c6981a236cb9d76ff.tar.xz
do_last(): collapse the call of path_to_nameidata()
... and shift filling struct path to just before the call of handle_mounts(). All callers of handle_mounts() are immediately preceded by path->mnt = nd->path.mnt now. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c
index b350e1e2b46f..79029a1048be 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3362,8 +3362,6 @@ static int do_last(struct nameidata *nd,
error = PTR_ERR(dentry);
goto out;
}
- path.mnt = nd->path.mnt;
- path.dentry = dentry;
if (file->f_mode & FMODE_OPENED) {
if ((file->f_mode & FMODE_CREATED) ||
@@ -3380,7 +3378,8 @@ static int do_last(struct nameidata *nd,
open_flag &= ~O_TRUNC;
will_truncate = false;
acc_mode = 0;
- path_to_nameidata(&path, nd);
+ dput(nd->path.dentry);
+ nd->path.dentry = dentry;
goto finish_open_created;
}
@@ -3394,6 +3393,8 @@ static int do_last(struct nameidata *nd,
got_write = false;
}
+ path.mnt = nd->path.mnt;
+ path.dentry = dentry;
error = handle_mounts(&path, nd, &inode, &seq);
if (unlikely(error < 0))
return error;