Commit aca2903e authored by Al Viro's avatar Al Viro

new step_into() flag: WALK_NOFOLLOW

Tells step_into() not to follow symlinks, regardless of LOOKUP_FOLLOW.
Allows to switch handle_lookup_down() to of step_into(), getting
all follow_managed() and step_into() calls paired.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 56676ec3
...@@ -1827,7 +1827,7 @@ static int pick_link(struct nameidata *nd, struct path *link, ...@@ -1827,7 +1827,7 @@ static int pick_link(struct nameidata *nd, struct path *link,
return 1; return 1;
} }
enum {WALK_FOLLOW = 1, WALK_MORE = 2}; enum {WALK_FOLLOW = 1, WALK_MORE = 2, WALK_NOFOLLOW = 4};
/* /*
* Do we need to follow links? We _really_ want to be able * Do we need to follow links? We _really_ want to be able
...@@ -1839,7 +1839,8 @@ static inline int step_into(struct nameidata *nd, struct path *path, ...@@ -1839,7 +1839,8 @@ static inline int step_into(struct nameidata *nd, struct path *path,
int flags, struct inode *inode, unsigned seq) int flags, struct inode *inode, unsigned seq)
{ {
if (likely(!d_is_symlink(path->dentry)) || if (likely(!d_is_symlink(path->dentry)) ||
!(flags & WALK_FOLLOW || nd->flags & LOOKUP_FOLLOW)) { !((flags & WALK_FOLLOW) || (nd->flags & LOOKUP_FOLLOW)) ||
(flags & WALK_NOFOLLOW)) {
/* not a symlink or should not follow */ /* not a symlink or should not follow */
path_to_nameidata(path, nd); path_to_nameidata(path, nd);
nd->inode = inode; nd->inode = inode;
...@@ -2363,10 +2364,7 @@ static int handle_lookup_down(struct nameidata *nd) ...@@ -2363,10 +2364,7 @@ static int handle_lookup_down(struct nameidata *nd)
err = handle_mounts(nd, nd->path.dentry, &path, &inode, &seq); err = handle_mounts(nd, nd->path.dentry, &path, &inode, &seq);
if (unlikely(err < 0)) if (unlikely(err < 0))
return err; return err;
path_to_nameidata(&path, nd); return step_into(nd, &path, WALK_NOFOLLOW, inode, seq);
nd->inode = inode;
nd->seq = seq;
return 0;
} }
/* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */
......
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