Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Oct 2017 21:05:40 +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: r324506 - head/sys/fs/nfs
Message-ID:  <201710102105.v9AL5eCu085989@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Tue Oct 10 21:05:40 2017
New Revision: 324506
URL: https://svnweb.freebsd.org/changeset/base/324506

Log:
  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.
  
  MFC after:	2 weeks

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

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonkrpc.c	Tue Oct 10 21:04:40 2017	(r324505)
+++ head/sys/fs/nfs/nfs_commonkrpc.c	Tue Oct 10 21:05:40 2017	(r324506)
@@ -1121,9 +1121,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: head/sys/fs/nfs/nfsclstate.h
==============================================================================
--- head/sys/fs/nfs/nfsclstate.h	Tue Oct 10 21:04:40 2017	(r324505)
+++ head/sys/fs/nfs/nfsclstate.h	Tue Oct 10 21:05:40 2017	(r324506)
@@ -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?201710102105.v9AL5eCu085989>