Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Trond Myklebust and committed by
Anna Schumaker
26ae102f 7196dbb0

+10 -7
+1 -1
fs/nfs/nfs4renewd.c
··· 153 153 spin_unlock(&clp->cl_lock); 154 154 155 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 /*
+3 -2
include/linux/sunrpc/clnt.h
··· 201 201 struct rpc_xprt *, 202 202 void *), 203 203 void *data); 204 - void rpc_cap_max_reconnect_timeout(struct rpc_clnt *clnt, 205 - unsigned long timeo); 204 + void rpc_set_connect_timeout(struct rpc_clnt *clnt, 205 + unsigned long connect_timeout, 206 + unsigned long reconnect_timeout); 206 207 207 208 int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *, 208 209 struct rpc_xprt_switch *,
+6 -4
net/sunrpc/clnt.c
··· 2747 2747 } 2748 2748 2749 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 2754 struct connect_timeout_data timeout = { 2753 - .connect_timeout = timeo, 2754 - .reconnect_timeout = timeo, 2755 + .connect_timeout = connect_timeout, 2756 + .reconnect_timeout = reconnect_timeout, 2755 2757 }; 2756 2758 rpc_clnt_iterate_for_each_xprt(clnt, 2757 2759 rpc_xprt_set_connect_timeout, 2758 2760 &timeout); 2759 2761 } 2760 - EXPORT_SYMBOL_GPL(rpc_cap_max_reconnect_timeout); 2762 + EXPORT_SYMBOL_GPL(rpc_set_connect_timeout); 2761 2763 2762 2764 void rpc_clnt_xprt_switch_put(struct rpc_clnt *clnt) 2763 2765 {