diff options
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 41 |
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 | */ | ||
1430 | struct 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 | } | ||
1460 | EXPORT_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. |