diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-04 14:22:06 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-14 09:15:25 -0400 |
commit | 9856fa1b281eccdc9f8d94d716e96818c675e78e (patch) | |
tree | a66b72a6b0c143a29684b177771248c0881733ff /fs | |
parent | 7bc055d1d524f209bf49d8b9cb220712dd7df4ed (diff) |
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 'fs')
-rw-r--r-- | fs/namei.c | 30 |
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) | |||
1318 | return exec_permission(nd->inode, 0); | 1318 | return exec_permission(nd->inode, 0); |
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | static inline int handle_dots(struct nameidata *nd, int type) | ||
1322 | { | ||
1323 | if (type == LAST_DOTDOT) { | ||
1324 | if (nd->flags & LOOKUP_RCU) { | ||
1325 | if (follow_dotdot_rcu(nd)) | ||
1326 | return -ECHILD; | ||
1327 | } else | ||
1328 | follow_dotdot(nd); | ||
1329 | } | ||
1330 | return 0; | ||
1331 | } | ||
1332 | |||
1321 | /* | 1333 | /* |
1322 | * Name resolution. | 1334 | * Name resolution. |
1323 | * This is the basic name resolution function, turning a pathname into | 1335 | * 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) | |||
1393 | * parent relationships. | 1405 | * parent relationships. |
1394 | */ | 1406 | */ |
1395 | if (unlikely(type != LAST_NORM)) { | 1407 | if (unlikely(type != LAST_NORM)) { |
1396 | if (type == LAST_DOTDOT) { | 1408 | if (handle_dots(nd, type)) |
1397 | if (nd->flags & LOOKUP_RCU) { | 1409 | return -ECHILD; |
1398 | if (follow_dotdot_rcu(nd)) | ||
1399 | return -ECHILD; | ||
1400 | } else | ||
1401 | follow_dotdot(nd); | ||
1402 | } | ||
1403 | continue; | 1410 | continue; |
1404 | } | 1411 | } |
1405 | 1412 | ||
@@ -1434,13 +1441,8 @@ last_component: | |||
1434 | if (lookup_flags & LOOKUP_PARENT) | 1441 | if (lookup_flags & LOOKUP_PARENT) |
1435 | goto lookup_parent; | 1442 | goto lookup_parent; |
1436 | if (unlikely(type != LAST_NORM)) { | 1443 | if (unlikely(type != LAST_NORM)) { |
1437 | if (type == LAST_DOTDOT) { | 1444 | if (handle_dots(nd, type)) |
1438 | if (nd->flags & LOOKUP_RCU) { | 1445 | return -ECHILD; |
1439 | if (follow_dotdot_rcu(nd)) | ||
1440 | return -ECHILD; | ||
1441 | } else | ||
1442 | follow_dotdot(nd); | ||
1443 | } | ||
1444 | return 0; | 1446 | return 0; |
1445 | } | 1447 | } |
1446 | err = do_lookup(nd, &this, &next, &inode); | 1448 | err = do_lookup(nd, &this, &next, &inode); |