Skip to content

Commit

Permalink
simplify link_path_walk() tail
Browse files Browse the repository at this point in the history
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: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 15, 2011
1 parent bd92d7f commit ce05254
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1467,20 +1467,14 @@ static int link_path_walk(const char *name, struct nameidata *nd)
nd->last_type = type;
return 0;
}
err = walk_component(nd, &next, &this, type,
lookup_flags & LOOKUP_FOLLOW);
err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW);
if (err < 0)
return err;
if (err) {
err = do_follow_link(&next, nd);
if (err)
return err;
}
if (lookup_flags & LOOKUP_DIRECTORY) {
err = -ENOTDIR;
if (!nd->inode->i_op->lookup)
break;
}
return 0;
}
terminate_walk(nd);
Expand Down

0 comments on commit ce05254

Please sign in to comment.