git: de5e5c428f49 - stable/13 - nfscl: Do not handle NFSERR_BADSESSION in operation code

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

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

commit de5e5c428f498e481848c8a8290b6469b8b6d329
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:11:24 +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 64bcfbd4f943..dc0b92db97bc 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -8111,7 +8111,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 a4704a04ac22..9d4fe1d1cd7f 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -2767,8 +2767,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();