From owner-svn-src-all@freebsd.org Wed Apr 26 22:11:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D23DED510B0; Wed, 26 Apr 2017 22:11:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9566218A; Wed, 26 Apr 2017 22:11:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QMBiKj098805; Wed, 26 Apr 2017 22:11:44 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QMBiPY098804; Wed, 26 Apr 2017 22:11:44 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262211.v3QMBiPY098804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 26 Apr 2017 22:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317467 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:11:45 -0000 Author: rmacklem Date: Wed Apr 26 22:11:44 2017 New Revision: 317467 URL: https://svnweb.freebsd.org/changeset/base/317467 Log: MFC: r316717 During a server crash recovery, fix the NFSv4.1 client for a NFSERR_BADSESSION during recovery. If the NFSv4.1 client gets a NFSv4.1 NFSERR_BADSESSION reply to an Open/Lock operation while recovering from the server crash/reboot, allow the opens to be retained for a subsequent recovery attempt. Since NFSv4.1 servers should only reply NFSERR_BADSESSION after a crash/reboot that has lost state, this case should almost never happen. However, for the AmazonEFS file service, this has been observed when the client does a fresh TCP connection for RPCs. Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:04:55 2017 (r317466) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:11:44 2017 (r317467) @@ -1981,7 +1981,7 @@ nfscl_recover(struct nfsclclient *clp, s op = LIST_FIRST(&owp->nfsow_open); while (op != NULL) { nop = LIST_NEXT(op, nfso_list); - if (error != NFSERR_NOGRACE) { + if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) { /* Search for a delegation to reclaim with the open */ TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { if (!(dp->nfsdl_flags & NFSCLDL_NEEDRECLAIM)) @@ -2050,11 +2050,10 @@ nfscl_recover(struct nfsclclient *clp, s len = NFS64BITSSET; else len = lop->nfslo_end - lop->nfslo_first; - if (error != NFSERR_NOGRACE) - error = nfscl_trylock(nmp, NULL, - op->nfso_fh, op->nfso_fhlen, lp, - firstlock, 1, lop->nfslo_first, len, - lop->nfslo_type, tcred, p); + error = nfscl_trylock(nmp, NULL, + op->nfso_fh, op->nfso_fhlen, lp, + firstlock, 1, lop->nfslo_first, len, + lop->nfslo_type, tcred, p); if (error != 0) nfscl_freelock(lop, 0); else @@ -2066,10 +2065,10 @@ nfscl_recover(struct nfsclclient *clp, s nfscl_freelockowner(lp, 0); lp = nlp; } - } else { - nfscl_freeopen(op, 0); } } + if (error != 0 && error != NFSERR_BADSESSION) + nfscl_freeopen(op, 0); op = nop; } owp = nowp; @@ -2100,7 +2099,7 @@ nfscl_recover(struct nfsclclient *clp, s nfscl_lockinit(&nowp->nfsow_rwlock); } nop = NULL; - if (error != NFSERR_NOGRACE) { + if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) { MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) + dp->nfsdl_fhlen - 1, M_NFSCLOPEN, M_WAITOK); nop->nfso_own = nowp;