diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-04 07:59:30 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-10 22:20:10 -0400 |
commit | f0a9ba7021ce286120b69926a17ba55c11707fae (patch) | |
tree | 3adeaee38e2c3dd6b811e7a74547c0103f0e59fa /fs/namei.c | |
parent | 70291aecc6aa228c1b3bb36a5f3efdb0af636042 (diff) |
lift terminate_walk() into callers of walk_component()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/namei.c b/fs/namei.c index 25cd93599ada..d99eaacab2a7 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1587,20 +1587,16 @@ static int walk_component(struct nameidata *nd, int follow) | |||
1587 | * to be able to know about the current root directory and | 1587 | * to be able to know about the current root directory and |
1588 | * parent relationships. | 1588 | * parent relationships. |
1589 | */ | 1589 | */ |
1590 | if (unlikely(nd->last_type != LAST_NORM)) { | 1590 | if (unlikely(nd->last_type != LAST_NORM)) |
1591 | err = handle_dots(nd, nd->last_type); | 1591 | return handle_dots(nd, nd->last_type); |
1592 | if (err) | ||
1593 | goto out_err; | ||
1594 | return 0; | ||
1595 | } | ||
1596 | err = lookup_fast(nd, &path, &inode); | 1592 | err = lookup_fast(nd, &path, &inode); |
1597 | if (unlikely(err)) { | 1593 | if (unlikely(err)) { |
1598 | if (err < 0) | 1594 | if (err < 0) |
1599 | goto out_err; | 1595 | return err; |
1600 | 1596 | ||
1601 | err = lookup_slow(nd, &path); | 1597 | err = lookup_slow(nd, &path); |
1602 | if (err < 0) | 1598 | if (err < 0) |
1603 | goto out_err; | 1599 | return err; |
1604 | 1600 | ||
1605 | inode = path.dentry->d_inode; | 1601 | inode = path.dentry->d_inode; |
1606 | err = -ENOENT; | 1602 | err = -ENOENT; |
@@ -1612,8 +1608,7 @@ static int walk_component(struct nameidata *nd, int follow) | |||
1612 | if (nd->flags & LOOKUP_RCU) { | 1608 | if (nd->flags & LOOKUP_RCU) { |
1613 | if (unlikely(nd->path.mnt != path.mnt || | 1609 | if (unlikely(nd->path.mnt != path.mnt || |
1614 | unlazy_walk(nd, path.dentry))) { | 1610 | unlazy_walk(nd, path.dentry))) { |
1615 | err = -ECHILD; | 1611 | return -ECHILD; |
1616 | goto out_err; | ||
1617 | } | 1612 | } |
1618 | } | 1613 | } |
1619 | BUG_ON(inode != path.dentry->d_inode); | 1614 | BUG_ON(inode != path.dentry->d_inode); |
@@ -1626,8 +1621,6 @@ static int walk_component(struct nameidata *nd, int follow) | |||
1626 | 1621 | ||
1627 | out_path_put: | 1622 | out_path_put: |
1628 | path_to_nameidata(&path, nd); | 1623 | path_to_nameidata(&path, nd); |
1629 | out_err: | ||
1630 | terminate_walk(nd); | ||
1631 | return err; | 1624 | return err; |
1632 | } | 1625 | } |
1633 | 1626 | ||
@@ -1819,7 +1812,7 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1819 | err = walk_component(nd, LOOKUP_FOLLOW); | 1812 | err = walk_component(nd, LOOKUP_FOLLOW); |
1820 | Walked: | 1813 | Walked: |
1821 | if (err < 0) | 1814 | if (err < 0) |
1822 | goto Err; | 1815 | break; |
1823 | 1816 | ||
1824 | if (err) { | 1817 | if (err) { |
1825 | const char *s; | 1818 | const char *s; |
@@ -2020,11 +2013,15 @@ static int trailing_symlink(struct nameidata *nd) | |||
2020 | 2013 | ||
2021 | static inline int lookup_last(struct nameidata *nd) | 2014 | static inline int lookup_last(struct nameidata *nd) |
2022 | { | 2015 | { |
2016 | int err; | ||
2023 | if (nd->last_type == LAST_NORM && nd->last.name[nd->last.len]) | 2017 | if (nd->last_type == LAST_NORM && nd->last.name[nd->last.len]) |
2024 | nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; | 2018 | nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; |
2025 | 2019 | ||
2026 | nd->flags &= ~LOOKUP_PARENT; | 2020 | nd->flags &= ~LOOKUP_PARENT; |
2027 | return walk_component(nd, nd->flags & LOOKUP_FOLLOW); | 2021 | err = walk_component(nd, nd->flags & LOOKUP_FOLLOW); |
2022 | if (err < 0) | ||
2023 | terminate_walk(nd); | ||
2024 | return err; | ||
2028 | } | 2025 | } |
2029 | 2026 | ||
2030 | /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ | 2027 | /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ |