Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jul 2018 18:54:44 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336312 - in head/sys/fs: nfs nfsclient
Message-ID:  <201807151854.w6FIsi68034911@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sun Jul 15 18:54:44 2018
New Revision: 336312
URL: https://svnweb.freebsd.org/changeset/base/336312

Log:
  Shut down the TCP connection to a DS in the pNFS client when Renew fails.
  
  When a NFSv4.1 client mount using pNFS detects a failure trying to do a
  Renew (actually just a Sequence operation), the code would simply try
  again and again and again every 30sec.
  This would tie up the "nfscl" thread, which should also be doing other
  things like Renews on other DSs and the MDS.
  This patch adds code which closes down the TCP connection and marks it
  defunct when Renew detects an failure to communicate with the DS, so
  further Renews will not be attempted until a new working TCP connection to
  the DS is established.
  It also makes the call to nfscl_cancelreqs() unconditional, since
  nfscl_cancelreqs() checks the NFSCLDS_SAMECONN flag and does so while holding
  the lock.
  This fix only applies to the NFSv4.1 client whne using pNFS and without it
  the only effect would have been an "nfscl" thread busy doing Renew attempts
  on an unresponsive DS.
  
  MFC after:	2 weeks

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfs/nfs_var.h
==============================================================================
--- head/sys/fs/nfs/nfs_var.h	Sun Jul 15 18:03:56 2018	(r336311)
+++ head/sys/fs/nfs/nfs_var.h	Sun Jul 15 18:54:44 2018	(r336312)
@@ -603,6 +603,7 @@ struct nfscllayout *nfscl_getlayout(struct nfsclclient
     uint64_t, struct nfsclflayout **, int *);
 void nfscl_dserr(uint32_t, uint32_t, struct nfscldevinfo *,
     struct nfscllayout *, struct nfsclds *);
+void nfscl_cancelreqs(struct nfsclds *);
 void nfscl_rellayout(struct nfscllayout *, int);
 struct nfscldevinfo *nfscl_getdevinfo(struct nfsclclient *, uint8_t *,
     struct nfscldevinfo *);

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clrpcops.c	Sun Jul 15 18:03:56 2018	(r336311)
+++ head/sys/fs/nfsclient/nfs_clrpcops.c	Sun Jul 15 18:54:44 2018	(r336312)
@@ -4408,9 +4408,12 @@ nfsrpc_renew(struct nfsclclient *clp, struct nfsclds *
 	if (dsp == NULL)
 		error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred,
 		    NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL);
-	else
+	else {
 		error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred,
 		    NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess);
+		if (error == ENXIO)
+			nfscl_cancelreqs(dsp);
+	}
 	if (error)
 		return (error);
 	error = nd->nd_repstat;

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clstate.c	Sun Jul 15 18:03:56 2018	(r336311)
+++ head/sys/fs/nfsclient/nfs_clstate.c	Sun Jul 15 18:54:44 2018	(r336312)
@@ -125,7 +125,6 @@ static struct nfscldeleg *nfscl_finddeleg(struct nfscl
 static void nfscl_retoncloselayout(vnode_t, struct nfsclclient *, uint8_t *,
     int, struct nfsclrecalllayout **);
 static void nfscl_reldevinfo_locked(struct nfscldevinfo *);
-static void nfscl_cancelreqs(struct nfsclds *);
 static struct nfscllayout *nfscl_findlayout(struct nfsclclient *, u_int8_t *,
     int);
 static struct nfscldevinfo *nfscl_finddevinfo(struct nfsclclient *, uint8_t *);
@@ -5001,16 +5000,17 @@ nfscl_dserr(uint32_t op, uint32_t stat, struct nfsclde
 		free(recallp, M_NFSLAYRECALL);
 	}
 
-	/* If the connection isn't used for other DSs, we can shut it down. */
-	if ((dsp->nfsclds_flags & NFSCLDS_SAMECONN) == 0)
-		nfscl_cancelreqs(dsp);
+	/* And shut the TCP connection down. */
+	nfscl_cancelreqs(dsp);
 }
 
 /*
  * Cancel all RPCs for this "dsp" by closing the connection.
  * Also, mark the session as defunct.
+ * If NFSCLDS_SAMECONN is set, the connection is shared with other DSs and
+ * cannot be shut down.
  */
-static void
+APPLESTATIC void
 nfscl_cancelreqs(struct nfsclds *dsp)
 {
 	struct __rpc_client *cl;



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