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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to