Commit 21c3003d authored by Al Viro's avatar Al Viro

put_link: nd->depth massage, part 8

all calls are preceded by decrement of nd->depth; move it into
put_link() itself.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9ea57b72
...@@ -754,7 +754,7 @@ void nd_jump_link(struct nameidata *nd, struct path *path) ...@@ -754,7 +754,7 @@ void nd_jump_link(struct nameidata *nd, struct path *path)
static inline void put_link(struct nameidata *nd) static inline void put_link(struct nameidata *nd)
{ {
struct saved *last = nd->stack + nd->depth; struct saved *last = nd->stack + --nd->depth;
struct inode *inode = last->link.dentry->d_inode; struct inode *inode = last->link.dentry->d_inode;
if (last->cookie && inode->i_op->put_link) if (last->cookie && inode->i_op->put_link)
inode->i_op->put_link(last->link.dentry, last->cookie); inode->i_op->put_link(last->link.dentry, last->cookie);
...@@ -1840,7 +1840,6 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -1840,7 +1840,6 @@ static int link_path_walk(const char *name, struct nameidata *nd)
err = 0; err = 0;
if (unlikely(!s)) { if (unlikely(!s)) {
/* jumped */ /* jumped */
nd->depth--;
put_link(nd); put_link(nd);
} else { } else {
if (*s == '/') { if (*s == '/') {
...@@ -1868,16 +1867,13 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -1868,16 +1867,13 @@ static int link_path_walk(const char *name, struct nameidata *nd)
} }
terminate_walk(nd); terminate_walk(nd);
Err: Err:
while (unlikely(nd->depth > 1)) { while (unlikely(nd->depth > 1))
nd->depth--;
put_link(nd); put_link(nd);
}
return err; return err;
OK: OK:
if (unlikely(nd->depth > 1)) { if (unlikely(nd->depth > 1)) {
name = nd->stack[nd->depth - 1].name; name = nd->stack[nd->depth - 1].name;
err = walk_component(nd, LOOKUP_FOLLOW); err = walk_component(nd, LOOKUP_FOLLOW);
nd->depth--;
put_link(nd); put_link(nd);
goto Walked; goto Walked;
} }
...@@ -2021,12 +2017,9 @@ static int trailing_symlink(struct nameidata *nd) ...@@ -2021,12 +2017,9 @@ static int trailing_symlink(struct nameidata *nd)
} }
nd->inode = nd->path.dentry->d_inode; nd->inode = nd->path.dentry->d_inode;
error = link_path_walk(s, nd); error = link_path_walk(s, nd);
if (unlikely(error)) { if (unlikely(error))
nd->depth--;
put_link(nd); put_link(nd);
return error; return error;
}
return 0;
} }
static inline int lookup_last(struct nameidata *nd) static inline int lookup_last(struct nameidata *nd)
...@@ -2066,7 +2059,6 @@ static int path_lookupat(int dfd, const struct filename *name, ...@@ -2066,7 +2059,6 @@ static int path_lookupat(int dfd, const struct filename *name,
if (err) if (err)
break; break;
err = lookup_last(nd); err = lookup_last(nd);
nd->depth--;
put_link(nd); put_link(nd);
} }
} }
...@@ -2416,7 +2408,6 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path, ...@@ -2416,7 +2408,6 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path,
if (err) if (err)
break; break;
err = mountpoint_last(nd, path); err = mountpoint_last(nd, path);
nd->depth--;
put_link(nd); put_link(nd);
} }
out: out:
...@@ -3301,7 +3292,6 @@ static struct file *path_openat(int dfd, struct filename *pathname, ...@@ -3301,7 +3292,6 @@ static struct file *path_openat(int dfd, struct filename *pathname,
if (unlikely(error)) if (unlikely(error))
break; break;
error = do_last(nd, file, op, &opened, pathname); error = do_last(nd, file, op, &opened, pathname);
nd->depth--;
put_link(nd); put_link(nd);
} }
out: out:
......
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