git: 594821872f8b - stable/12 - nfscl: Do not handle NFSERR_BADSESSION in operation code

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Fri, 10 Jun 2022 22:22:40 UTC
The branch stable/12 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=594821872f8b9db005724a1a298b7502c39cb99e

commit 594821872f8b9db005724a1a298b7502c39cb99e
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-05-27 21:20:31 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-06-10 22:21:47 +0000

    nfscl: Do not handle NFSERR_BADSESSION in operation code
    
    The NFSERR_BADSESSION reply from a NFSv4.1/4.2 server
    is handled by newnfs_request().  It should not be handled
    separately after newnfs_request() has returned.
    
    These two cases were spotted during code inspection.
    One of them should only redo what newnfs_request() already
    did by the same "nfscl" thread.  The other might have
    resulted in recovery being done twice, but the code is
    only used for "pnfs" mounts, so that would be rare.
    Also, since NFSERR_BADSESSION should only be replied by
    a server after the server reboots, this would be extremely
    rare.
    
    (cherry picked from commit 425e5c739bcf190265330b79e85f89eb4d7b5f25)
---
 sys/fs/nfsclient/nfs_clrpcops.c | 2 +-
 sys/fs/nfsclient/nfs_clstate.c  | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index a11a1474207c..01b8eda2e441 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -7610,7 +7610,7 @@ nfsrpc_createlayout(vnode_t dvp, char *name, int namelen, struct vattr *vap,
 	}
 	if (nd->nd_repstat != 0 && error == 0)
 		error = nd->nd_repstat;
-	if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION)
+	if (error == NFSERR_STALECLIENTID)
 		nfscl_initiate_recovery(owp->nfsow_clp);
 nfsmout:
 	NFSCL_DEBUG(4, "eo nfsrpc_createlayout err=%d\n", error);
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index da43c883cbe5..388529c8047a 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -2659,8 +2659,7 @@ nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T *p)
 			error = nfsrpc_renew(clp, NULL, cred, p);
 			if (error == NFSERR_CBPATHDOWN)
 			    cbpathdown = 1;
-			else if (error == NFSERR_STALECLIENTID ||
-			    error == NFSERR_BADSESSION) {
+			else if (error == NFSERR_STALECLIENTID) {
 			    NFSLOCKCLSTATE();
 			    clp->nfsc_flags |= NFSCLFLAGS_RECOVER;
 			    NFSUNLOCKCLSTATE();