aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-07-30 16:05:17 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-30 19:04:45 -0400
commite8f25e6d6d198dca7d09d8fe2c24ba3b9683bb24 (patch)
treecabdb43bbc11b40fd95e7e2742bc8a64b76241cb /fs
parentab7017a3a0a64b953e091619c30413b3721d925d (diff)
NFS: Remove the NFS v4 xdev mount function
I can now share this code with the v2 and v3 code by using the NFS subversion structure. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/namespace.c13
-rw-r--r--fs/nfs/nfs4super.c25
-rw-r--r--fs/nfs/super.c30
3 files changed, 10 insertions, 58 deletions
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index 08b9c93675d..0f699fefee6 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -195,20 +195,7 @@ static struct vfsmount *nfs_do_clone_mount(struct nfs_server *server,
195 const char *devname, 195 const char *devname,
196 struct nfs_clone_mount *mountdata) 196 struct nfs_clone_mount *mountdata)
197{ 197{
198#ifdef CONFIG_NFS_V4
199 struct vfsmount *mnt = ERR_PTR(-EINVAL);
200 switch (server->nfs_client->rpc_ops->version) {
201 case 2:
202 case 3:
203 mnt = vfs_kern_mount(&nfs_xdev_fs_type, 0, devname, mountdata);
204 break;
205 case 4:
206 mnt = vfs_kern_mount(&nfs4_xdev_fs_type, 0, devname, mountdata);
207 }
208 return mnt;
209#else
210 return vfs_kern_mount(&nfs_xdev_fs_type, 0, devname, mountdata); 198 return vfs_kern_mount(&nfs_xdev_fs_type, 0, devname, mountdata);
211#endif
212} 199}
213 200
214/** 201/**
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
index 1f3401902c2..8a505573c28 100644
--- a/fs/nfs/nfs4super.c
+++ b/fs/nfs/nfs4super.c
@@ -14,8 +14,6 @@
14 14
15static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type, 15static struct dentry *nfs4_remote_mount(struct file_system_type *fs_type,
16 int flags, const char *dev_name, void *raw_data); 16 int flags, const char *dev_name, void *raw_data);
17static struct dentry *nfs4_xdev_mount(struct file_system_type *fs_type,
18 int flags, const char *dev_name, void *raw_data);
19static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type, 17static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type,
20 int flags, const char *dev_name, void *raw_data); 18 int flags, const char *dev_name, void *raw_data);
21static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type, 19static struct dentry *nfs4_remote_referral_mount(struct file_system_type *fs_type,
@@ -37,14 +35,6 @@ static struct file_system_type nfs4_remote_fs_type = {
37 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 35 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
38}; 36};
39 37
40struct file_system_type nfs4_xdev_fs_type = {
41 .owner = THIS_MODULE,
42 .name = "nfs4",
43 .mount = nfs4_xdev_mount,
44 .kill_sb = nfs_kill_super,
45 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
46};
47
48static struct file_system_type nfs4_remote_referral_fs_type = { 38static struct file_system_type nfs4_remote_referral_fs_type = {
49 .owner = THIS_MODULE, 39 .owner = THIS_MODULE,
50 .name = "nfs4", 40 .name = "nfs4",
@@ -261,21 +251,6 @@ struct dentry *nfs4_try_mount(int flags, const char *dev_name,
261 return res; 251 return res;
262} 252}
263 253
264/*
265 * Clone an NFS4 server record on xdev traversal (FSID-change)
266 */
267static struct dentry *
268nfs4_xdev_mount(struct file_system_type *fs_type, int flags,
269 const char *dev_name, void *raw_data)
270{
271 struct nfs_mount_info mount_info = {
272 .fill_super = nfs_clone_super,
273 .set_security = nfs_clone_sb_security,
274 .cloned = raw_data,
275 };
276 return nfs_xdev_mount_common(&nfs4_fs_type, flags, dev_name, &mount_info);
277}
278
279static struct dentry * 254static struct dentry *
280nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags, 255nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags,
281 const char *dev_name, void *raw_data) 256 const char *dev_name, void *raw_data)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 61405a7a6b3..4faefa19a8c 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2445,10 +2445,15 @@ void nfs_kill_super(struct super_block *s)
2445 * Clone an NFS2/3/4 server record on xdev traversal (FSID-change) 2445 * Clone an NFS2/3/4 server record on xdev traversal (FSID-change)
2446 */ 2446 */
2447struct dentry * 2447struct dentry *
2448nfs_xdev_mount_common(struct file_system_type *fs_type, int flags, 2448nfs_xdev_mount(struct file_system_type *fs_type, int flags,
2449 const char *dev_name, struct nfs_mount_info *mount_info) 2449 const char *dev_name, void *raw_data)
2450{ 2450{
2451 struct nfs_clone_mount *data = mount_info->cloned; 2451 struct nfs_clone_mount *data = raw_data;
2452 struct nfs_mount_info mount_info = {
2453 .fill_super = nfs_clone_super,
2454 .set_security = nfs_clone_sb_security,
2455 .cloned = data,
2456 };
2452 struct nfs_server *server; 2457 struct nfs_server *server;
2453 struct dentry *mntroot = ERR_PTR(-ENOMEM); 2458 struct dentry *mntroot = ERR_PTR(-ENOMEM);
2454 struct nfs_subversion *nfs_mod = NFS_SB(data->sb)->nfs_client->cl_nfs_mod; 2459 struct nfs_subversion *nfs_mod = NFS_SB(data->sb)->nfs_client->cl_nfs_mod;
@@ -2456,7 +2461,7 @@ nfs_xdev_mount_common(struct file_system_type *fs_type, int flags,
2456 2461
2457 dprintk("--> nfs_xdev_mount_common()\n"); 2462 dprintk("--> nfs_xdev_mount_common()\n");
2458 2463
2459 mount_info->mntfh = data->fh; 2464 mount_info.mntfh = mount_info.cloned->fh;
2460 2465
2461 /* create a new volume representation */ 2466 /* create a new volume representation */
2462 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor); 2467 server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor);
@@ -2465,7 +2470,7 @@ nfs_xdev_mount_common(struct file_system_type *fs_type, int flags,
2465 goto out_err; 2470 goto out_err;
2466 } 2471 }
2467 2472
2468 mntroot = nfs_fs_mount_common(server, flags, dev_name, mount_info, nfs_mod); 2473 mntroot = nfs_fs_mount_common(server, flags, dev_name, &mount_info, nfs_mod);
2469 dprintk("<-- nfs_xdev_mount_common() = 0\n"); 2474 dprintk("<-- nfs_xdev_mount_common() = 0\n");
2470out: 2475out:
2471 return mntroot; 2476 return mntroot;
@@ -2475,21 +2480,6 @@ out_err:
2475 goto out; 2480 goto out;
2476} 2481}
2477 2482
2478/*
2479 * Clone an NFS2/3 server record on xdev traversal (FSID-change)
2480 */
2481static struct dentry *
2482nfs_xdev_mount(struct file_system_type *fs_type, int flags,
2483 const char *dev_name, void *raw_data)
2484{
2485 struct nfs_mount_info mount_info = {
2486 .fill_super = nfs_clone_super,
2487 .set_security = nfs_clone_sb_security,
2488 .cloned = raw_data,
2489 };
2490 return nfs_xdev_mount_common(&nfs_fs_type, flags, dev_name, &mount_info);
2491}
2492
2493#ifdef CONFIG_NFS_V4 2483#ifdef CONFIG_NFS_V4
2494 2484
2495static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args) 2485static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args)