summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@www.linux.org.uk>2005-06-07 00:36:07 +0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-07 01:42:26 +0400
commit2f12dbfbb6286c725c283a169f8f05e89a86848b (patch)
tree5d0a725f71a041955d49146c4837a0df19a015dc /fs
parente13b210f6f7bdc44dfee0a9bbd633a32db0d6333 (diff)
downloadlinux-2f12dbfbb6286c725c283a169f8f05e89a86848b.tar.xz
[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>
Diffstat (limited to 'fs')
-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)
break;
/* Check mountpoints.. */
__follow_mount(&next);
- if (nd->mnt != next.mnt)
- mntput(nd->mnt);
err = -ENOENT;
inode = next.dentry->d_inode;
@@ -803,6 +801,8 @@ 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;
@@ -815,6 +815,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
break;
} else {
dput(nd->dentry);
+ if (nd->mnt != next.mnt)
+ mntput(nd->mnt);
nd->mnt = next.mnt;
nd->dentry = next.dentry;
}
@@ -851,17 +853,19 @@ last_component:
if (err)
break;
__follow_mount(&next);
- if (nd->mnt != next.mnt)
- mntput(nd->mnt);
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;
inode = nd->dentry->d_inode;
} else {
dput(nd->dentry);
+ if (nd->mnt != next.mnt)
+ mntput(nd->mnt);
nd->mnt = next.mnt;
nd->dentry = next.dentry;
}
@@ -901,6 +905,8 @@ return_base:
return 0;
out_dput:
dput(next.dentry);
+ if (nd->mnt != next.mnt)
+ mntput(nd->mnt);
break;
}
path_release(nd);