Commit ce052544 authored by Al Viro's avatar Al Viro

simplify link_path_walk() tail

Now that link_path_walk() is called without LOOKUP_PARENT
only from do_follow_link(), we can simplify the checks in
last component handling.  First of all, checking if we'd
arrived to a directory is not needed - the caller will check
it anyway.  And LOOKUP_FOLLOW is guaranteed to be there,
since we only get to that place with nd->depth > 0.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent bd92d7fe
...@@ -1467,8 +1467,7 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -1467,8 +1467,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
nd->last_type = type; nd->last_type = type;
return 0; return 0;
} }
err = walk_component(nd, &next, &this, type, err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW);
lookup_flags & LOOKUP_FOLLOW);
if (err < 0) if (err < 0)
return err; return err;
if (err) { if (err) {
...@@ -1476,11 +1475,6 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -1476,11 +1475,6 @@ static int link_path_walk(const char *name, struct nameidata *nd)
if (err) if (err)
return err; return err;
} }
if (lookup_flags & LOOKUP_DIRECTORY) {
err = -ENOTDIR;
if (!nd->inode->i_op->lookup)
break;
}
return 0; return 0;
} }
terminate_walk(nd); terminate_walk(nd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment