Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Jul 2018 13:45:31 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r336277 - projects/pnfs-planb-server/sys/fs/nfs
Message-ID:  <201807141345.w6EDjVKq039646@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sat Jul 14 13:45:31 2018
New Revision: 336277
URL: https://svnweb.freebsd.org/changeset/base/336277

Log:
  Set CLSET_TIMEOUT() on a TCP connection to a DS to lease_duration/4.
  
  Setting the value this way results in the DS being disabled after approximately
  the lease duration, due to retries within the krpc.
  At least this is what I am seeing during testing and making it a fraction of
  the lease duration seemed better than just picking an arbitrary timeout.

Modified:
  projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c

Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c	Sat Jul 14 13:39:21 2018	(r336276)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c	Sat Jul 14 13:45:31 2018	(r336277)
@@ -98,6 +98,7 @@ extern int nfscl_ticks;
 extern void (*ncl_call_invalcaches)(struct vnode *);
 extern int nfs_numnfscbd;
 extern int nfscl_debuglevel;
+extern int nfsrv_lease;
 
 SVCPOOL		*nfscbd_pool;
 static int	nfsrv_gsscallbackson = 0;
@@ -195,8 +196,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
 	 */
 	if (nrp->nr_cred != NULL)
 		td->td_ucred = nrp->nr_cred;
-	else if (cred != NULL)
+	else {
+		KASSERT(cred != NULL, ("newnfs_request: null cred"));
 		td->td_ucred = cred;
+	}
 	saddr = nrp->nr_nam;
 
 	if (saddr->sa_family == AF_INET)
@@ -300,7 +303,9 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
 			if (cred != NULL) {
 				if (NFSHASSOFT(nmp)) {
 					/* This should be a DS mount. */
-					timo.tv_sec = 15;
+					timo.tv_sec = nfsrv_lease / 4;
+					if (timo.tv_sec < 10)
+						timo.tv_sec = 10;
 					timo.tv_usec = 0;
 					CLNT_CONTROL(client, CLSET_TIMEOUT,
 					    &timo);
@@ -333,7 +338,9 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
 				 * only case where using a "soft" mount is
 				 * recommended for NFSv4.
 				 */
-				timo.tv_sec = 15;
+				timo.tv_sec = nfsrv_lease / 4;
+				if (timo.tv_sec < 10)
+					timo.tv_sec = 10;
 				timo.tv_usec = 0;
 				CLNT_CONTROL(client, CLSET_TIMEOUT, &timo);
 				retries = 2;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807141345.w6EDjVKq039646>