aboutsummaryrefslogtreecommitdiffstats
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
parent8d514bbf37eecf0a3e309284728637816a36764b (diff)
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>
-rw-r--r--fs/btrfs/super.c4
-rw-r--r--fs/namespace.c2
-rw-r--r--fs/nfs/super.c23
3 files changed, 11 insertions, 18 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 969a7747e889..cfbedd7755b0 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -843,10 +843,8 @@ static struct dentry *mount_subvol(const char *subvol_name, int flags,
843 return ERR_CAST(mnt); 843 return ERR_CAST(mnt);
844 844
845 ns_private = create_mnt_ns(mnt); 845 ns_private = create_mnt_ns(mnt);
846 if (IS_ERR(ns_private)) { 846 if (IS_ERR(ns_private))
847 mntput(mnt);
848 return ERR_CAST(ns_private); 847 return ERR_CAST(ns_private);
849 }
850 848
851 /* 849 /*
852 * This will trigger the automount of the subvol so we can just 850 * This will trigger the automount of the subvol so we can just
diff --git a/fs/namespace.c b/fs/namespace.c
index e5e1c7d1839b..aea4b7689840 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2483,6 +2483,8 @@ struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt)
2483 __mnt_make_longterm(mnt); 2483 __mnt_make_longterm(mnt);
2484 new_ns->root = mnt; 2484 new_ns->root = mnt;
2485 list_add(&new_ns->list, &new_ns->root->mnt_list); 2485 list_add(&new_ns->list, &new_ns->root->mnt_list);
2486 } else {
2487 mntput(mnt);
2486 } 2488 }
2487 return new_ns; 2489 return new_ns;
2488} 2490}
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,
2794 int ret; 2794 int ret;
2795 2795
2796 ns_private = create_mnt_ns(root_mnt); 2796 ns_private = create_mnt_ns(root_mnt);
2797 ret = PTR_ERR(ns_private);
2798 if (IS_ERR(ns_private)) 2797 if (IS_ERR(ns_private))
2799 goto out_mntput; 2798 return ERR_CAST(ns_private);
2800 2799
2801 ret = nfs_referral_loop_protect(); 2800 ret = nfs_referral_loop_protect();
2802 if (ret != 0) 2801 if (ret == 0) {
2803 goto out_put_mnt_ns; 2802 ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt,
2804 2803 export_path, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT,
2805 ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt, 2804 &path);
2806 export_path, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path); 2805 nfs_referral_loop_unprotect();
2806 }
2807 2807
2808 nfs_referral_loop_unprotect();
2809 put_mnt_ns(ns_private); 2808 put_mnt_ns(ns_private);
2810 2809
2811 if (ret != 0) 2810 if (ret != 0)
2812 goto out_err; 2811 return ERR_PTR(ret);
2813 2812
2814 s = path.mnt->mnt_sb; 2813 s = path.mnt->mnt_sb;
2815 atomic_inc(&s->s_active); 2814 atomic_inc(&s->s_active);
@@ -2818,12 +2817,6 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt,
2818 path_put(&path); 2817 path_put(&path);
2819 down_write(&s->s_umount); 2818 down_write(&s->s_umount);
2820 return dentry; 2819 return dentry;
2821out_put_mnt_ns:
2822 put_mnt_ns(ns_private);
2823out_mntput:
2824 mntput(root_mnt);
2825out_err:
2826 return ERR_PTR(ret);
2827} 2820}
2828 2821
2829static struct dentry *nfs4_try_mount(int flags, const char *dev_name, 2822static struct dentry *nfs4_try_mount(int flags, const char *dev_name,