aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/super.c96
1 files changed, 46 insertions, 50 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 3600ec700d58..0a42e8f4adcb 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -260,8 +260,8 @@ static int nfs_statfs(struct dentry *, struct kstatfs *);
260static int nfs_show_options(struct seq_file *, struct vfsmount *); 260static int nfs_show_options(struct seq_file *, struct vfsmount *);
261static int nfs_show_stats(struct seq_file *, struct vfsmount *); 261static int nfs_show_stats(struct seq_file *, struct vfsmount *);
262static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); 262static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *);
263static int nfs_xdev_get_sb(struct file_system_type *fs_type, 263static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type,
264 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 264 int flags, const char *dev_name, void *raw_data);
265static void nfs_put_super(struct super_block *); 265static void nfs_put_super(struct super_block *);
266static void nfs_kill_super(struct super_block *); 266static void nfs_kill_super(struct super_block *);
267static int nfs_remount(struct super_block *sb, int *flags, char *raw_data); 267static int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
@@ -277,7 +277,7 @@ static struct file_system_type nfs_fs_type = {
277struct file_system_type nfs_xdev_fs_type = { 277struct file_system_type nfs_xdev_fs_type = {
278 .owner = THIS_MODULE, 278 .owner = THIS_MODULE,
279 .name = "nfs", 279 .name = "nfs",
280 .get_sb = nfs_xdev_get_sb, 280 .mount = nfs_xdev_mount,
281 .kill_sb = nfs_kill_super, 281 .kill_sb = nfs_kill_super,
282 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 282 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
283}; 283};
@@ -302,14 +302,14 @@ static int nfs4_try_mount(int flags, const char *dev_name,
302 struct nfs_parsed_mount_data *data, struct vfsmount *mnt); 302 struct nfs_parsed_mount_data *data, struct vfsmount *mnt);
303static int nfs4_get_sb(struct file_system_type *fs_type, 303static int nfs4_get_sb(struct file_system_type *fs_type,
304 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 304 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
305static int nfs4_remote_get_sb(struct file_system_type *fs_type, 305static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type,
306 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 306 int flags, const char *dev_name, void *raw_data);
307static int nfs4_xdev_get_sb(struct file_system_type *fs_type, 307static struct dentry *nfs4_xdev_mount(struct file_system_type *fs_type,
308 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 308 int flags, const char *dev_name, void *raw_data);
309static int nfs4_referral_get_sb(struct file_system_type *fs_type, 309static int nfs4_referral_get_sb(struct file_system_type *fs_type,
310 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 310 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
311static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, 311static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type,
312 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); 312 int flags, const char *dev_name, void *raw_data);
313static void nfs4_kill_super(struct super_block *sb); 313static void nfs4_kill_super(struct super_block *sb);
314 314
315static struct file_system_type nfs4_fs_type = { 315static struct file_system_type nfs4_fs_type = {
@@ -323,7 +323,7 @@ static struct file_system_type nfs4_fs_type = {
323static struct file_system_type nfs4_remote_fs_type = { 323static struct file_system_type nfs4_remote_fs_type = {
324 .owner = THIS_MODULE, 324 .owner = THIS_MODULE,
325 .name = "nfs4", 325 .name = "nfs4",
326 .get_sb = nfs4_remote_get_sb, 326 .mount = nfs4_remote_mount,
327 .kill_sb = nfs4_kill_super, 327 .kill_sb = nfs4_kill_super,
328 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 328 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
329}; 329};
@@ -331,7 +331,7 @@ static struct file_system_type nfs4_remote_fs_type = {
331struct file_system_type nfs4_xdev_fs_type = { 331struct file_system_type nfs4_xdev_fs_type = {
332 .owner = THIS_MODULE, 332 .owner = THIS_MODULE,
333 .name = "nfs4", 333 .name = "nfs4",
334 .get_sb = nfs4_xdev_get_sb, 334 .mount = nfs4_xdev_mount,
335 .kill_sb = nfs4_kill_super, 335 .kill_sb = nfs4_kill_super,
336 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 336 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
337}; 337};
@@ -339,7 +339,7 @@ struct file_system_type nfs4_xdev_fs_type = {
339static struct file_system_type nfs4_remote_referral_fs_type = { 339static struct file_system_type nfs4_remote_referral_fs_type = {
340 .owner = THIS_MODULE, 340 .owner = THIS_MODULE,
341 .name = "nfs4", 341 .name = "nfs4",
342 .get_sb = nfs4_remote_referral_get_sb, 342 .mount = nfs4_remote_referral_mount,
343 .kill_sb = nfs4_kill_super, 343 .kill_sb = nfs4_kill_super,
344 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 344 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
345}; 345};
@@ -2397,9 +2397,9 @@ static void nfs_kill_super(struct super_block *s)
2397/* 2397/*
2398 * Clone an NFS2/3 server record on xdev traversal (FSID-change) 2398 * Clone an NFS2/3 server record on xdev traversal (FSID-change)
2399 */ 2399 */
2400static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, 2400static struct dentry *
2401 const char *dev_name, void *raw_data, 2401nfs_xdev_mount(struct file_system_type *fs_type, int flags,
2402 struct vfsmount *mnt) 2402 const char *dev_name, void *raw_data)
2403{ 2403{
2404 struct nfs_clone_mount *data = raw_data; 2404 struct nfs_clone_mount *data = raw_data;
2405 struct super_block *s; 2405 struct super_block *s;
@@ -2411,7 +2411,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
2411 }; 2411 };
2412 int error; 2412 int error;
2413 2413
2414 dprintk("--> nfs_xdev_get_sb()\n"); 2414 dprintk("--> nfs_xdev_mount()\n");
2415 2415
2416 /* create a new volume representation */ 2416 /* create a new volume representation */
2417 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); 2417 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr);
@@ -2458,28 +2458,26 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
2458 } 2458 }
2459 2459
2460 s->s_flags |= MS_ACTIVE; 2460 s->s_flags |= MS_ACTIVE;
2461 mnt->mnt_sb = s;
2462 mnt->mnt_root = mntroot;
2463 2461
2464 /* clone any lsm security options from the parent to the new sb */ 2462 /* clone any lsm security options from the parent to the new sb */
2465 security_sb_clone_mnt_opts(data->sb, s); 2463 security_sb_clone_mnt_opts(data->sb, s);
2466 2464
2467 dprintk("<-- nfs_xdev_get_sb() = 0\n"); 2465 dprintk("<-- nfs_xdev_mount() = 0\n");
2468 return 0; 2466 return mntroot;
2469 2467
2470out_err_nosb: 2468out_err_nosb:
2471 nfs_free_server(server); 2469 nfs_free_server(server);
2472out_err_noserver: 2470out_err_noserver:
2473 dprintk("<-- nfs_xdev_get_sb() = %d [error]\n", error); 2471 dprintk("<-- nfs_xdev_mount() = %d [error]\n", error);
2474 return error; 2472 return ERR_PTR(error);
2475 2473
2476error_splat_super: 2474error_splat_super:
2477 if (server && !s->s_root) 2475 if (server && !s->s_root)
2478 bdi_unregister(&server->backing_dev_info); 2476 bdi_unregister(&server->backing_dev_info);
2479error_splat_bdi: 2477error_splat_bdi:
2480 deactivate_locked_super(s); 2478 deactivate_locked_super(s);
2481 dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); 2479 dprintk("<-- nfs_xdev_mount() = %d [splat]\n", error);
2482 return error; 2480 return ERR_PTR(error);
2483} 2481}
2484 2482
2485#ifdef CONFIG_NFS_V4 2483#ifdef CONFIG_NFS_V4
@@ -2649,8 +2647,9 @@ out_no_address:
2649/* 2647/*
2650 * Get the superblock for the NFS4 root partition 2648 * Get the superblock for the NFS4 root partition
2651 */ 2649 */
2652static int nfs4_remote_get_sb(struct file_system_type *fs_type, 2650static struct dentry *
2653 int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) 2651nfs4_remote_mount(struct file_system_type *fs_type, int flags,
2652 const char *dev_name, void *raw_data)
2654{ 2653{
2655 struct nfs_parsed_mount_data *data = raw_data; 2654 struct nfs_parsed_mount_data *data = raw_data;
2656 struct super_block *s; 2655 struct super_block *s;
@@ -2714,15 +2713,16 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
2714 goto error_splat_root; 2713 goto error_splat_root;
2715 2714
2716 s->s_flags |= MS_ACTIVE; 2715 s->s_flags |= MS_ACTIVE;
2717 mnt->mnt_sb = s; 2716
2718 mnt->mnt_root = mntroot; 2717 security_free_mnt_opts(&data->lsm_opts);
2719 error = 0; 2718 nfs_free_fhandle(mntfh);
2719 return mntroot;
2720 2720
2721out: 2721out:
2722 security_free_mnt_opts(&data->lsm_opts); 2722 security_free_mnt_opts(&data->lsm_opts);
2723out_free_fh: 2723out_free_fh:
2724 nfs_free_fhandle(mntfh); 2724 nfs_free_fhandle(mntfh);
2725 return error; 2725 return ERR_PTR(error);
2726 2726
2727out_free: 2727out_free:
2728 nfs_free_server(server); 2728 nfs_free_server(server);
@@ -2968,9 +2968,9 @@ static void nfs4_kill_super(struct super_block *sb)
2968/* 2968/*
2969 * Clone an NFS4 server record on xdev traversal (FSID-change) 2969 * Clone an NFS4 server record on xdev traversal (FSID-change)
2970 */ 2970 */
2971static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, 2971static struct dentry *
2972 const char *dev_name, void *raw_data, 2972nfs4_xdev_mount(struct file_system_type *fs_type, int flags,
2973 struct vfsmount *mnt) 2973 const char *dev_name, void *raw_data)
2974{ 2974{
2975 struct nfs_clone_mount *data = raw_data; 2975 struct nfs_clone_mount *data = raw_data;
2976 struct super_block *s; 2976 struct super_block *s;
@@ -2982,7 +2982,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
2982 }; 2982 };
2983 int error; 2983 int error;
2984 2984
2985 dprintk("--> nfs4_xdev_get_sb()\n"); 2985 dprintk("--> nfs4_xdev_mount()\n");
2986 2986
2987 /* create a new volume representation */ 2987 /* create a new volume representation */
2988 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); 2988 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr);
@@ -3029,32 +3029,30 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
3029 } 3029 }
3030 3030
3031 s->s_flags |= MS_ACTIVE; 3031 s->s_flags |= MS_ACTIVE;
3032 mnt->mnt_sb = s;
3033 mnt->mnt_root = mntroot;
3034 3032
3035 security_sb_clone_mnt_opts(data->sb, s); 3033 security_sb_clone_mnt_opts(data->sb, s);
3036 3034
3037 dprintk("<-- nfs4_xdev_get_sb() = 0\n"); 3035 dprintk("<-- nfs4_xdev_mount() = 0\n");
3038 return 0; 3036 return mntroot;
3039 3037
3040out_err_nosb: 3038out_err_nosb:
3041 nfs_free_server(server); 3039 nfs_free_server(server);
3042out_err_noserver: 3040out_err_noserver:
3043 dprintk("<-- nfs4_xdev_get_sb() = %d [error]\n", error); 3041 dprintk("<-- nfs4_xdev_mount() = %d [error]\n", error);
3044 return error; 3042 return ERR_PTR(error);
3045 3043
3046error_splat_super: 3044error_splat_super:
3047 if (server && !s->s_root) 3045 if (server && !s->s_root)
3048 bdi_unregister(&server->backing_dev_info); 3046 bdi_unregister(&server->backing_dev_info);
3049error_splat_bdi: 3047error_splat_bdi:
3050 deactivate_locked_super(s); 3048 deactivate_locked_super(s);
3051 dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); 3049 dprintk("<-- nfs4_xdev_mount() = %d [splat]\n", error);
3052 return error; 3050 return ERR_PTR(error);
3053} 3051}
3054 3052
3055static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, 3053static struct dentry *
3056 int flags, const char *dev_name, void *raw_data, 3054nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags,
3057 struct vfsmount *mnt) 3055 const char *dev_name, void *raw_data)
3058{ 3056{
3059 struct nfs_clone_mount *data = raw_data; 3057 struct nfs_clone_mount *data = raw_data;
3060 struct super_block *s; 3058 struct super_block *s;
@@ -3118,14 +3116,12 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
3118 } 3116 }
3119 3117
3120 s->s_flags |= MS_ACTIVE; 3118 s->s_flags |= MS_ACTIVE;
3121 mnt->mnt_sb = s;
3122 mnt->mnt_root = mntroot;
3123 3119
3124 security_sb_clone_mnt_opts(data->sb, s); 3120 security_sb_clone_mnt_opts(data->sb, s);
3125 3121
3126 nfs_free_fhandle(mntfh); 3122 nfs_free_fhandle(mntfh);
3127 dprintk("<-- nfs4_referral_get_sb() = 0\n"); 3123 dprintk("<-- nfs4_referral_get_sb() = 0\n");
3128 return 0; 3124 return mntroot;
3129 3125
3130out_err_nosb: 3126out_err_nosb:
3131 nfs_free_server(server); 3127 nfs_free_server(server);
@@ -3133,7 +3129,7 @@ out_err_noserver:
3133 nfs_free_fhandle(mntfh); 3129 nfs_free_fhandle(mntfh);
3134out_err_nofh: 3130out_err_nofh:
3135 dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error); 3131 dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error);
3136 return error; 3132 return ERR_PTR(error);
3137 3133
3138error_splat_super: 3134error_splat_super:
3139 if (server && !s->s_root) 3135 if (server && !s->s_root)
@@ -3142,7 +3138,7 @@ error_splat_bdi:
3142 deactivate_locked_super(s); 3138 deactivate_locked_super(s);
3143 nfs_free_fhandle(mntfh); 3139 nfs_free_fhandle(mntfh);
3144 dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); 3140 dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error);
3145 return error; 3141 return ERR_PTR(error);
3146} 3142}
3147 3143
3148/* 3144/*