aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-05-04 08:58:35 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-05-10 22:20:12 -0400
commit8620c238edbf373aafcc4ee129e76c8e794c5214 (patch)
tree2da38ce30bb27a14abe637aac50fbda3060a7a3d /fs/namei.c
parent1543972678e31bcfbc7f15170c12fb601c9f5c90 (diff)
link_path_walk: move the OK: inside the loop
fewer labels that way; in particular, resuming after the end of nested symlink is straight-line. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 31da71753d7b..19e5c8a27ea4 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1806,11 +1806,21 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1806 do { 1806 do {
1807 name++; 1807 name++;
1808 } while (unlikely(*name == '/')); 1808 } while (unlikely(*name == '/'));
1809 if (!*name) 1809 if (unlikely(!*name)) {
1810 goto OK; 1810OK:
1811 1811 /* called from path_init(), done */
1812 err = walk_component(nd, LOOKUP_FOLLOW); 1812 if (!nd->depth)
1813Walked: 1813 return 0;
1814 name = nd->stack[nd->depth - 1].name;
1815 /* called from trailing_symlink(), done */
1816 if (!name)
1817 return 0;
1818 /* last component of nested symlink */
1819 err = walk_component(nd, LOOKUP_FOLLOW);
1820 put_link(nd);
1821 } else {
1822 err = walk_component(nd, LOOKUP_FOLLOW);
1823 }
1814 if (err < 0) 1824 if (err < 0)
1815 break; 1825 break;
1816 1826
@@ -1859,16 +1869,6 @@ Walked:
1859 } 1869 }
1860 terminate_walk(nd); 1870 terminate_walk(nd);
1861 return err; 1871 return err;
1862OK:
1863 if (!nd->depth) /* called from path_init(), done */
1864 return 0;
1865 name = nd->stack[nd->depth - 1].name;
1866 if (!name) /* called from trailing_symlink(), done */
1867 return 0;
1868
1869 err = walk_component(nd, LOOKUP_FOLLOW);
1870 put_link(nd);
1871 goto Walked;
1872} 1872}
1873 1873
1874static int path_init(int dfd, const struct filename *name, unsigned int flags, 1874static int path_init(int dfd, const struct filename *name, unsigned int flags,