Commit 443ed254c32ae9abf2f984038f656f3283aff759
1 parent
4aa32895c3
Exists in
master
and in
20 other branches
... and fold the renamed __vfs_follow_link() into its only caller
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 14 additions and 24 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -660,29 +660,6 @@ |
660 | 660 | } |
661 | 661 | } |
662 | 662 | |
663 | -static __always_inline int __follow_link(struct nameidata *nd, const char *link) | |
664 | -{ | |
665 | - int ret; | |
666 | - | |
667 | - if (IS_ERR(link)) | |
668 | - goto fail; | |
669 | - | |
670 | - if (*link == '/') { | |
671 | - set_root(nd); | |
672 | - path_put(&nd->path); | |
673 | - nd->path = nd->root; | |
674 | - path_get(&nd->root); | |
675 | - nd->flags |= LOOKUP_JUMPED; | |
676 | - } | |
677 | - nd->inode = nd->path.dentry->d_inode; | |
678 | - | |
679 | - ret = link_path_walk(link, nd); | |
680 | - return ret; | |
681 | -fail: | |
682 | - path_put(&nd->path); | |
683 | - return PTR_ERR(link); | |
684 | -} | |
685 | - | |
686 | 663 | static void path_put_conditional(struct path *path, struct nameidata *nd) |
687 | 664 | { |
688 | 665 | dput(path->dentry); |
... | ... | @@ -874,7 +851,20 @@ |
874 | 851 | error = 0; |
875 | 852 | s = nd_get_link(nd); |
876 | 853 | if (s) { |
877 | - error = __follow_link(nd, s); | |
854 | + if (unlikely(IS_ERR(s))) { | |
855 | + path_put(&nd->path); | |
856 | + put_link(nd, link, *p); | |
857 | + return PTR_ERR(s); | |
858 | + } | |
859 | + if (*s == '/') { | |
860 | + set_root(nd); | |
861 | + path_put(&nd->path); | |
862 | + nd->path = nd->root; | |
863 | + path_get(&nd->root); | |
864 | + nd->flags |= LOOKUP_JUMPED; | |
865 | + } | |
866 | + nd->inode = nd->path.dentry->d_inode; | |
867 | + error = link_path_walk(s, nd); | |
878 | 868 | if (unlikely(error)) |
879 | 869 | put_link(nd, link, *p); |
880 | 870 | } |