aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-20 14:23:33 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-11 16:27:57 -0500
commitd465887f9d6b692214b0edffddf150eb702d35d9 (patch)
tree13456c9662e2cb9d2505b25a48e2f1ae19e6b717 /fs/namei.c
parent980f3ea2f650b0416c7768af09f4dcbd464d6e43 (diff)
fs/namei.c: fold link_path_walk() call into path_init()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 285001f7b84e..7241e267f769 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1873,7 +1873,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
1873 } else { 1873 } else {
1874 path_get(&nd->path); 1874 path_get(&nd->path);
1875 } 1875 }
1876 return 0; 1876 goto done;
1877 } 1877 }
1878 1878
1879 nd->root.mnt = NULL; 1879 nd->root.mnt = NULL;
@@ -1934,13 +1934,16 @@ static int path_init(int dfd, const char *name, unsigned int flags,
1934 1934
1935 nd->inode = nd->path.dentry->d_inode; 1935 nd->inode = nd->path.dentry->d_inode;
1936 if (!(flags & LOOKUP_RCU)) 1936 if (!(flags & LOOKUP_RCU))
1937 return 0; 1937 goto done;
1938 if (likely(!read_seqcount_retry(&nd->path.dentry->d_seq, nd->seq))) 1938 if (likely(!read_seqcount_retry(&nd->path.dentry->d_seq, nd->seq)))
1939 return 0; 1939 goto done;
1940 if (!(nd->flags & LOOKUP_ROOT)) 1940 if (!(nd->flags & LOOKUP_ROOT))
1941 nd->root.mnt = NULL; 1941 nd->root.mnt = NULL;
1942 rcu_read_unlock(); 1942 rcu_read_unlock();
1943 return -ECHILD; 1943 return -ECHILD;
1944done:
1945 current->total_link_count = 0;
1946 return link_path_walk(name, nd);
1944} 1947}
1945 1948
1946static void path_cleanup(struct nameidata *nd) 1949static void path_cleanup(struct nameidata *nd)
@@ -1984,13 +1987,6 @@ static int path_lookupat(int dfd, const char *name,
1984 * be able to complete). 1987 * be able to complete).
1985 */ 1988 */
1986 err = path_init(dfd, name, flags, nd); 1989 err = path_init(dfd, name, flags, nd);
1987
1988 if (unlikely(err))
1989 goto out;
1990
1991 current->total_link_count = 0;
1992 err = link_path_walk(name, nd);
1993
1994 if (!err && !(flags & LOOKUP_PARENT)) { 1990 if (!err && !(flags & LOOKUP_PARENT)) {
1995 err = lookup_last(nd, &path); 1991 err = lookup_last(nd, &path);
1996 while (err > 0) { 1992 while (err > 0) {
@@ -2018,7 +2014,6 @@ static int path_lookupat(int dfd, const char *name,
2018 } 2014 }
2019 } 2015 }
2020 2016
2021out:
2022 path_cleanup(nd); 2017 path_cleanup(nd);
2023 return err; 2018 return err;
2024} 2019}
@@ -2333,11 +2328,6 @@ path_mountpoint(int dfd, const char *name, struct path *path, unsigned int flags
2333 if (unlikely(err)) 2328 if (unlikely(err))
2334 goto out; 2329 goto out;
2335 2330
2336 current->total_link_count = 0;
2337 err = link_path_walk(name, &nd);
2338 if (err)
2339 goto out;
2340
2341 err = mountpoint_last(&nd, path); 2331 err = mountpoint_last(&nd, path);
2342 while (err > 0) { 2332 while (err > 0) {
2343 void *cookie; 2333 void *cookie;
@@ -3224,11 +3214,6 @@ static struct file *path_openat(int dfd, struct filename *pathname,
3224 if (unlikely(error)) 3214 if (unlikely(error))
3225 goto out; 3215 goto out;
3226 3216
3227 current->total_link_count = 0;
3228 error = link_path_walk(pathname->name, nd);
3229 if (unlikely(error))
3230 goto out;
3231
3232 error = do_last(nd, &path, file, op, &opened, pathname); 3217 error = do_last(nd, &path, file, op, &opened, pathname);
3233 while (unlikely(error > 0)) { /* trailing symlink */ 3218 while (unlikely(error > 0)) { /* trailing symlink */
3234 struct path link = path; 3219 struct path link = path;