diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-02-08 11:17:55 -0500 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2017-02-09 14:15:16 -0500 |
commit | 26ae102f2cfd0215daa57dc790aa3bfe534403a9 (patch) | |
tree | ce13f4d3a76929211161d40eb5d180252a99096a | |
parent | 7196dbb02ea05835b9ee56910ee82cb55422c7f1 (diff) |
NFSv4: Set the connection timeout to match the lease period
Set the timeout for TCP connections to be 1 lease period to ensure
that we don't lose our lease due to a faulty TCP connection.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r-- | fs/nfs/nfs4renewd.c | 2 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 5 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 10 |
3 files changed, 10 insertions, 7 deletions
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index 82e77198d17e..1f8c2ae43a8d 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
@@ -153,7 +153,7 @@ void nfs4_set_lease_period(struct nfs_client *clp, | |||
153 | spin_unlock(&clp->cl_lock); | 153 | spin_unlock(&clp->cl_lock); |
154 | 154 | ||
155 | /* Cap maximum reconnect timeout at 1/2 lease period */ | 155 | /* Cap maximum reconnect timeout at 1/2 lease period */ |
156 | rpc_cap_max_reconnect_timeout(clp->cl_rpcclient, lease >> 1); | 156 | rpc_set_connect_timeout(clp->cl_rpcclient, lease, lease >> 1); |
157 | } | 157 | } |
158 | 158 | ||
159 | /* | 159 | /* |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 33f216edb434..6095ecba0dde 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -201,8 +201,9 @@ int rpc_clnt_add_xprt(struct rpc_clnt *, struct xprt_create *, | |||
201 | struct rpc_xprt *, | 201 | struct rpc_xprt *, |
202 | void *), | 202 | void *), |
203 | void *data); | 203 | void *data); |
204 | void rpc_cap_max_reconnect_timeout(struct rpc_clnt *clnt, | 204 | void rpc_set_connect_timeout(struct rpc_clnt *clnt, |
205 | unsigned long timeo); | 205 | unsigned long connect_timeout, |
206 | unsigned long reconnect_timeout); | ||
206 | 207 | ||
207 | int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *, | 208 | int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *, |
208 | struct rpc_xprt_switch *, | 209 | struct rpc_xprt_switch *, |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index b5bc0c589f6a..52da3ce54bb5 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -2747,17 +2747,19 @@ rpc_xprt_set_connect_timeout(struct rpc_clnt *clnt, | |||
2747 | } | 2747 | } |
2748 | 2748 | ||
2749 | void | 2749 | void |
2750 | rpc_cap_max_reconnect_timeout(struct rpc_clnt *clnt, unsigned long timeo) | 2750 | rpc_set_connect_timeout(struct rpc_clnt *clnt, |
2751 | unsigned long connect_timeout, | ||
2752 | unsigned long reconnect_timeout) | ||
2751 | { | 2753 | { |
2752 | struct connect_timeout_data timeout = { | 2754 | struct connect_timeout_data timeout = { |
2753 | .connect_timeout = timeo, | 2755 | .connect_timeout = connect_timeout, |
2754 | .reconnect_timeout = timeo, | 2756 | .reconnect_timeout = reconnect_timeout, |
2755 | }; | 2757 | }; |
2756 | rpc_clnt_iterate_for_each_xprt(clnt, | 2758 | rpc_clnt_iterate_for_each_xprt(clnt, |
2757 | rpc_xprt_set_connect_timeout, | 2759 | rpc_xprt_set_connect_timeout, |
2758 | &timeout); | 2760 | &timeout); |
2759 | } | 2761 | } |
2760 | EXPORT_SYMBOL_GPL(rpc_cap_max_reconnect_timeout); | 2762 | EXPORT_SYMBOL_GPL(rpc_set_connect_timeout); |
2761 | 2763 | ||
2762 | void rpc_clnt_xprt_switch_put(struct rpc_clnt *clnt) | 2764 | void rpc_clnt_xprt_switch_put(struct rpc_clnt *clnt) |
2763 | { | 2765 | { |