Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jul 2018 12:38:08 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r336544 - projects/pnfs-planb-server/sys/fs/nfs
Message-ID:  <201807201238.w6KCc8Pl045854@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Fri Jul 20 12:38:07 2018
New Revision: 336544
URL: https://svnweb.freebsd.org/changeset/base/336544

Log:
  Update the comments and add a sysctl to set the retry limit for connections
  from clients to DSs. This is for the client side pNFS and head/current will
  be getting this commit soon.

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	Fri Jul 20 12:32:17 2018	(r336543)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs_commonkrpc.c	Fri Jul 20 12:38:07 2018	(r336544)
@@ -106,6 +106,7 @@ static int	nfs_bufpackets = 4;
 static int	nfs_reconnects;
 static int	nfs3_jukebox_delay = 10;
 static int	nfs_skip_wcc_data_onerr = 1;
+static int	nfs_dsretries = 2;
 
 SYSCTL_DECL(_vfs_nfs);
 
@@ -117,6 +118,8 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs3_jukebox_delay, CTL
     "Number of seconds to delay a retry after receiving EJUKEBOX");
 SYSCTL_INT(_vfs_nfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW, &nfs_skip_wcc_data_onerr, 0,
     "Disable weak cache consistency checking when server returns an error");
+SYSCTL_INT(_vfs_nfs, OID_AUTO, dsretries, CTLFLAG_RW, &nfs_dsretries, 0,
+    "Number of retries for a DS RPC before failure");
 
 static void	nfs_down(struct nfsmount *, struct thread *, const char *,
     int, int);
@@ -303,14 +306,20 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
 			if (cred != NULL) {
 				if (NFSHASSOFT(nmp)) {
 					/*
-					 * This should be a DS mount.  If the
-					 * timeout is set to 1/4th of the lease
-					 * duration, the DS should be disabled
-					 * at approximately 1/2 lease duration,
-					 * due to a retry count of 2.
-					 * This will hopefully cause the client
-					 * to continue without the disabled
-					 * DS in less than the lease duration.
+					 * This should be a DS mount.
+					 * Use CLSET_TIMEOUT to set the timeout
+					 * for connections to DSs instead of
+					 * specifying a timeout on each RPC.
+					 * This is done so that SO_SNDTIMEO
+					 * is set on the TCP socket as well
+					 * as specifying a time limit when
+					 * waiting for an RPC reply.  Useful
+					 * if the send queue for the TCP
+					 * connection has become constipated,
+					 * due to a failed DS.
+					 * The choice of lease_duration / 4 is
+					 * fairly arbitrary, but seems to work
+					 * ok, with a lower bound of 10sec.
 					 */
 					timo.tv_sec = nfsrv_lease / 4;
 					if (timo.tv_sec < 10)
@@ -346,6 +355,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
 				 * not maintain open/lock state and is the
 				 * only case where using a "soft" mount is
 				 * recommended for NFSv4.
+				 * For mounts from the MDS to DS, this is done
+				 * via mount options, but that is not the case
+				 * here.  The retry limit here can be adjusted
+				 * via the sysctl vfs.nfs.dsretries.
 				 * See the comment above w.r.t. timeout.
 				 */
 				timo.tv_sec = nfsrv_lease / 4;
@@ -353,7 +366,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
 					timo.tv_sec = 10;
 				timo.tv_usec = 0;
 				CLNT_CONTROL(client, CLSET_TIMEOUT, &timo);
-				retries = 2;
+				retries = nfs_dsretries;
 			}
 		}
 	} else {



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