diff options
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r-- | fs/nfs/super.c | 168 |
1 files changed, 117 insertions, 51 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index f4cbf0c306c6..0a42e8f4adcb 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -100,6 +100,7 @@ enum { | |||
100 | Opt_addr, Opt_mountaddr, Opt_clientaddr, | 100 | Opt_addr, Opt_mountaddr, Opt_clientaddr, |
101 | Opt_lookupcache, | 101 | Opt_lookupcache, |
102 | Opt_fscache_uniq, | 102 | Opt_fscache_uniq, |
103 | Opt_local_lock, | ||
103 | 104 | ||
104 | /* Special mount options */ | 105 | /* Special mount options */ |
105 | Opt_userspace, Opt_deprecated, Opt_sloppy, | 106 | Opt_userspace, Opt_deprecated, Opt_sloppy, |
@@ -171,6 +172,7 @@ static const match_table_t nfs_mount_option_tokens = { | |||
171 | 172 | ||
172 | { Opt_lookupcache, "lookupcache=%s" }, | 173 | { Opt_lookupcache, "lookupcache=%s" }, |
173 | { Opt_fscache_uniq, "fsc=%s" }, | 174 | { Opt_fscache_uniq, "fsc=%s" }, |
175 | { Opt_local_lock, "local_lock=%s" }, | ||
174 | 176 | ||
175 | { Opt_err, NULL } | 177 | { Opt_err, NULL } |
176 | }; | 178 | }; |
@@ -236,14 +238,30 @@ static match_table_t nfs_lookupcache_tokens = { | |||
236 | { Opt_lookupcache_err, NULL } | 238 | { Opt_lookupcache_err, NULL } |
237 | }; | 239 | }; |
238 | 240 | ||
241 | enum { | ||
242 | Opt_local_lock_all, Opt_local_lock_flock, Opt_local_lock_posix, | ||
243 | Opt_local_lock_none, | ||
244 | |||
245 | Opt_local_lock_err | ||
246 | }; | ||
247 | |||
248 | static match_table_t nfs_local_lock_tokens = { | ||
249 | { Opt_local_lock_all, "all" }, | ||
250 | { Opt_local_lock_flock, "flock" }, | ||
251 | { Opt_local_lock_posix, "posix" }, | ||
252 | { Opt_local_lock_none, "none" }, | ||
253 | |||
254 | { Opt_local_lock_err, NULL } | ||
255 | }; | ||
256 | |||
239 | 257 | ||
240 | static void nfs_umount_begin(struct super_block *); | 258 | static void nfs_umount_begin(struct super_block *); |
241 | static int nfs_statfs(struct dentry *, struct kstatfs *); | 259 | static int nfs_statfs(struct dentry *, struct kstatfs *); |
242 | static int nfs_show_options(struct seq_file *, struct vfsmount *); | 260 | static int nfs_show_options(struct seq_file *, struct vfsmount *); |
243 | static int nfs_show_stats(struct seq_file *, struct vfsmount *); | 261 | static int nfs_show_stats(struct seq_file *, struct vfsmount *); |
244 | static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); | 262 | static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); |
245 | static int nfs_xdev_get_sb(struct file_system_type *fs_type, | 263 | static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type, |
246 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); | 264 | int flags, const char *dev_name, void *raw_data); |
247 | static void nfs_put_super(struct super_block *); | 265 | static void nfs_put_super(struct super_block *); |
248 | static void nfs_kill_super(struct super_block *); | 266 | static void nfs_kill_super(struct super_block *); |
249 | static int nfs_remount(struct super_block *sb, int *flags, char *raw_data); | 267 | static int nfs_remount(struct super_block *sb, int *flags, char *raw_data); |
@@ -259,7 +277,7 @@ static struct file_system_type nfs_fs_type = { | |||
259 | struct file_system_type nfs_xdev_fs_type = { | 277 | struct file_system_type nfs_xdev_fs_type = { |
260 | .owner = THIS_MODULE, | 278 | .owner = THIS_MODULE, |
261 | .name = "nfs", | 279 | .name = "nfs", |
262 | .get_sb = nfs_xdev_get_sb, | 280 | .mount = nfs_xdev_mount, |
263 | .kill_sb = nfs_kill_super, | 281 | .kill_sb = nfs_kill_super, |
264 | .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, |
265 | }; | 283 | }; |
@@ -284,14 +302,14 @@ static int nfs4_try_mount(int flags, const char *dev_name, | |||
284 | struct nfs_parsed_mount_data *data, struct vfsmount *mnt); | 302 | struct nfs_parsed_mount_data *data, struct vfsmount *mnt); |
285 | static int nfs4_get_sb(struct file_system_type *fs_type, | 303 | static int nfs4_get_sb(struct file_system_type *fs_type, |
286 | 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); |
287 | static int nfs4_remote_get_sb(struct file_system_type *fs_type, | 305 | static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type, |
288 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); | 306 | int flags, const char *dev_name, void *raw_data); |
289 | static int nfs4_xdev_get_sb(struct file_system_type *fs_type, | 307 | static struct dentry *nfs4_xdev_mount(struct file_system_type *fs_type, |
290 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); | 308 | int flags, const char *dev_name, void *raw_data); |
291 | static int nfs4_referral_get_sb(struct file_system_type *fs_type, | 309 | static int nfs4_referral_get_sb(struct file_system_type *fs_type, |
292 | 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); |
293 | static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, | 311 | static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type, |
294 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); | 312 | int flags, const char *dev_name, void *raw_data); |
295 | static void nfs4_kill_super(struct super_block *sb); | 313 | static void nfs4_kill_super(struct super_block *sb); |
296 | 314 | ||
297 | static struct file_system_type nfs4_fs_type = { | 315 | static struct file_system_type nfs4_fs_type = { |
@@ -305,7 +323,7 @@ static struct file_system_type nfs4_fs_type = { | |||
305 | static struct file_system_type nfs4_remote_fs_type = { | 323 | static struct file_system_type nfs4_remote_fs_type = { |
306 | .owner = THIS_MODULE, | 324 | .owner = THIS_MODULE, |
307 | .name = "nfs4", | 325 | .name = "nfs4", |
308 | .get_sb = nfs4_remote_get_sb, | 326 | .mount = nfs4_remote_mount, |
309 | .kill_sb = nfs4_kill_super, | 327 | .kill_sb = nfs4_kill_super, |
310 | .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, |
311 | }; | 329 | }; |
@@ -313,7 +331,7 @@ static struct file_system_type nfs4_remote_fs_type = { | |||
313 | struct file_system_type nfs4_xdev_fs_type = { | 331 | struct file_system_type nfs4_xdev_fs_type = { |
314 | .owner = THIS_MODULE, | 332 | .owner = THIS_MODULE, |
315 | .name = "nfs4", | 333 | .name = "nfs4", |
316 | .get_sb = nfs4_xdev_get_sb, | 334 | .mount = nfs4_xdev_mount, |
317 | .kill_sb = nfs4_kill_super, | 335 | .kill_sb = nfs4_kill_super, |
318 | .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, |
319 | }; | 337 | }; |
@@ -321,7 +339,7 @@ struct file_system_type nfs4_xdev_fs_type = { | |||
321 | static struct file_system_type nfs4_remote_referral_fs_type = { | 339 | static struct file_system_type nfs4_remote_referral_fs_type = { |
322 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
323 | .name = "nfs4", | 341 | .name = "nfs4", |
324 | .get_sb = nfs4_remote_referral_get_sb, | 342 | .mount = nfs4_remote_referral_mount, |
325 | .kill_sb = nfs4_kill_super, | 343 | .kill_sb = nfs4_kill_super, |
326 | .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, |
327 | }; | 345 | }; |
@@ -622,6 +640,7 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss, | |||
622 | const struct proc_nfs_info *nfs_infop; | 640 | const struct proc_nfs_info *nfs_infop; |
623 | struct nfs_client *clp = nfss->nfs_client; | 641 | struct nfs_client *clp = nfss->nfs_client; |
624 | u32 version = clp->rpc_ops->version; | 642 | u32 version = clp->rpc_ops->version; |
643 | int local_flock, local_fcntl; | ||
625 | 644 | ||
626 | seq_printf(m, ",vers=%u", version); | 645 | seq_printf(m, ",vers=%u", version); |
627 | seq_printf(m, ",rsize=%u", nfss->rsize); | 646 | seq_printf(m, ",rsize=%u", nfss->rsize); |
@@ -670,6 +689,18 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss, | |||
670 | else | 689 | else |
671 | seq_printf(m, ",lookupcache=pos"); | 690 | seq_printf(m, ",lookupcache=pos"); |
672 | } | 691 | } |
692 | |||
693 | local_flock = nfss->flags & NFS_MOUNT_LOCAL_FLOCK; | ||
694 | local_fcntl = nfss->flags & NFS_MOUNT_LOCAL_FCNTL; | ||
695 | |||
696 | if (!local_flock && !local_fcntl) | ||
697 | seq_printf(m, ",local_lock=none"); | ||
698 | else if (local_flock && local_fcntl) | ||
699 | seq_printf(m, ",local_lock=all"); | ||
700 | else if (local_flock) | ||
701 | seq_printf(m, ",local_lock=flock"); | ||
702 | else | ||
703 | seq_printf(m, ",local_lock=posix"); | ||
673 | } | 704 | } |
674 | 705 | ||
675 | /* | 706 | /* |
@@ -1017,9 +1048,13 @@ static int nfs_parse_mount_options(char *raw, | |||
1017 | break; | 1048 | break; |
1018 | case Opt_lock: | 1049 | case Opt_lock: |
1019 | mnt->flags &= ~NFS_MOUNT_NONLM; | 1050 | mnt->flags &= ~NFS_MOUNT_NONLM; |
1051 | mnt->flags &= ~(NFS_MOUNT_LOCAL_FLOCK | | ||
1052 | NFS_MOUNT_LOCAL_FCNTL); | ||
1020 | break; | 1053 | break; |
1021 | case Opt_nolock: | 1054 | case Opt_nolock: |
1022 | mnt->flags |= NFS_MOUNT_NONLM; | 1055 | mnt->flags |= NFS_MOUNT_NONLM; |
1056 | mnt->flags |= (NFS_MOUNT_LOCAL_FLOCK | | ||
1057 | NFS_MOUNT_LOCAL_FCNTL); | ||
1023 | break; | 1058 | break; |
1024 | case Opt_v2: | 1059 | case Opt_v2: |
1025 | mnt->flags &= ~NFS_MOUNT_VER3; | 1060 | mnt->flags &= ~NFS_MOUNT_VER3; |
@@ -1420,6 +1455,34 @@ static int nfs_parse_mount_options(char *raw, | |||
1420 | mnt->fscache_uniq = string; | 1455 | mnt->fscache_uniq = string; |
1421 | mnt->options |= NFS_OPTION_FSCACHE; | 1456 | mnt->options |= NFS_OPTION_FSCACHE; |
1422 | break; | 1457 | break; |
1458 | case Opt_local_lock: | ||
1459 | string = match_strdup(args); | ||
1460 | if (string == NULL) | ||
1461 | goto out_nomem; | ||
1462 | token = match_token(string, nfs_local_lock_tokens, | ||
1463 | args); | ||
1464 | kfree(string); | ||
1465 | switch (token) { | ||
1466 | case Opt_local_lock_all: | ||
1467 | mnt->flags |= (NFS_MOUNT_LOCAL_FLOCK | | ||
1468 | NFS_MOUNT_LOCAL_FCNTL); | ||
1469 | break; | ||
1470 | case Opt_local_lock_flock: | ||
1471 | mnt->flags |= NFS_MOUNT_LOCAL_FLOCK; | ||
1472 | break; | ||
1473 | case Opt_local_lock_posix: | ||
1474 | mnt->flags |= NFS_MOUNT_LOCAL_FCNTL; | ||
1475 | break; | ||
1476 | case Opt_local_lock_none: | ||
1477 | mnt->flags &= ~(NFS_MOUNT_LOCAL_FLOCK | | ||
1478 | NFS_MOUNT_LOCAL_FCNTL); | ||
1479 | break; | ||
1480 | default: | ||
1481 | dfprintk(MOUNT, "NFS: invalid " | ||
1482 | "local_lock argument\n"); | ||
1483 | return 0; | ||
1484 | }; | ||
1485 | break; | ||
1423 | 1486 | ||
1424 | /* | 1487 | /* |
1425 | * Special options | 1488 | * Special options |
@@ -1825,6 +1888,12 @@ static int nfs_validate_mount_data(void *options, | |||
1825 | if (!args->nfs_server.hostname) | 1888 | if (!args->nfs_server.hostname) |
1826 | goto out_nomem; | 1889 | goto out_nomem; |
1827 | 1890 | ||
1891 | if (!(data->flags & NFS_MOUNT_NONLM)) | ||
1892 | args->flags &= ~(NFS_MOUNT_LOCAL_FLOCK| | ||
1893 | NFS_MOUNT_LOCAL_FCNTL); | ||
1894 | else | ||
1895 | args->flags |= (NFS_MOUNT_LOCAL_FLOCK| | ||
1896 | NFS_MOUNT_LOCAL_FCNTL); | ||
1828 | /* | 1897 | /* |
1829 | * The legacy version 6 binary mount data from userspace has a | 1898 | * The legacy version 6 binary mount data from userspace has a |
1830 | * field used only to transport selinux information into the | 1899 | * field used only to transport selinux information into the |
@@ -2328,9 +2397,9 @@ static void nfs_kill_super(struct super_block *s) | |||
2328 | /* | 2397 | /* |
2329 | * Clone an NFS2/3 server record on xdev traversal (FSID-change) | 2398 | * Clone an NFS2/3 server record on xdev traversal (FSID-change) |
2330 | */ | 2399 | */ |
2331 | static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, | 2400 | static struct dentry * |
2332 | const char *dev_name, void *raw_data, | 2401 | nfs_xdev_mount(struct file_system_type *fs_type, int flags, |
2333 | struct vfsmount *mnt) | 2402 | const char *dev_name, void *raw_data) |
2334 | { | 2403 | { |
2335 | struct nfs_clone_mount *data = raw_data; | 2404 | struct nfs_clone_mount *data = raw_data; |
2336 | struct super_block *s; | 2405 | struct super_block *s; |
@@ -2342,7 +2411,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
2342 | }; | 2411 | }; |
2343 | int error; | 2412 | int error; |
2344 | 2413 | ||
2345 | dprintk("--> nfs_xdev_get_sb()\n"); | 2414 | dprintk("--> nfs_xdev_mount()\n"); |
2346 | 2415 | ||
2347 | /* create a new volume representation */ | 2416 | /* create a new volume representation */ |
2348 | 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); |
@@ -2389,28 +2458,26 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
2389 | } | 2458 | } |
2390 | 2459 | ||
2391 | s->s_flags |= MS_ACTIVE; | 2460 | s->s_flags |= MS_ACTIVE; |
2392 | mnt->mnt_sb = s; | ||
2393 | mnt->mnt_root = mntroot; | ||
2394 | 2461 | ||
2395 | /* 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 */ |
2396 | security_sb_clone_mnt_opts(data->sb, s); | 2463 | security_sb_clone_mnt_opts(data->sb, s); |
2397 | 2464 | ||
2398 | dprintk("<-- nfs_xdev_get_sb() = 0\n"); | 2465 | dprintk("<-- nfs_xdev_mount() = 0\n"); |
2399 | return 0; | 2466 | return mntroot; |
2400 | 2467 | ||
2401 | out_err_nosb: | 2468 | out_err_nosb: |
2402 | nfs_free_server(server); | 2469 | nfs_free_server(server); |
2403 | out_err_noserver: | 2470 | out_err_noserver: |
2404 | dprintk("<-- nfs_xdev_get_sb() = %d [error]\n", error); | 2471 | dprintk("<-- nfs_xdev_mount() = %d [error]\n", error); |
2405 | return error; | 2472 | return ERR_PTR(error); |
2406 | 2473 | ||
2407 | error_splat_super: | 2474 | error_splat_super: |
2408 | if (server && !s->s_root) | 2475 | if (server && !s->s_root) |
2409 | bdi_unregister(&server->backing_dev_info); | 2476 | bdi_unregister(&server->backing_dev_info); |
2410 | error_splat_bdi: | 2477 | error_splat_bdi: |
2411 | deactivate_locked_super(s); | 2478 | deactivate_locked_super(s); |
2412 | dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); | 2479 | dprintk("<-- nfs_xdev_mount() = %d [splat]\n", error); |
2413 | return error; | 2480 | return ERR_PTR(error); |
2414 | } | 2481 | } |
2415 | 2482 | ||
2416 | #ifdef CONFIG_NFS_V4 | 2483 | #ifdef CONFIG_NFS_V4 |
@@ -2441,7 +2508,8 @@ static void nfs4_fill_super(struct super_block *sb) | |||
2441 | 2508 | ||
2442 | static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args) | 2509 | static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args) |
2443 | { | 2510 | { |
2444 | args->flags &= ~(NFS_MOUNT_NONLM|NFS_MOUNT_NOACL|NFS_MOUNT_VER3); | 2511 | args->flags &= ~(NFS_MOUNT_NONLM|NFS_MOUNT_NOACL|NFS_MOUNT_VER3| |
2512 | NFS_MOUNT_LOCAL_FLOCK|NFS_MOUNT_LOCAL_FCNTL); | ||
2445 | } | 2513 | } |
2446 | 2514 | ||
2447 | static int nfs4_validate_text_mount_data(void *options, | 2515 | static int nfs4_validate_text_mount_data(void *options, |
@@ -2579,8 +2647,9 @@ out_no_address: | |||
2579 | /* | 2647 | /* |
2580 | * Get the superblock for the NFS4 root partition | 2648 | * Get the superblock for the NFS4 root partition |
2581 | */ | 2649 | */ |
2582 | static int nfs4_remote_get_sb(struct file_system_type *fs_type, | 2650 | static struct dentry * |
2583 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) | 2651 | nfs4_remote_mount(struct file_system_type *fs_type, int flags, |
2652 | const char *dev_name, void *raw_data) | ||
2584 | { | 2653 | { |
2585 | struct nfs_parsed_mount_data *data = raw_data; | 2654 | struct nfs_parsed_mount_data *data = raw_data; |
2586 | struct super_block *s; | 2655 | struct super_block *s; |
@@ -2644,15 +2713,16 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type, | |||
2644 | goto error_splat_root; | 2713 | goto error_splat_root; |
2645 | 2714 | ||
2646 | s->s_flags |= MS_ACTIVE; | 2715 | s->s_flags |= MS_ACTIVE; |
2647 | mnt->mnt_sb = s; | 2716 | |
2648 | mnt->mnt_root = mntroot; | 2717 | security_free_mnt_opts(&data->lsm_opts); |
2649 | error = 0; | 2718 | nfs_free_fhandle(mntfh); |
2719 | return mntroot; | ||
2650 | 2720 | ||
2651 | out: | 2721 | out: |
2652 | security_free_mnt_opts(&data->lsm_opts); | 2722 | security_free_mnt_opts(&data->lsm_opts); |
2653 | out_free_fh: | 2723 | out_free_fh: |
2654 | nfs_free_fhandle(mntfh); | 2724 | nfs_free_fhandle(mntfh); |
2655 | return error; | 2725 | return ERR_PTR(error); |
2656 | 2726 | ||
2657 | out_free: | 2727 | out_free: |
2658 | nfs_free_server(server); | 2728 | nfs_free_server(server); |
@@ -2898,9 +2968,9 @@ static void nfs4_kill_super(struct super_block *sb) | |||
2898 | /* | 2968 | /* |
2899 | * Clone an NFS4 server record on xdev traversal (FSID-change) | 2969 | * Clone an NFS4 server record on xdev traversal (FSID-change) |
2900 | */ | 2970 | */ |
2901 | static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, | 2971 | static struct dentry * |
2902 | const char *dev_name, void *raw_data, | 2972 | nfs4_xdev_mount(struct file_system_type *fs_type, int flags, |
2903 | struct vfsmount *mnt) | 2973 | const char *dev_name, void *raw_data) |
2904 | { | 2974 | { |
2905 | struct nfs_clone_mount *data = raw_data; | 2975 | struct nfs_clone_mount *data = raw_data; |
2906 | struct super_block *s; | 2976 | struct super_block *s; |
@@ -2912,7 +2982,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
2912 | }; | 2982 | }; |
2913 | int error; | 2983 | int error; |
2914 | 2984 | ||
2915 | dprintk("--> nfs4_xdev_get_sb()\n"); | 2985 | dprintk("--> nfs4_xdev_mount()\n"); |
2916 | 2986 | ||
2917 | /* create a new volume representation */ | 2987 | /* create a new volume representation */ |
2918 | 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); |
@@ -2959,32 +3029,30 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
2959 | } | 3029 | } |
2960 | 3030 | ||
2961 | s->s_flags |= MS_ACTIVE; | 3031 | s->s_flags |= MS_ACTIVE; |
2962 | mnt->mnt_sb = s; | ||
2963 | mnt->mnt_root = mntroot; | ||
2964 | 3032 | ||
2965 | security_sb_clone_mnt_opts(data->sb, s); | 3033 | security_sb_clone_mnt_opts(data->sb, s); |
2966 | 3034 | ||
2967 | dprintk("<-- nfs4_xdev_get_sb() = 0\n"); | 3035 | dprintk("<-- nfs4_xdev_mount() = 0\n"); |
2968 | return 0; | 3036 | return mntroot; |
2969 | 3037 | ||
2970 | out_err_nosb: | 3038 | out_err_nosb: |
2971 | nfs_free_server(server); | 3039 | nfs_free_server(server); |
2972 | out_err_noserver: | 3040 | out_err_noserver: |
2973 | dprintk("<-- nfs4_xdev_get_sb() = %d [error]\n", error); | 3041 | dprintk("<-- nfs4_xdev_mount() = %d [error]\n", error); |
2974 | return error; | 3042 | return ERR_PTR(error); |
2975 | 3043 | ||
2976 | error_splat_super: | 3044 | error_splat_super: |
2977 | if (server && !s->s_root) | 3045 | if (server && !s->s_root) |
2978 | bdi_unregister(&server->backing_dev_info); | 3046 | bdi_unregister(&server->backing_dev_info); |
2979 | error_splat_bdi: | 3047 | error_splat_bdi: |
2980 | deactivate_locked_super(s); | 3048 | deactivate_locked_super(s); |
2981 | dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); | 3049 | dprintk("<-- nfs4_xdev_mount() = %d [splat]\n", error); |
2982 | return error; | 3050 | return ERR_PTR(error); |
2983 | } | 3051 | } |
2984 | 3052 | ||
2985 | static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, | 3053 | static struct dentry * |
2986 | int flags, const char *dev_name, void *raw_data, | 3054 | nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags, |
2987 | struct vfsmount *mnt) | 3055 | const char *dev_name, void *raw_data) |
2988 | { | 3056 | { |
2989 | struct nfs_clone_mount *data = raw_data; | 3057 | struct nfs_clone_mount *data = raw_data; |
2990 | struct super_block *s; | 3058 | struct super_block *s; |
@@ -3048,14 +3116,12 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, | |||
3048 | } | 3116 | } |
3049 | 3117 | ||
3050 | s->s_flags |= MS_ACTIVE; | 3118 | s->s_flags |= MS_ACTIVE; |
3051 | mnt->mnt_sb = s; | ||
3052 | mnt->mnt_root = mntroot; | ||
3053 | 3119 | ||
3054 | security_sb_clone_mnt_opts(data->sb, s); | 3120 | security_sb_clone_mnt_opts(data->sb, s); |
3055 | 3121 | ||
3056 | nfs_free_fhandle(mntfh); | 3122 | nfs_free_fhandle(mntfh); |
3057 | dprintk("<-- nfs4_referral_get_sb() = 0\n"); | 3123 | dprintk("<-- nfs4_referral_get_sb() = 0\n"); |
3058 | return 0; | 3124 | return mntroot; |
3059 | 3125 | ||
3060 | out_err_nosb: | 3126 | out_err_nosb: |
3061 | nfs_free_server(server); | 3127 | nfs_free_server(server); |
@@ -3063,7 +3129,7 @@ out_err_noserver: | |||
3063 | nfs_free_fhandle(mntfh); | 3129 | nfs_free_fhandle(mntfh); |
3064 | out_err_nofh: | 3130 | out_err_nofh: |
3065 | dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error); | 3131 | dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error); |
3066 | return error; | 3132 | return ERR_PTR(error); |
3067 | 3133 | ||
3068 | error_splat_super: | 3134 | error_splat_super: |
3069 | if (server && !s->s_root) | 3135 | if (server && !s->s_root) |
@@ -3072,7 +3138,7 @@ error_splat_bdi: | |||
3072 | deactivate_locked_super(s); | 3138 | deactivate_locked_super(s); |
3073 | nfs_free_fhandle(mntfh); | 3139 | nfs_free_fhandle(mntfh); |
3074 | dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); | 3140 | dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); |
3075 | return error; | 3141 | return ERR_PTR(error); |
3076 | } | 3142 | } |
3077 | 3143 | ||
3078 | /* | 3144 | /* |