pull handling of . and .. into inlined helper
getting LOOKUP_RCU checks out of link_path_walk()... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7bc055d1d5
commit
9856fa1b28
1 changed files with 16 additions and 14 deletions
30
fs/namei.c
30
fs/namei.c
|
@ -1318,6 +1318,18 @@ static inline int may_lookup(struct nameidata *nd)
|
||||||
return exec_permission(nd->inode, 0);
|
return exec_permission(nd->inode, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int handle_dots(struct nameidata *nd, int type)
|
||||||
|
{
|
||||||
|
if (type == LAST_DOTDOT) {
|
||||||
|
if (nd->flags & LOOKUP_RCU) {
|
||||||
|
if (follow_dotdot_rcu(nd))
|
||||||
|
return -ECHILD;
|
||||||
|
} else
|
||||||
|
follow_dotdot(nd);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Name resolution.
|
* Name resolution.
|
||||||
* This is the basic name resolution function, turning a pathname into
|
* This is the basic name resolution function, turning a pathname into
|
||||||
|
@ -1393,13 +1405,8 @@ static int link_path_walk(const char *name, struct nameidata *nd)
|
||||||
* parent relationships.
|
* parent relationships.
|
||||||
*/
|
*/
|
||||||
if (unlikely(type != LAST_NORM)) {
|
if (unlikely(type != LAST_NORM)) {
|
||||||
if (type == LAST_DOTDOT) {
|
if (handle_dots(nd, type))
|
||||||
if (nd->flags & LOOKUP_RCU) {
|
return -ECHILD;
|
||||||
if (follow_dotdot_rcu(nd))
|
|
||||||
return -ECHILD;
|
|
||||||
} else
|
|
||||||
follow_dotdot(nd);
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1434,13 +1441,8 @@ last_component:
|
||||||
if (lookup_flags & LOOKUP_PARENT)
|
if (lookup_flags & LOOKUP_PARENT)
|
||||||
goto lookup_parent;
|
goto lookup_parent;
|
||||||
if (unlikely(type != LAST_NORM)) {
|
if (unlikely(type != LAST_NORM)) {
|
||||||
if (type == LAST_DOTDOT) {
|
if (handle_dots(nd, type))
|
||||||
if (nd->flags & LOOKUP_RCU) {
|
return -ECHILD;
|
||||||
if (follow_dotdot_rcu(nd))
|
|
||||||
return -ECHILD;
|
|
||||||
} else
|
|
||||||
follow_dotdot(nd);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
err = do_lookup(nd, &this, &next, &inode);
|
err = do_lookup(nd, &this, &next, &inode);
|
||||||
|
|
Loading…
Add table
Reference in a new issue