aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/super.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-05-10 15:07:39 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-14 20:30:29 -0400
commit486aa699ffb6ec28adbc147326d62ac9294de8dc (patch)
treee7957244df1cb5de3fae9da5422c376ef6a6ddc4 /fs/nfs/super.c
parentdb8333519187d5974cf2ff33910c893bf8727d9f (diff)
NFS: Create a new nfs_try_mount()
This function returns the same same return type as nfs4_try_mount() so they two can be more easily substituted. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r--fs/nfs/super.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index db0952de67d9..c69c8064011c 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -290,6 +290,9 @@ static int nfs_show_options(struct seq_file *, struct dentry *);
290static int nfs_show_devname(struct seq_file *, struct dentry *); 290static int nfs_show_devname(struct seq_file *, struct dentry *);
291static int nfs_show_path(struct seq_file *, struct dentry *); 291static int nfs_show_path(struct seq_file *, struct dentry *);
292static int nfs_show_stats(struct seq_file *, struct dentry *); 292static int nfs_show_stats(struct seq_file *, struct dentry *);
293static struct dentry *nfs_fs_mount_common(struct file_system_type *,
294 struct nfs_server *, int, const char *, struct nfs_fh *,
295 struct nfs_mount_info *);
293static struct dentry *nfs_fs_mount(struct file_system_type *, 296static struct dentry *nfs_fs_mount(struct file_system_type *,
294 int, const char *, void *); 297 int, const char *, void *);
295static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type, 298static struct dentry *nfs_xdev_mount(struct file_system_type *fs_type,
@@ -1680,8 +1683,8 @@ static int nfs_walk_authlist(struct nfs_parsed_mount_data *args,
1680 * Use the remote server's MOUNT service to request the NFS file handle 1683 * Use the remote server's MOUNT service to request the NFS file handle
1681 * corresponding to the provided path. 1684 * corresponding to the provided path.
1682 */ 1685 */
1683static int nfs_try_mount(struct nfs_parsed_mount_data *args, 1686static int nfs_request_mount(struct nfs_parsed_mount_data *args,
1684 struct nfs_fh *root_fh) 1687 struct nfs_fh *root_fh)
1685{ 1688{
1686 rpc_authflavor_t server_authlist[NFS_MAX_SECFLAVORS]; 1689 rpc_authflavor_t server_authlist[NFS_MAX_SECFLAVORS];
1687 unsigned int server_authlist_len = ARRAY_SIZE(server_authlist); 1690 unsigned int server_authlist_len = ARRAY_SIZE(server_authlist);
@@ -1744,6 +1747,25 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
1744 return nfs_walk_authlist(args, &request); 1747 return nfs_walk_authlist(args, &request);
1745} 1748}
1746 1749
1750static struct dentry *nfs_try_mount(int flags, const char *dev_name,
1751 struct nfs_fh *mntfh,
1752 struct nfs_mount_info *mount_info)
1753{
1754 int status;
1755 struct nfs_server *server;
1756
1757 status = nfs_request_mount(mount_info->parsed, mntfh);
1758 if (status)
1759 return ERR_PTR(status);
1760
1761 /* Get a volume representation */
1762 server = nfs_create_server(mount_info->parsed, mntfh);
1763 if (IS_ERR(server))
1764 return ERR_CAST(server);
1765
1766 return nfs_fs_mount_common(&nfs_fs_type, server, flags, dev_name, mntfh, mount_info);
1767}
1768
1747/* 1769/*
1748 * Split "dev_name" into "hostname:export_path". 1770 * Split "dev_name" into "hostname:export_path".
1749 * 1771 *
@@ -1966,11 +1988,6 @@ static int nfs_validate_mount_data(void *options,
1966 PAGE_SIZE, 1988 PAGE_SIZE,
1967 &args->nfs_server.export_path, 1989 &args->nfs_server.export_path,
1968 NFS_MAXPATHLEN); 1990 NFS_MAXPATHLEN);
1969 if (!status)
1970 status = nfs_try_mount(args, mntfh);
1971
1972 kfree(args->nfs_server.export_path);
1973 args->nfs_server.export_path = NULL;
1974 1991
1975 if (status) 1992 if (status)
1976 return status; 1993 return status;
@@ -2405,7 +2422,6 @@ error_splat_bdi:
2405static struct dentry *nfs_fs_mount(struct file_system_type *fs_type, 2422static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
2406 int flags, const char *dev_name, void *raw_data) 2423 int flags, const char *dev_name, void *raw_data)
2407{ 2424{
2408 struct nfs_server *server;
2409 struct nfs_parsed_mount_data *data = NULL; 2425 struct nfs_parsed_mount_data *data = NULL;
2410 struct nfs_mount_info mount_info = { 2426 struct nfs_mount_info mount_info = {
2411 .fill_super = nfs_fill_super, 2427 .fill_super = nfs_fill_super,
@@ -2429,20 +2445,12 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
2429 mount_info.parsed = data; 2445 mount_info.parsed = data;
2430 2446
2431#ifdef CONFIG_NFS_V4 2447#ifdef CONFIG_NFS_V4
2432 if (data->version == 4) { 2448 if (data->version == 4)
2433 mntroot = nfs4_try_mount(flags, dev_name, data); 2449 mntroot = nfs4_try_mount(flags, dev_name, data);
2434 goto out; 2450 else
2435 }
2436#endif /* CONFIG_NFS_V4 */ 2451#endif /* CONFIG_NFS_V4 */
2452 mntroot = nfs_try_mount(flags, dev_name, mntfh, &mount_info);
2437 2453
2438 /* Get a volume representation */
2439 server = nfs_create_server(data, mntfh);
2440 if (IS_ERR(server)) {
2441 mntroot = ERR_CAST(server);
2442 goto out;
2443 }
2444
2445 mntroot = nfs_fs_mount_common(fs_type, server, flags, dev_name, mntfh, &mount_info);
2446out: 2454out:
2447 nfs_free_parsed_mount_data(data); 2455 nfs_free_parsed_mount_data(data);
2448 nfs_free_fhandle(mntfh); 2456 nfs_free_fhandle(mntfh);