Author: rmacklem
Date: Tue Apr 11 22:47:02 2017
New Revision: 316719
URL: https://svnweb.freebsd.org/changeset/base/316719

Log:
  Don't throw away Open state when a NFSv4.1 client recovery fails.
  
  If the ExchangeID/CreateSession operations done by an NFSv4.1 client
  after the server crashes/reboots fails, it is possible that some 
process/thread
  is waiting for an open_owner lock. If the client state is free'd, this
  can cause a crash.
  This would not normally happen, but has been observed on a mount of the
  AmazonEFS service.
  
  Reported by:  cperciva
  Tested by:    cperciva
  PR:           216086
  MFC after:    2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clstate.c Tue Apr 11 21:55:39 2017        
(r316718)
+++ head/sys/fs/nfsclient/nfs_clstate.c Tue Apr 11 22:47:02 2017        
(r316719)
@@ -1934,10 +1934,9 @@ nfscl_recover(struct nfsclclient *clp, s
             error == NFSERR_BADSESSION ||
             error == NFSERR_STALEDONTRECOVER) && --trycnt > 0);
        if (error) {
-               nfscl_cleanclient(clp);
                NFSLOCKCLSTATE();
-               clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID |
-                   NFSCLFLAGS_RECOVER | NFSCLFLAGS_RECVRINPROG);
+               clp->nfsc_flags &= ~(NFSCLFLAGS_RECOVER |
+                   NFSCLFLAGS_RECVRINPROG);
                wakeup(&clp->nfsc_flags);
                nfsv4_unlock(&clp->nfsc_lock, 0);
                NFSUNLOCKCLSTATE();
@@ -2254,13 +2253,8 @@ nfscl_hasexpired(struct nfsclclient *clp
             error == NFSERR_BADSESSION ||
             error == NFSERR_STALEDONTRECOVER) && --trycnt > 0);
        if (error) {
-               /*
-                * Clear out any state.
-                */
-               nfscl_cleanclient(clp);
                NFSLOCKCLSTATE();
-               clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID |
-                   NFSCLFLAGS_RECOVER);
+               clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER;
        } else {
                /*
                 * Expire the state for the client.
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to