summaryrefslogtreecommitdiffstats
path: root/fs/nfs/super.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-16 16:12:14 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2011-11-16 16:12:14 -0500
commitc13344958780b4046305ee6235d686c846535529 (patch)
treeaed2958283867030aa9e9f742c3fb94c895b2d5c /fs/nfs/super.c
parent8d514bbf37eecf0a3e309284728637816a36764b (diff)
downloadlinux-c13344958780b4046305ee6235d686c846535529.tar.bz2
switch create_mnt_ns() to saner calling conventions, fix double mntput() in nfs
Life is much saner if create_mnt_ns(mnt) drops mnt in case of error... Switch it to such calling conventions, switch callers, fix double mntput() in fs/nfs/super.c one. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r--fs/nfs/super.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 480b3b6bf71e..46d69f38fd55 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2794,22 +2794,21 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt,
int ret;
ns_private = create_mnt_ns(root_mnt);
- ret = PTR_ERR(ns_private);
if (IS_ERR(ns_private))
- goto out_mntput;
+ return ERR_CAST(ns_private);
ret = nfs_referral_loop_protect();
- if (ret != 0)
- goto out_put_mnt_ns;
-
- ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt,
- export_path, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path);
+ if (ret == 0) {
+ ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt,
+ export_path, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT,
+ &path);
+ nfs_referral_loop_unprotect();
+ }
- nfs_referral_loop_unprotect();
put_mnt_ns(ns_private);
if (ret != 0)
- goto out_err;
+ return ERR_PTR(ret);
s = path.mnt->mnt_sb;
atomic_inc(&s->s_active);
@@ -2818,12 +2817,6 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt,
path_put(&path);
down_write(&s->s_umount);
return dentry;
-out_put_mnt_ns:
- put_mnt_ns(ns_private);
-out_mntput:
- mntput(root_mnt);
-out_err:
- return ERR_PTR(ret);
}
static struct dentry *nfs4_try_mount(int flags, const char *dev_name,