Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Oct 2017 19:27:12 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r324997 - stable/11/sys/fs/nfs
Message-ID:  <201710251927.v9PJRCpg021965@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Wed Oct 25 19:27:12 2017
New Revision: 324997
URL: https://svnweb.freebsd.org/changeset/base/324997

Log:
  MFC: r324506
  Fix forced dismount when a pNFS mount is hung on a DS.
  
  When a "pnfs" NFSv4.1 mount is hung because of an unresponsive DS,
  a forced dismount wouldn't work, because the RPC socket for the DS
  was not being closed. This patch fixes this.
  This will only affect "pnfs" mounts where the pNFS server's DS
  is unresponsive (crashed or network partitioned or...).
  Found during testing of the pNFS server.

Modified:
  stable/11/sys/fs/nfs/nfs_commonkrpc.c
  stable/11/sys/fs/nfs/nfsclstate.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- stable/11/sys/fs/nfs/nfs_commonkrpc.c	Wed Oct 25 19:21:48 2017	(r324996)
+++ stable/11/sys/fs/nfs/nfs_commonkrpc.c	Wed Oct 25 19:27:12 2017	(r324997)
@@ -1119,9 +1119,29 @@ nfsmout:
 int
 newnfs_nmcancelreqs(struct nfsmount *nmp)
 {
+	struct nfsclds *dsp;
+	struct __rpc_client *cl;
 
 	if (nmp->nm_sockreq.nr_client != NULL)
 		CLNT_CLOSE(nmp->nm_sockreq.nr_client);
+lookformore:
+	NFSLOCKMNT(nmp);
+	TAILQ_FOREACH(dsp, &nmp->nm_sess, nfsclds_list) {
+		NFSLOCKDS(dsp);
+		if (dsp != TAILQ_FIRST(&nmp->nm_sess) &&
+		    (dsp->nfsclds_flags & NFSCLDS_CLOSED) == 0 &&
+		    dsp->nfsclds_sockp != NULL &&
+		    dsp->nfsclds_sockp->nr_client != NULL) {
+			dsp->nfsclds_flags |= NFSCLDS_CLOSED;
+			cl = dsp->nfsclds_sockp->nr_client;
+			NFSUNLOCKDS(dsp);
+			NFSUNLOCKMNT(nmp);
+			CLNT_CLOSE(cl);
+			goto lookformore;
+		}
+		NFSUNLOCKDS(dsp);
+	}
+	NFSUNLOCKMNT(nmp);
 	return (0);
 }
 

Modified: stable/11/sys/fs/nfs/nfsclstate.h
==============================================================================
--- stable/11/sys/fs/nfs/nfsclstate.h	Wed Oct 25 19:21:48 2017	(r324996)
+++ stable/11/sys/fs/nfs/nfsclstate.h	Wed Oct 25 19:27:12 2017	(r324997)
@@ -91,6 +91,7 @@ struct nfsclds {
 #define	NFSCLDS_HASWRITEVERF	0x0001
 #define	NFSCLDS_MDS		0x0002
 #define	NFSCLDS_DS		0x0004
+#define	NFSCLDS_CLOSED		0x0008
 
 struct nfsclclient {
 	LIST_ENTRY(nfsclclient) nfsc_list;



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