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: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
e269f2a73f
commit
70291aecc6
1 changed files with 10 additions and 9 deletions
19
fs/namei.c
19
fs/namei.c
|
@ -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)
|
||||||
{
|
{
|
||||||
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)
|
||||||
* 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,
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue