summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@www.linux.org.uk>2005-06-06 13:36:03 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-06 14:42:25 -0700
commitcd4e91d3bca8d5527289f5984cf32e9fe6fb8293 (patch)
tree5059fedcd7fb8e8893b8d204e18b5813dfae3449 /fs
parent839d9f93c9f1623fb37234d464d739617879d97e (diff)
downloadblackbird-op-linux-cd4e91d3bca8d5527289f5984cf32e9fe6fb8293.tar.gz
blackbird-op-linux-cd4e91d3bca8d5527289f5984cf32e9fe6fb8293.zip
[PATCH] namei fixes (7/19)
The first argument of __do_follow_link() switched to struct path * (__do_follow_link(path->dentry, ...) -> __do_follow_link(path, ...)). All callers have the same calls of mntget() right before and dput()/mntput() right after __do_follow_link(); these calls have been moved inside. Obviously 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.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 519900d83bcb..18ea0606145e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -498,12 +498,15 @@ struct path {
struct dentry *dentry;
};
-static inline int __do_follow_link(struct dentry *dentry, struct nameidata *nd)
+static inline int __do_follow_link(struct path *path, struct nameidata *nd)
{
int error;
+ struct dentry *dentry = path->dentry;
touch_atime(nd->mnt, dentry);
nd_set_link(nd, NULL);
+
+ mntget(path->mnt);
error = dentry->d_inode->i_op->follow_link(dentry, nd);
if (!error) {
char *s = nd_get_link(nd);
@@ -512,6 +515,8 @@ static inline int __do_follow_link(struct dentry *dentry, struct nameidata *nd)
if (dentry->d_inode->i_op->put_link)
dentry->d_inode->i_op->put_link(dentry, nd);
}
+ dput(dentry);
+ mntput(path->mnt);
return error;
}
@@ -538,10 +543,7 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
current->link_count++;
current->total_link_count++;
nd->depth++;
- mntget(path->mnt);
- err = __do_follow_link(path->dentry, nd);
- dput(path->dentry);
- mntput(path->mnt);
+ err = __do_follow_link(path, nd);
current->link_count--;
nd->depth--;
return err;
@@ -1523,10 +1525,7 @@ do_link:
error = security_inode_follow_link(path.dentry, nd);
if (error)
goto exit_dput;
- mntget(path.mnt);
- error = __do_follow_link(path.dentry, nd);
- dput(path.dentry);
- mntput(path.mnt);
+ error = __do_follow_link(&path, nd);
path.mnt = nd->mnt;
if (error)
return error;
OpenPOWER on IntegriCloud