提交 70291aec 编写于 作者: A Al Viro

namei: lift (open-coded) terminate_walk() in follow_dotdot_rcu() into callers

follow_dotdot_rcu() does an equivalent of terminate_walk() on failure;
shifting it into callers makes for simpler rules and those callers
already have terminate_walk() on other failure exits.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 e269f2a7
...@@ -1230,10 +1230,6 @@ static int follow_dotdot_rcu(struct nameidata *nd) ...@@ -1230,10 +1230,6 @@ static int follow_dotdot_rcu(struct nameidata *nd)
return 0; return 0;
failed: failed:
nd->flags &= ~LOOKUP_RCU;
if (!(nd->flags & LOOKUP_ROOT))
nd->root.mnt = NULL;
rcu_read_unlock();
return -ECHILD; return -ECHILD;
} }
...@@ -1551,8 +1547,7 @@ static inline int handle_dots(struct nameidata *nd, int type) ...@@ -1551,8 +1547,7 @@ static inline int handle_dots(struct nameidata *nd, int type)
{ {
if (type == LAST_DOTDOT) { if (type == LAST_DOTDOT) {
if (nd->flags & LOOKUP_RCU) { if (nd->flags & LOOKUP_RCU) {
if (follow_dotdot_rcu(nd)) return follow_dotdot_rcu(nd);
return -ECHILD;
} else } else
follow_dotdot(nd); follow_dotdot(nd);
} }
...@@ -1592,8 +1587,12 @@ static int walk_component(struct nameidata *nd, int follow) ...@@ -1592,8 +1587,12 @@ static int walk_component(struct nameidata *nd, int follow)
* to be able to know about the current root directory and * to be able to know about the current root directory and
* parent relationships. * parent relationships.
*/ */
if (unlikely(nd->last_type != LAST_NORM)) if (unlikely(nd->last_type != LAST_NORM)) {
return handle_dots(nd, nd->last_type); err = handle_dots(nd, nd->last_type);
if (err)
goto out_err;
return 0;
}
err = lookup_fast(nd, &path, &inode); err = lookup_fast(nd, &path, &inode);
if (unlikely(err)) { if (unlikely(err)) {
if (err < 0) if (err < 0)
...@@ -2981,8 +2980,10 @@ static int do_last(struct nameidata *nd, ...@@ -2981,8 +2980,10 @@ static int do_last(struct nameidata *nd,
if (nd->last_type != LAST_NORM) { if (nd->last_type != LAST_NORM) {
error = handle_dots(nd, nd->last_type); error = handle_dots(nd, nd->last_type);
if (error) if (unlikely(error)) {
terminate_walk(nd);
return error; return error;
}
goto finish_open; goto finish_open;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册