aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@www.linux.org.uk>2005-06-06 16:36:07 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-06 17:42:26 -0400
commit2f12dbfbb6286c725c283a169f8f05e89a86848b (patch)
tree5d0a725f71a041955d49146c4837a0df19a015dc
parente13b210f6f7bdc44dfee0a9bbd633a32db0d6333 (diff)
[PATCH] namei fixes (11/19)
shifted conditional mntput() calls in __link_path_walk() downstream. Obviously equivalent transformation. Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/namei.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 935b08d8dcd8..907a3f2b4c9c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -791,8 +791,6 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
791 break; 791 break;
792 /* Check mountpoints.. */ 792 /* Check mountpoints.. */
793 __follow_mount(&next); 793 __follow_mount(&next);
794 if (nd->mnt != next.mnt)
795 mntput(nd->mnt);
796 794
797 err = -ENOENT; 795 err = -ENOENT;
798 inode = next.dentry->d_inode; 796 inode = next.dentry->d_inode;
@@ -803,6 +801,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
803 goto out_dput; 801 goto out_dput;
804 802
805 if (inode->i_op->follow_link) { 803 if (inode->i_op->follow_link) {
804 if (nd->mnt != next.mnt)
805 mntput(nd->mnt);
806 err = do_follow_link(&next, nd); 806 err = do_follow_link(&next, nd);
807 if (err) 807 if (err)
808 goto return_err; 808 goto return_err;
@@ -815,6 +815,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
815 break; 815 break;
816 } else { 816 } else {
817 dput(nd->dentry); 817 dput(nd->dentry);
818 if (nd->mnt != next.mnt)
819 mntput(nd->mnt);
818 nd->mnt = next.mnt; 820 nd->mnt = next.mnt;
819 nd->dentry = next.dentry; 821 nd->dentry = next.dentry;
820 } 822 }
@@ -851,17 +853,19 @@ last_component:
851 if (err) 853 if (err)
852 break; 854 break;
853 __follow_mount(&next); 855 __follow_mount(&next);
854 if (nd->mnt != next.mnt)
855 mntput(nd->mnt);
856 inode = next.dentry->d_inode; 856 inode = next.dentry->d_inode;
857 if ((lookup_flags & LOOKUP_FOLLOW) 857 if ((lookup_flags & LOOKUP_FOLLOW)
858 && inode && inode->i_op && inode->i_op->follow_link) { 858 && inode && inode->i_op && inode->i_op->follow_link) {
859 if (next.mnt != nd->mnt)
860 mntput(nd->mnt);
859 err = do_follow_link(&next, nd); 861 err = do_follow_link(&next, nd);
860 if (err) 862 if (err)
861 goto return_err; 863 goto return_err;
862 inode = nd->dentry->d_inode; 864 inode = nd->dentry->d_inode;
863 } else { 865 } else {
864 dput(nd->dentry); 866 dput(nd->dentry);
867 if (nd->mnt != next.mnt)
868 mntput(nd->mnt);
865 nd->mnt = next.mnt; 869 nd->mnt = next.mnt;
866 nd->dentry = next.dentry; 870 nd->dentry = next.dentry;
867 } 871 }
@@ -901,6 +905,8 @@ return_base:
901 return 0; 905 return 0;
902out_dput: 906out_dput:
903 dput(next.dentry); 907 dput(next.dentry);
908 if (nd->mnt != next.mnt)
909 mntput(nd->mnt);
904 break; 910 break;
905 } 911 }
906 path_release(nd); 912 path_release(nd);