summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-11-14 01:34:52 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2016-12-05 19:11:57 -0500
commit7f49b471097011d03316d4ae1bc38f9c177126c3 (patch)
tree2610a026458a42ae85b13f2be1afa2f81a49213d /fs/namei.c
parentba8f46135ab19a6bc3ac11a16e8455956e13f6b1 (diff)
downloadlinux-stable-7f49b471097011d03316d4ae1bc38f9c177126c3.tar.gz
linux-stable-7f49b471097011d03316d4ae1bc38f9c177126c3.tar.bz2
linux-stable-7f49b471097011d03316d4ae1bc38f9c177126c3.zip
namei: shift interpretation of LOOKUP_FOLLOW inside should_follow_link()
Simplifies the arguments both for it and for walk_component() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/namei.c b/fs/namei.c
index ab4caccfe304..379168db782b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1737,7 +1737,7 @@ static inline int should_follow_link(struct nameidata *nd, struct path *link,
{
if (likely(!d_is_symlink(link->dentry)))
return 0;
- if (!follow)
+ if (!follow && !(nd->flags & LOOKUP_FOLLOW))
return 0;
/* make sure that d_is_symlink above matches inode */
if (nd->flags & LOOKUP_RCU) {
@@ -2248,12 +2248,7 @@ static inline int lookup_last(struct nameidata *nd)
nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
nd->flags &= ~LOOKUP_PARENT;
- return walk_component(nd,
- nd->flags & LOOKUP_FOLLOW
- ? nd->depth
- ? WALK_PUT | WALK_GET
- : WALK_GET
- : 0);
+ return walk_component(nd, nd->depth ? WALK_PUT : 0);
}
/* Returns 0 and nd will be valid on success; Retuns error, otherwise. */
@@ -2623,7 +2618,7 @@ mountpoint_last(struct nameidata *nd)
if (nd->depth)
put_link(nd);
path.mnt = nd->path.mnt;
- error = should_follow_link(nd, &path, nd->flags & LOOKUP_FOLLOW,
+ error = should_follow_link(nd, &path, 0,
d_backing_inode(path.dentry), 0);
if (unlikely(error))
return error;
@@ -3319,8 +3314,7 @@ static int do_last(struct nameidata *nd,
finish_lookup:
if (nd->depth)
put_link(nd);
- error = should_follow_link(nd, &path, nd->flags & LOOKUP_FOLLOW,
- inode, seq);
+ error = should_follow_link(nd, &path, 0, inode, seq);
if (unlikely(error))
return error;