summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@www.linux.org.uk>2005-06-06 20:36:08 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-06 21:42:26 (GMT)
commita15a3f6fc67d910f43098acec6e19d25a37d7cb9 (patch)
treef00e6a3f505f2e77568695f6f5e2bd4786fcc8ca /fs
parent2f12dbfbb6286c725c283a169f8f05e89a86848b (diff)
downloadlinux-a15a3f6fc67d910f43098acec6e19d25a37d7cb9.tar.xz
[PATCH] namei fixes (12/19)
In open_namei() we take mntput(nd->mnt);nd->mnt=path.mnt; out of the if (__follow_mount(...)), making it conditional on nd->mnt != path.mnt instead. Then we shift the result downstream. Equivalent transformations. 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.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 907a3f2..37fcf94 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1506,8 +1506,6 @@ do_last:
mntput(path.mnt);
goto exit;
}
- mntput(nd->mnt);
- nd->mnt = path.mnt;
}
error = -ENOENT;
if (!path.dentry->d_inode)
@@ -1517,6 +1515,9 @@ do_last:
dput(nd->dentry);
nd->dentry = path.dentry;
+ if (nd->mnt != path.mnt)
+ mntput(nd->mnt);
+ nd->mnt = path.mnt;
error = -EISDIR;
if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
goto exit;
@@ -1528,6 +1529,9 @@ ok:
exit_dput:
dput(path.dentry);
+ if (nd->mnt != path.mnt)
+ mntput(nd->mnt);
+ nd->mnt = path.mnt;
exit:
path_release(nd);
return error;
@@ -1550,6 +1554,9 @@ do_link:
error = security_inode_follow_link(path.dentry, nd);
if (error)
goto exit_dput;
+ if (nd->mnt != path.mnt)
+ mntput(nd->mnt);
+ nd->mnt = path.mnt;
error = __do_follow_link(&path, nd);
if (error)
return error;