summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-03-04 20:22:06 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-14 14:15:25 +0100
commit9856fa1b281eccdc9f8d94d716e96818c675e78e (patch)
treea66b72a6b0c143a29684b177771248c0881733ff /fs/namei.c
parentkill out_dput: in link_path_walk() (diff)
downloadlinux-9856fa1b281eccdc9f8d94d716e96818c675e78e.tar.xz
linux-9856fa1b281eccdc9f8d94d716e96818c675e78e.zip
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>
Diffstat (limited to '')
-rw-r--r--fs/namei.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/fs/namei.c b/fs/namei.c
index fea36369dc87..d29f91e8ff3d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1318,6 +1318,18 @@ static inline int may_lookup(struct nameidata *nd)
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.
* 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.
*/
if (unlikely(type != LAST_NORM)) {
- if (type == LAST_DOTDOT) {
- if (nd->flags & LOOKUP_RCU) {
- if (follow_dotdot_rcu(nd))
- return -ECHILD;
- } else
- follow_dotdot(nd);
- }
+ if (handle_dots(nd, type))
+ return -ECHILD;
continue;
}
@@ -1434,13 +1441,8 @@ last_component:
if (lookup_flags & LOOKUP_PARENT)
goto lookup_parent;
if (unlikely(type != LAST_NORM)) {
- if (type == LAST_DOTDOT) {
- if (nd->flags & LOOKUP_RCU) {
- if (follow_dotdot_rcu(nd))
- return -ECHILD;
- } else
- follow_dotdot(nd);
- }
+ if (handle_dots(nd, type))
+ return -ECHILD;
return 0;
}
err = do_lookup(nd, &this, &next, &inode);