diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-07-30 16:05:18 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-07-30 19:04:53 -0400 |
commit | ff9099f26645818563c8d396a154c2ce6ee422eb (patch) | |
tree | fdd310643049dfe4105d4cee39024f543c673555 /fs/nfs | |
parent | e8f25e6d6d198dca7d09d8fe2c24ba3b9683bb24 (diff) |
NFS: Create a try_mount rpc op
I'm already looking up the nfs subversion in nfs_fs_mount(), so I have
easy access to rpc_ops that used to be difficult to reach. This allows
me to set up a different mount path for NFS v2/3 and NFS v4.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/internal.h | 2 | ||||
-rw-r--r-- | fs/nfs/nfs3proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4super.c | 3 | ||||
-rw-r--r-- | fs/nfs/proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/super.c | 14 |
7 files changed, 12 insertions, 12 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index ac936476b3bc..3364eccd17ef 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -328,6 +328,8 @@ extern struct file_system_type nfs_xdev_fs_type; | |||
328 | extern struct file_system_type nfs4_xdev_fs_type; | 328 | extern struct file_system_type nfs4_xdev_fs_type; |
329 | extern struct file_system_type nfs4_referral_fs_type; | 329 | extern struct file_system_type nfs4_referral_fs_type; |
330 | #endif | 330 | #endif |
331 | struct dentry *nfs_try_mount(int, const char *, struct nfs_mount_info *, | ||
332 | struct nfs_subversion *); | ||
331 | void nfs_initialise_sb(struct super_block *); | 333 | void nfs_initialise_sb(struct super_block *); |
332 | int nfs_set_sb_security(struct super_block *, struct dentry *, struct nfs_mount_info *); | 334 | int nfs_set_sb_security(struct super_block *, struct dentry *, struct nfs_mount_info *); |
333 | int nfs_clone_sb_security(struct super_block *, struct dentry *, struct nfs_mount_info *); | 335 | int nfs_clone_sb_security(struct super_block *, struct dentry *, struct nfs_mount_info *); |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 65d23eb92fe0..4f4cb8e49716 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -925,6 +925,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = { | |||
925 | .file_ops = &nfs_file_operations, | 925 | .file_ops = &nfs_file_operations, |
926 | .getroot = nfs3_proc_get_root, | 926 | .getroot = nfs3_proc_get_root, |
927 | .submount = nfs_submount, | 927 | .submount = nfs_submount, |
928 | .try_mount = nfs_try_mount, | ||
928 | .getattr = nfs3_proc_getattr, | 929 | .getattr = nfs3_proc_getattr, |
929 | .setattr = nfs3_proc_setattr, | 930 | .setattr = nfs3_proc_setattr, |
930 | .lookup = nfs3_proc_lookup, | 931 | .lookup = nfs3_proc_lookup, |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 99c2e7e4d3ea..c321fb59d801 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -367,7 +367,7 @@ extern const nfs4_stateid zero_stateid; | |||
367 | /* nfs4super.c */ | 367 | /* nfs4super.c */ |
368 | struct nfs_mount_info; | 368 | struct nfs_mount_info; |
369 | extern struct nfs_subversion nfs_v4; | 369 | extern struct nfs_subversion nfs_v4; |
370 | struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *); | 370 | struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *); |
371 | int init_nfs_v4(void); | 371 | int init_nfs_v4(void); |
372 | void exit_nfs_v4(void); | 372 | void exit_nfs_v4(void); |
373 | 373 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6843e0a37de8..eb4ba1d99df9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -6870,6 +6870,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { | |||
6870 | .file_ops = &nfs4_file_operations, | 6870 | .file_ops = &nfs4_file_operations, |
6871 | .getroot = nfs4_proc_get_root, | 6871 | .getroot = nfs4_proc_get_root, |
6872 | .submount = nfs4_submount, | 6872 | .submount = nfs4_submount, |
6873 | .try_mount = nfs4_try_mount, | ||
6873 | .getattr = nfs4_proc_getattr, | 6874 | .getattr = nfs4_proc_getattr, |
6874 | .setattr = nfs4_proc_setattr, | 6875 | .setattr = nfs4_proc_setattr, |
6875 | .lookup = nfs4_proc_lookup, | 6876 | .lookup = nfs4_proc_lookup, |
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index 8a505573c289..9384f666b6ab 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c | |||
@@ -226,7 +226,8 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt, | |||
226 | } | 226 | } |
227 | 227 | ||
228 | struct dentry *nfs4_try_mount(int flags, const char *dev_name, | 228 | struct dentry *nfs4_try_mount(int flags, const char *dev_name, |
229 | struct nfs_mount_info *mount_info) | 229 | struct nfs_mount_info *mount_info, |
230 | struct nfs_subversion *nfs_mod) | ||
230 | { | 231 | { |
231 | char *export_path; | 232 | char *export_path; |
232 | struct vfsmount *root_mnt; | 233 | struct vfsmount *root_mnt; |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 4d3356af3309..ebb3d9c5227b 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -774,6 +774,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
774 | .file_ops = &nfs_file_operations, | 774 | .file_ops = &nfs_file_operations, |
775 | .getroot = nfs_proc_get_root, | 775 | .getroot = nfs_proc_get_root, |
776 | .submount = nfs_submount, | 776 | .submount = nfs_submount, |
777 | .try_mount = nfs_try_mount, | ||
777 | .getattr = nfs_proc_getattr, | 778 | .getattr = nfs_proc_getattr, |
778 | .setattr = nfs_proc_setattr, | 779 | .setattr = nfs_proc_setattr, |
779 | .lookup = nfs_proc_lookup, | 780 | .lookup = nfs_proc_lookup, |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 4faefa19a8c3..5fca59d73e40 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -1650,9 +1650,9 @@ static int nfs_request_mount(struct nfs_parsed_mount_data *args, | |||
1650 | return nfs_walk_authlist(args, &request); | 1650 | return nfs_walk_authlist(args, &request); |
1651 | } | 1651 | } |
1652 | 1652 | ||
1653 | static struct dentry *nfs_try_mount(int flags, const char *dev_name, | 1653 | struct dentry *nfs_try_mount(int flags, const char *dev_name, |
1654 | struct nfs_mount_info *mount_info, | 1654 | struct nfs_mount_info *mount_info, |
1655 | struct nfs_subversion *nfs_mod) | 1655 | struct nfs_subversion *nfs_mod) |
1656 | { | 1656 | { |
1657 | int status; | 1657 | int status; |
1658 | struct nfs_server *server; | 1658 | struct nfs_server *server; |
@@ -2403,15 +2403,9 @@ struct dentry *nfs_fs_mount(struct file_system_type *fs_type, | |||
2403 | goto out; | 2403 | goto out; |
2404 | } | 2404 | } |
2405 | 2405 | ||
2406 | #ifdef CONFIG_NFS_V4 | 2406 | mntroot = nfs_mod->rpc_ops->try_mount(flags, dev_name, &mount_info, nfs_mod); |
2407 | if (mount_info.parsed->version == 4) | ||
2408 | mntroot = nfs4_try_mount(flags, dev_name, &mount_info); | ||
2409 | else | ||
2410 | #endif /* CONFIG_NFS_V4 */ | ||
2411 | mntroot = nfs_try_mount(flags, dev_name, &mount_info, nfs_mod); | ||
2412 | 2407 | ||
2413 | put_nfs_version(nfs_mod); | 2408 | put_nfs_version(nfs_mod); |
2414 | |||
2415 | out: | 2409 | out: |
2416 | nfs_free_parsed_mount_data(mount_info.parsed); | 2410 | nfs_free_parsed_mount_data(mount_info.parsed); |
2417 | nfs_free_fhandle(mount_info.mntfh); | 2411 | nfs_free_fhandle(mount_info.mntfh); |