diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-11-16 16:12:14 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-11-16 16:12:14 -0500 |
commit | c13344958780b4046305ee6235d686c846535529 (patch) | |
tree | aed2958283867030aa9e9f742c3fb94c895b2d5c /fs/nfs | |
parent | 8d514bbf37eecf0a3e309284728637816a36764b (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>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/super.c | 23 |
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, | |||
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; |
2821 | out_put_mnt_ns: | ||
2822 | put_mnt_ns(ns_private); | ||
2823 | out_mntput: | ||
2824 | mntput(root_mnt); | ||
2825 | out_err: | ||
2826 | return ERR_PTR(ret); | ||
2827 | } | 2820 | } |
2828 | 2821 | ||
2829 | static struct dentry *nfs4_try_mount(int flags, const char *dev_name, | 2822 | static struct dentry *nfs4_try_mount(int flags, const char *dev_name, |