aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3client.c
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/nfs3client.c
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/nfs3client.c')
-rw-r--r--fs/nfs/nfs3client.c34
1 files changed, 34 insertions, 0 deletions
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);