git: 9bbf57a2ad46 - stable/13 - nfscl: Fix CreateSession for an established ClientID

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Thu, 28 Jul 2022 20:22:21 UTC
The branch stable/13 has been updated by rmacklem:

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

commit 9bbf57a2ad4666371d8de3cde0a9b8879e826590
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-07-11 23:50:34 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-07-28 20:18:49 +0000

    nfscl: Fix CreateSession for an established ClientID
    
    Commit 981ef32230b2 added optional use of the session
    slots marked bad to recover a new session when all
    slots are marked bad.  The recovery worked against
    a FreeBSD NFSv4.1/4.2 server, but not a Linux one.
    It turns out that it was a bug in the FreeBSD client
    and not the Linux server.
    
    This patch fixes the client so that DeleteSession
    followed by CreateSession after receiving a
    NFSERR_BADSESSION error reply works against the
    Linux server (and conforms to the RFC).
    
    This also implies that the FreeBSD NFSv4.1/4.2
    server needs to be fixed in a future commit.
    Without the fix, the FreeBSD server does a full
    recovery, including creation of a new ClientID,
    but since "intr" mounts were broken, this does
    not result in a regression.
    
    This patch only affects the case where a CreateSession
    is done for an already confirmed ClientID, which was
    not being done prior to commit 981ef32230b2.
    
    PR: 260011
    (cherry picked from commit d4a11b3e3bddb1fa3bdd101e12aea6f5937356fa)
---
 sys/fs/nfsclient/nfs_clrpcops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 529655cfe5ca..51c7bb25d357 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -988,7 +988,7 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclclient *clp, int reclaim,
 			dsp->nfsclds_sess.nfsess_clientid =
 			    odsp->nfsclds_sess.nfsess_clientid;
 			dsp->nfsclds_sess.nfsess_sequenceid =
-			    odsp->nfsclds_sess.nfsess_sequenceid;
+			    odsp->nfsclds_sess.nfsess_sequenceid + 1;
 			dsp->nfsclds_flags = odsp->nfsclds_flags;
 			if (dsp->nfsclds_servownlen > 0)
 				memcpy(dsp->nfsclds_serverown,