Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jun 2018 23:08:54 +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: r335309 - head/sys/fs/nfs
Message-ID:  <201806172308.w5HN8s3B000298@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sun Jun 17 23:08:54 2018
New Revision: 335309
URL: https://svnweb.freebsd.org/changeset/base/335309

Log:
  Revert r335263, since it can cause crashes in unusual circumstances.
  This needs to be fixed in a different way.

Modified:
  head/sys/fs/nfs/nfs_commonkrpc.c

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonkrpc.c	Sun Jun 17 22:09:43 2018	(r335308)
+++ head/sys/fs/nfs/nfs_commonkrpc.c	Sun Jun 17 23:08:54 2018	(r335309)
@@ -157,9 +157,6 @@ static int nfsv2_procid[NFS_V3NPROCS] = {
 /*
  * Initialize sockets and congestion for a new NFS connection.
  * We do not free the sockaddr if error.
- * Which arguments are set to NULL indicate what kind of call it is.
- * cred == NULL --> a call to connect to a pNFS DS
- * nmp == NULL --> indicates an upcall to userland or a NFSv4 callback
  */
 int
 newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
@@ -296,38 +293,24 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
 				retries = nmp->nm_retry;
 		} else
 			retries = INT_MAX;
-		if (NFSHASNFSV4N(nmp)) {
-			if (cred != NULL) {
-				/*
-				 * Make sure the nfscbd_pool doesn't get
-				 * destroyed while doing this.
-				 */
-				NFSD_LOCK();
-				if (nfs_numnfscbd > 0) {
-					nfs_numnfscbd++;
-					NFSD_UNLOCK();
-					xprt = svc_vc_create_backchannel(
-					    nfscbd_pool);
-					CLNT_CONTROL(client, CLSET_BACKCHANNEL,
-					    xprt);
-					NFSD_LOCK();
-					nfs_numnfscbd--;
-					if (nfs_numnfscbd == 0)
-						wakeup(&nfs_numnfscbd);
-				}
+		/* cred == NULL for DS connects. */
+		if (NFSHASNFSV4N(nmp) && cred != NULL) {
+			/*
+			 * Make sure the nfscbd_pool doesn't get destroyed
+			 * while doing this.
+			 */
+			NFSD_LOCK();
+			if (nfs_numnfscbd > 0) {
+				nfs_numnfscbd++;
 				NFSD_UNLOCK();
-			} else {
-				/*
-				 * cred == NULL for a DS connect.
-				 * For connects to a DS, set a retry limit
-				 * so that failed DSs will be detected.
-				 * This is ok for NFSv4.1, since a DS does
-				 * not maintain open/lock state and is the
-				 * only case where using a "soft" mount is
-				 * recommended for NFSv4.
-				 */
-				retries = 2;
+				xprt = svc_vc_create_backchannel(nfscbd_pool);
+				CLNT_CONTROL(client, CLSET_BACKCHANNEL, xprt);
+				NFSD_LOCK();
+				nfs_numnfscbd--;
+				if (nfs_numnfscbd == 0)
+					wakeup(&nfs_numnfscbd);
 			}
+			NFSD_UNLOCK();
 		}
 	} else {
 		/*
@@ -779,7 +762,6 @@ tryagain:
 	else
 		stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum,
 		    nd->nd_mreq, &nd->nd_mrep, timo);
-	NFSCL_DEBUG(2, "clnt call=%d\n", stat);
 
 	if (rep != NULL) {
 		/*
@@ -807,60 +789,6 @@ tryagain:
 		error = EPROTONOSUPPORT;
 	} else if (stat == RPC_INTR) {
 		error = EINTR;
-	} else if (stat == RPC_CANTSEND || stat == RPC_CANTRECV ||
-	     stat == RPC_SYSTEMERROR) {
-		if ((nd->nd_flag & ND_NFSV41) != 0 && nmp != NULL &&
-		    nd->nd_procnum != NFSPROC_NULL) {
-			/*
-			 * The nfsess_defunct field is protected by
-			 * the NFSLOCKMNT()/nm_mtx lock and not the
-			 * nfsess_mtx lock to simplify its handling,
-			 * for the MDS session. This lock is also
-			 * sufficient for nfsess_sessionid, since it
-			 * never changes in the structure.
-			 */
-			NFSLOCKCLSTATE();
-			NFSLOCKMNT(nmp);
-			/* The session must be marked defunct. */
-			if (dssep == NULL) {
-				/*
-				 * This is either an MDS proxy operation or
-				 * a client mount with "soft,retrans=N" options.
-				 * Mark the MDS session defunct and initiate
-				 * recovery, as required.
-				 */
-				NFSCL_DEBUG(1, "Failed soft proxy RPC\n");
-				sep = NFSMNT_MDSSESSION(nmp);
-				if (bcmp(sep->nfsess_sessionid, nd->nd_sequence,
-				    NFSX_V4SESSIONID) == 0) {
-					/* Initiate recovery. */
-					sep->nfsess_defunct = 1;
-					NFSCL_DEBUG(1, "Marked defunct\n");
-					if (nmp->nm_clp != NULL) {
-						nmp->nm_clp->nfsc_flags |=
-						    NFSCLFLAGS_RECOVER;
-						wakeup(nmp->nm_clp);
-					}
-				}
-			} else {
-				/*
-				 * This is a client side DS RPC. Just mark
-				 * the session defunct.  A subsequent LayoutGet
-				 * should get a new session.
-				 */
-				NFSCL_DEBUG(1, "Failed client DS RPC\n");
-				if (bcmp(dssep->nfsess_sessionid,
-				    nd->nd_sequence, NFSX_V4SESSIONID) == 0) {
-					/* Mark it defunct. */
-					dssep->nfsess_defunct = 1;
-					NFSCL_DEBUG(1, "Marked defunct\n");
-				}
-			}
-			NFSUNLOCKMNT(nmp);
-			NFSUNLOCKCLSTATE();
-		}
-		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
-		error = ENXIO;
 	} else {
 		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
 		error = EACCES;



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