NFSv4: Set the connection timeout to match the lease period
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 8 Feb 2017 16:17:55 +0000 (11:17 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 9 Feb 2017 19:15:16 +0000 (14:15 -0500)
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>
fs/nfs/nfs4renewd.c
include/linux/sunrpc/clnt.h
net/sunrpc/clnt.c

index 82e7719..1f8c2ae 100644 (file)
@@ -153,7 +153,7 @@ void nfs4_set_lease_period(struct nfs_client *clp,
        spin_unlock(&clp->cl_lock);
 
        /* Cap maximum reconnect timeout at 1/2 lease period */
-       rpc_cap_max_reconnect_timeout(clp->cl_rpcclient, lease >> 1);
+       rpc_set_connect_timeout(clp->cl_rpcclient, lease, lease >> 1);
 }
 
 /*
index 33f216e..6095ecb 100644 (file)
@@ -201,8 +201,9 @@ int         rpc_clnt_add_xprt(struct rpc_clnt *, struct xprt_create *,
                                struct rpc_xprt *,
                                void *),
                        void *data);
-void           rpc_cap_max_reconnect_timeout(struct rpc_clnt *clnt,
-                       unsigned long timeo);
+void           rpc_set_connect_timeout(struct rpc_clnt *clnt,
+                       unsigned long connect_timeout,
+                       unsigned long reconnect_timeout);
 
 int            rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *,
                        struct rpc_xprt_switch *,
index b5bc0c5..52da3ce 100644 (file)
@@ -2747,17 +2747,19 @@ rpc_xprt_set_connect_timeout(struct rpc_clnt *clnt,
 }
 
 void
-rpc_cap_max_reconnect_timeout(struct rpc_clnt *clnt, unsigned long timeo)
+rpc_set_connect_timeout(struct rpc_clnt *clnt,
+               unsigned long connect_timeout,
+               unsigned long reconnect_timeout)
 {
        struct connect_timeout_data timeout = {
-               .connect_timeout = timeo,
-               .reconnect_timeout = timeo,
+               .connect_timeout = connect_timeout,
+               .reconnect_timeout = reconnect_timeout,
        };
        rpc_clnt_iterate_for_each_xprt(clnt,
                        rpc_xprt_set_connect_timeout,
                        &timeout);
 }
-EXPORT_SYMBOL_GPL(rpc_cap_max_reconnect_timeout);
+EXPORT_SYMBOL_GPL(rpc_set_connect_timeout);
 
 void rpc_clnt_xprt_switch_put(struct rpc_clnt *clnt)
 {