Date: Sat, 4 Nov 2017 21:30:27 +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-10@freebsd.org Subject: svn commit: r325407 - stable/10/sys/fs/nfs Message-ID: <201711042130.vA4LURpL073777@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Sat Nov 4 21:30:27 2017 New Revision: 325407 URL: https://svnweb.freebsd.org/changeset/base/325407 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/10/sys/fs/nfs/nfs_commonkrpc.c stable/10/sys/fs/nfs/nfsclstate.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonkrpc.c Sat Nov 4 21:06:39 2017 (r325406) +++ stable/10/sys/fs/nfs/nfs_commonkrpc.c Sat Nov 4 21:30:27 2017 (r325407) @@ -1120,9 +1120,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/10/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/10/sys/fs/nfs/nfsclstate.h Sat Nov 4 21:06:39 2017 (r325406) +++ stable/10/sys/fs/nfs/nfsclstate.h Sat Nov 4 21:30:27 2017 (r325407) @@ -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?201711042130.vA4LURpL073777>