aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r--fs/nfs/super.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 95866a8c21b..61405a7a6b3 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -64,6 +64,7 @@
64#include "internal.h" 64#include "internal.h"
65#include "fscache.h" 65#include "fscache.h"
66#include "pnfs.h" 66#include "pnfs.h"
67#include "nfs.h"
67 68
68#define NFSDBG_FACILITY NFSDBG_VFS 69#define NFSDBG_FACILITY NFSDBG_VFS
69#define NFS_TEXT_DATA 1 70#define NFS_TEXT_DATA 1
@@ -281,7 +282,7 @@ static match_table_t nfs_vers_tokens = {
281static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type, 282static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type,
282 int flags, const char *dev_name, void *raw_data); 283 int flags, const char *dev_name, void *raw_data);
283 284
284static struct file_system_type nfs_fs_type = { 285struct file_system_type nfs_fs_type = {
285 .owner = THIS_MODULE, 286 .owner = THIS_MODULE,
286 .name = "nfs", 287 .name = "nfs",
287 .mount = nfs_fs_mount, 288 .mount = nfs_fs_mount,
@@ -1650,7 +1651,8 @@ static int nfs_request_mount(struct nfs_parsed_mount_data *args,
1650} 1651}
1651 1652
1652static struct dentry *nfs_try_mount(int flags, const char *dev_name, 1653static struct dentry *nfs_try_mount(int flags, const char *dev_name,
1653 struct nfs_mount_info *mount_info) 1654 struct nfs_mount_info *mount_info,
1655 struct nfs_subversion *nfs_mod)
1654{ 1656{
1655 int status; 1657 int status;
1656 struct nfs_server *server; 1658 struct nfs_server *server;
@@ -1662,11 +1664,11 @@ static struct dentry *nfs_try_mount(int flags, const char *dev_name,
1662 } 1664 }
1663 1665
1664 /* Get a volume representation */ 1666 /* Get a volume representation */
1665 server = nfs_create_server(mount_info->parsed, mount_info->mntfh); 1667 server = nfs_create_server(mount_info->parsed, mount_info->mntfh, nfs_mod);
1666 if (IS_ERR(server)) 1668 if (IS_ERR(server))
1667 return ERR_CAST(server); 1669 return ERR_CAST(server);
1668 1670
1669 return nfs_fs_mount_common(&nfs_fs_type, server, flags, dev_name, mount_info); 1671 return nfs_fs_mount_common(server, flags, dev_name, mount_info, nfs_mod);
1670} 1672}
1671 1673
1672/* 1674/*
@@ -2297,10 +2299,10 @@ int nfs_clone_sb_security(struct super_block *s, struct dentry *mntroot,
2297 return 0; 2299 return 0;
2298} 2300}
2299 2301
2300struct dentry *nfs_fs_mount_common(struct file_system_type *fs_type, 2302struct dentry *nfs_fs_mount_common(struct nfs_server *server,
2301 struct nfs_server *server,
2302 int flags, const char *dev_name, 2303 int flags, const char *dev_name,
2303 struct nfs_mount_info *mount_info) 2304 struct nfs_mount_info *mount_info,
2305 struct nfs_subversion *nfs_mod)
2304{ 2306{
2305 struct super_block *s; 2307 struct super_block *s;
2306 struct dentry *mntroot = ERR_PTR(-ENOMEM); 2308 struct dentry *mntroot = ERR_PTR(-ENOMEM);
@@ -2319,7 +2321,7 @@ struct dentry *nfs_fs_mount_common(struct file_system_type *fs_type,
2319 sb_mntdata.mntflags |= MS_SYNCHRONOUS; 2321 sb_mntdata.mntflags |= MS_SYNCHRONOUS;
2320 2322
2321 /* Get a superblock - note that we may end up sharing one that already exists */ 2323 /* Get a superblock - note that we may end up sharing one that already exists */
2322 s = sget(fs_type, compare_super, nfs_set_super, flags, &sb_mntdata); 2324 s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata);
2323 if (IS_ERR(s)) { 2325 if (IS_ERR(s)) {
2324 mntroot = ERR_CAST(s); 2326 mntroot = ERR_CAST(s);
2325 goto out_err_nosb; 2327 goto out_err_nosb;
@@ -2378,6 +2380,7 @@ struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
2378 .set_security = nfs_set_sb_security, 2380 .set_security = nfs_set_sb_security,
2379 }; 2381 };
2380 struct dentry *mntroot = ERR_PTR(-ENOMEM); 2382 struct dentry *mntroot = ERR_PTR(-ENOMEM);
2383 struct nfs_subversion *nfs_mod;
2381 int error; 2384 int error;
2382 2385
2383 mount_info.parsed = nfs_alloc_parsed_mount_data(); 2386 mount_info.parsed = nfs_alloc_parsed_mount_data();
@@ -2394,12 +2397,20 @@ struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
2394 goto out; 2397 goto out;
2395 } 2398 }
2396 2399
2400 nfs_mod = get_nfs_version(mount_info.parsed->version);
2401 if (IS_ERR(nfs_mod)) {
2402 mntroot = ERR_CAST(nfs_mod);
2403 goto out;
2404 }
2405
2397#ifdef CONFIG_NFS_V4 2406#ifdef CONFIG_NFS_V4
2398 if (mount_info.parsed->version == 4) 2407 if (mount_info.parsed->version == 4)
2399 mntroot = nfs4_try_mount(flags, dev_name, &mount_info); 2408 mntroot = nfs4_try_mount(flags, dev_name, &mount_info);
2400 else 2409 else
2401#endif /* CONFIG_NFS_V4 */ 2410#endif /* CONFIG_NFS_V4 */
2402 mntroot = nfs_try_mount(flags, dev_name, &mount_info); 2411 mntroot = nfs_try_mount(flags, dev_name, &mount_info, nfs_mod);
2412
2413 put_nfs_version(nfs_mod);
2403 2414
2404out: 2415out:
2405 nfs_free_parsed_mount_data(mount_info.parsed); 2416 nfs_free_parsed_mount_data(mount_info.parsed);
@@ -2440,6 +2451,7 @@ nfs_xdev_mount_common(struct file_system_type *fs_type, int flags,
2440 struct nfs_clone_mount *data = mount_info->cloned; 2451 struct nfs_clone_mount *data = mount_info->cloned;
2441 struct nfs_server *server; 2452 struct nfs_server *server;
2442 struct dentry *mntroot = ERR_PTR(-ENOMEM); 2453 struct dentry *mntroot = ERR_PTR(-ENOMEM);
2454 struct nfs_subversion *nfs_mod = NFS_SB(data->sb)->nfs_client->cl_nfs_mod;
2443 int error; 2455 int error;
2444 2456
2445 dprintk("--> nfs_xdev_mount_common()\n"); 2457 dprintk("--> nfs_xdev_mount_common()\n");
@@ -2453,7 +2465,7 @@ nfs_xdev_mount_common(struct file_system_type *fs_type, int flags,
2453 goto out_err; 2465 goto out_err;
2454 } 2466 }
2455 2467
2456 mntroot = nfs_fs_mount_common(fs_type, server, flags, dev_name, mount_info); 2468 mntroot = nfs_fs_mount_common(server, flags, dev_name, mount_info, nfs_mod);
2457 dprintk("<-- nfs_xdev_mount_common() = 0\n"); 2469 dprintk("<-- nfs_xdev_mount_common() = 0\n");
2458out: 2470out:
2459 return mntroot; 2471 return mntroot;