aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/client.c
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2011-02-28 20:34:17 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-03-11 15:38:42 -0500
commitd83217c13531fd59730d77b5c2284e90e56c0a50 (patch)
treee347037afc91fdb81e0e2fcf7225d30462fb90af /fs/nfs/client.c
parent64419a9b20938d9070fdd8c58c2fa23c911915f8 (diff)
NFSv4.1: data server connection
Introduce a data server set_client and init session following the nfs4_set_client and nfs4_init_session convention. Once a new nfs_client is on the nfs_client_list, the nfs_client cl_cons_state serializes access to creating an nfs_client struct with matching properties. Use the new nfs_get_client() that initializes new clients. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r--fs/nfs/client.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index d5c5bdfa4231..6dd50ac5b545 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1417,6 +1417,47 @@ error:
1417 return error; 1417 return error;
1418} 1418}
1419 1419
1420/*
1421 * Set up a pNFS Data Server client.
1422 *
1423 * Return any existing nfs_client that matches server address,port,version
1424 * and minorversion.
1425 *
1426 * For a new nfs_client, use a soft mount (default), a low retrans and a
1427 * low timeout interval so that if a connection is lost, we retry through
1428 * the MDS.
1429 */
1430struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
1431 const struct sockaddr *ds_addr,
1432 int ds_addrlen, int ds_proto)
1433{
1434 struct nfs_client_initdata cl_init = {
1435 .addr = ds_addr,
1436 .addrlen = ds_addrlen,
1437 .rpc_ops = &nfs_v4_clientops,
1438 .proto = ds_proto,
1439 .minorversion = mds_clp->cl_minorversion,
1440 };
1441 struct rpc_timeout ds_timeout = {
1442 .to_initval = 15 * HZ,
1443 .to_maxval = 15 * HZ,
1444 .to_retries = 1,
1445 .to_exponential = 1,
1446 };
1447 struct nfs_client *clp;
1448
1449 /*
1450 * Set an authflavor equual to the MDS value. Use the MDS nfs_client
1451 * cl_ipaddr so as to use the same EXCHANGE_ID co_ownerid as the MDS
1452 * (section 13.1 RFC 5661).
1453 */
1454 clp = nfs_get_client(&cl_init, &ds_timeout, mds_clp->cl_ipaddr,
1455 mds_clp->cl_rpcclient->cl_auth->au_flavor, 0);
1456
1457 dprintk("<-- %s %p\n", __func__, clp);
1458 return clp;
1459}
1460EXPORT_SYMBOL(nfs4_set_ds_client);
1420 1461
1421/* 1462/*
1422 * Session has been established, and the client marked ready. 1463 * Session has been established, and the client marked ready.