summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-24 18:04:22 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-22 23:31:34 -0500
commit5f4a6a695075b79261793c25b1128e3b30007646 (patch)
tree6f304f5b1a84bb1face5428f6d55160453583e6c
parentad8ca3743cb7eef0eb8a2e87943c513201685eec (diff)
downloadlinux-3.10-5f4a6a695075b79261793c25b1128e3b30007646.tar.gz
linux-3.10-5f4a6a695075b79261793c25b1128e3b30007646.tar.bz2
linux-3.10-5f4a6a695075b79261793c25b1128e3b30007646.zip
link_path_walk(): move assignments to nd->last/nd->last_type up
... and clean the main loop a bit Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/namei.c b/fs/namei.c
index e0a33f598cd..14eab848f7d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1802,8 +1802,11 @@ static int link_path_walk(const char *name, struct nameidata *nd)
}
}
+ nd->last = this;
+ nd->last_type = type;
+
if (!name[len])
- goto last_component;
+ return 0;
/*
* If it wasn't NUL, we know it was '/'. Skip that
* slash, and continue until no more slashes.
@@ -1812,7 +1815,8 @@ static int link_path_walk(const char *name, struct nameidata *nd)
len++;
} while (unlikely(name[len] == '/'));
if (!name[len])
- goto last_component;
+ return 0;
+
name += len;
err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW);
@@ -1824,16 +1828,10 @@ static int link_path_walk(const char *name, struct nameidata *nd)
if (err)
return err;
}
- if (can_lookup(nd->inode))
- continue;
- err = -ENOTDIR;
- break;
- /* here ends the main loop */
-
-last_component:
- nd->last = this;
- nd->last_type = type;
- return 0;
+ if (!can_lookup(nd->inode)) {
+ err = -ENOTDIR;
+ break;
+ }
}
terminate_walk(nd);
return err;