[PATCH] namei fixes (14/19)
authorAl Viro <viro@www.linux.org.uk>
Mon, 6 Jun 2005 20:36:10 +0000 (13:36 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 6 Jun 2005 21:42:26 +0000 (14:42 -0700)
shifted conditional mntput() into do_follow_link() - all callers were doing
the same thing.

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>
fs/namei.c

index 5153f57ee6b382c12f6bc3161a97fd35530bbd4b..411bb3243c36fab5f302e0d055466149e4a55fa5 100644 (file)
@@ -543,11 +543,15 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
        current->link_count++;
        current->total_link_count++;
        nd->depth++;
+       if (path->mnt != nd->mnt)
+               mntput(nd->mnt);
        err = __do_follow_link(path, nd);
        current->link_count--;
        nd->depth--;
        return err;
 loop:
+       if (path->mnt != nd->mnt)
+               mntput(nd->mnt);
        dput(path->dentry);
        path_release(nd);
        return err;
@@ -801,8 +805,6 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
                        goto out_dput;
 
                if (inode->i_op->follow_link) {
-                       if (nd->mnt != next.mnt)
-                               mntput(nd->mnt);
                        err = do_follow_link(&next, nd);
                        if (err)
                                goto return_err;
@@ -856,8 +858,6 @@ last_component:
                inode = next.dentry->d_inode;
                if ((lookup_flags & LOOKUP_FOLLOW)
                    && inode && inode->i_op && inode->i_op->follow_link) {
-                       if (next.mnt != nd->mnt)
-                               mntput(nd->mnt);
                        err = do_follow_link(&next, nd);
                        if (err)
                                goto return_err;