Skip to content

Commit 537935f

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
NFS/pNFS: Set the connect timeout for the pNFS flexfiles driver
Ensure that the connect timeout for the pNFS flexfiles driver is of the same order as the I/O timeout, so that we can fail over quickly when trying to read from a data server that is down. Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent cd18f24 commit 537935f

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

fs/nfs/client.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ int nfs_create_rpc_client(struct nfs_client *clp,
517517
.authflavor = flavor,
518518
.cred = cl_init->cred,
519519
.xprtsec = cl_init->xprtsec,
520+
.connect_timeout = cl_init->connect_timeout,
521+
.reconnect_timeout = cl_init->reconnect_timeout,
520522
};
521523

522524
if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags))

fs/nfs/internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ struct nfs_client_initdata {
8282
const struct rpc_timeout *timeparms;
8383
const struct cred *cred;
8484
struct xprtsec_parms xprtsec;
85+
unsigned long connect_timeout;
86+
unsigned long reconnect_timeout;
8587
};
8688

8789
/*

fs/nfs/nfs3client.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv,
8686
int ds_proto, unsigned int ds_timeo, unsigned int ds_retrans)
8787
{
8888
struct rpc_timeout ds_timeout;
89+
unsigned long connect_timeout = ds_timeo * (ds_retrans + 1) * HZ / 10;
8990
struct nfs_client *mds_clp = mds_srv->nfs_client;
9091
struct nfs_client_initdata cl_init = {
9192
.addr = ds_addr,
@@ -98,6 +99,8 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv,
9899
.timeparms = &ds_timeout,
99100
.cred = mds_srv->cred,
100101
.xprtsec = mds_clp->cl_xprtsec,
102+
.connect_timeout = connect_timeout,
103+
.reconnect_timeout = connect_timeout,
101104
};
102105
struct nfs_client *clp;
103106
char buf[INET6_ADDRSTRLEN + 1];

fs/nfs/pnfs_nfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,7 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv,
852852
{
853853
struct nfs_client *clp = ERR_PTR(-EIO);
854854
struct nfs4_pnfs_ds_addr *da;
855+
unsigned long connect_timeout = timeo * (retrans + 1) * HZ / 10;
855856
int status = 0;
856857

857858
dprintk("--> %s DS %s\n", __func__, ds->ds_remotestr);
@@ -870,6 +871,8 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv,
870871
.dstaddr = (struct sockaddr *)&da->da_addr,
871872
.addrlen = da->da_addrlen,
872873
.servername = clp->cl_hostname,
874+
.connect_timeout = connect_timeout,
875+
.reconnect_timeout = connect_timeout,
873876
};
874877

875878
if (da->da_transport != clp->cl_proto)

0 commit comments

Comments
 (0)