aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorPeng Tao <tao.peng@primarydata.com>2014-05-30 06:15:57 -0400
committerTom Haynes <loghyr@primarydata.com>2015-02-03 14:06:34 -0500
commit1a04c6e1a26a43305fe124a0978a3e4be861af89 (patch)
tree9ea569914b07094f45cf45c45e92a883eec07386 /fs/nfs
parent39280a5ae8443dcc1ab3bb5ebc205aab0855b849 (diff)
nfsv3: introduce nfs3_set_ds_client
The flexfiles layout wants to create DS connection over NFSv3. Add nfs3_set_ds_client to allow that to happen. Signed-off-by: Peng Tao <tao.peng@primarydata.com> Signed-off-by: Tom Haynes <Thomas.Haynes@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/internal.h4
-rw-r--r--fs/nfs/nfs3_fs.h2
-rw-r--r--fs/nfs/nfs3client.c34
-rw-r--r--fs/nfs/nfs3super.c2
4 files changed, 41 insertions, 1 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 7d7c36ff09fa..7332ba1f693b 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -193,6 +193,10 @@ extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
193 rpc_authflavor_t au_flavor); 193 rpc_authflavor_t au_flavor);
194extern struct rpc_clnt *nfs4_find_or_create_ds_client(struct nfs_client *, 194extern struct rpc_clnt *nfs4_find_or_create_ds_client(struct nfs_client *,
195 struct inode *); 195 struct inode *);
196extern struct nfs_client *nfs3_set_ds_client(struct nfs_client *mds_clp,
197 const struct sockaddr *ds_addr, int ds_addrlen,
198 int ds_proto, unsigned int ds_timeo,
199 unsigned int ds_retrans, rpc_authflavor_t au_flavor);
196#ifdef CONFIG_PROC_FS 200#ifdef CONFIG_PROC_FS
197extern int __init nfs_fs_proc_init(void); 201extern int __init nfs_fs_proc_init(void);
198extern void nfs_fs_proc_exit(void); 202extern void nfs_fs_proc_exit(void);
diff --git a/fs/nfs/nfs3_fs.h b/fs/nfs/nfs3_fs.h
index 333ae4068506..e134d6548ab7 100644
--- a/fs/nfs/nfs3_fs.h
+++ b/fs/nfs/nfs3_fs.h
@@ -30,5 +30,7 @@ struct nfs_server *nfs3_create_server(struct nfs_mount_info *, struct nfs_subver
30struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *, 30struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *,
31 struct nfs_fattr *, rpc_authflavor_t); 31 struct nfs_fattr *, rpc_authflavor_t);
32 32
33/* nfs3super.c */
34extern struct nfs_subversion nfs_v3;
33 35
34#endif /* __LINUX_FS_NFS_NFS3_FS_H */ 36#endif /* __LINUX_FS_NFS_NFS3_FS_H */
diff --git a/fs/nfs/nfs3client.c b/fs/nfs/nfs3client.c
index 8c1b437c5403..52e2344bf9a1 100644
--- a/fs/nfs/nfs3client.c
+++ b/fs/nfs/nfs3client.c
@@ -64,3 +64,37 @@ struct nfs_server *nfs3_clone_server(struct nfs_server *source,
64 nfs_init_server_aclclient(server); 64 nfs_init_server_aclclient(server);
65 return server; 65 return server;
66} 66}
67
68/*
69 * Set up a pNFS Data Server client over NFSv3.
70 *
71 * Return any existing nfs_client that matches server address,port,version
72 * and minorversion.
73 *
74 * For a new nfs_client, use a soft mount (default), a low retrans and a
75 * low timeout interval so that if a connection is lost, we retry through
76 * the MDS.
77 */
78struct nfs_client *nfs3_set_ds_client(struct nfs_client *mds_clp,
79 const struct sockaddr *ds_addr, int ds_addrlen,
80 int ds_proto, unsigned int ds_timeo, unsigned int ds_retrans,
81 rpc_authflavor_t au_flavor)
82{
83 struct nfs_client_initdata cl_init = {
84 .addr = ds_addr,
85 .addrlen = ds_addrlen,
86 .nfs_mod = &nfs_v3,
87 .proto = ds_proto,
88 .net = mds_clp->cl_net,
89 };
90 struct rpc_timeout ds_timeout;
91 struct nfs_client *clp;
92
93 /* Use the MDS nfs_client cl_ipaddr. */
94 nfs_init_timeout_values(&ds_timeout, ds_proto, ds_timeo, ds_retrans);
95 clp = nfs_get_client(&cl_init, &ds_timeout, mds_clp->cl_ipaddr,
96 au_flavor);
97
98 return clp;
99}
100EXPORT_SYMBOL_GPL(nfs3_set_ds_client);
diff --git a/fs/nfs/nfs3super.c b/fs/nfs/nfs3super.c
index 6af29c2da352..5c4394e4656b 100644
--- a/fs/nfs/nfs3super.c
+++ b/fs/nfs/nfs3super.c
@@ -7,7 +7,7 @@
7#include "nfs3_fs.h" 7#include "nfs3_fs.h"
8#include "nfs.h" 8#include "nfs.h"
9 9
10static struct nfs_subversion nfs_v3 = { 10struct nfs_subversion nfs_v3 = {
11 .owner = THIS_MODULE, 11 .owner = THIS_MODULE,
12 .nfs_fs = &nfs_fs_type, 12 .nfs_fs = &nfs_fs_type,
13 .rpc_vers = &nfs_version3, 13 .rpc_vers = &nfs_version3,