git: c5e3beac7b80 - stable/13 - nfscl: Fix processing of a rare Rename reply case

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Sun, 17 Dec 2023 21:02:33 UTC
The branch stable/13 has been updated by rmacklem:

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

commit c5e3beac7b80483b41492e021bbd43242528424e
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-12-03 23:31:01 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-12-17 21:01:34 +0000

    nfscl: Fix processing of a rare Rename reply case
    
    When delegations are enabled (they are not by default in
    the FreeBSD NFSv4 server), rename will check for and return
    delegations.  If the second of these DelegReturn operations
    were to fail (they rarely do), then the code would not retry
    the rename with returning delegations, as it is intended to do.
    
    The patch fixes the problem, since the DelegReturn reply status
    is the second iteration of the loop and not the first iteration.
    
    As noted, this bug would have rarely manifested a problem, since
    DelegReturn operations do not normally fail.
    
    (cherry picked from commit 6aded1e6b2e5549120031032e1c7f8b002882327)
---
 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 63b9f7755fd3..41c397100497 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -2719,7 +2719,7 @@ tryagain:
 			    ND_NFSV4) {
 			    NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 			    if (*(tl + 1)) {
-				if (i == 0 && ret > 1) {
+				if (i == 1 && ret > 1) {
 				    /*
 				     * If the Delegreturn failed, try again
 				     * without it. The server will Recall, as