git: 71ccbf895655 - stable/14 - nfscl: Fix processing of a rare Rename reply case

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Sun, 17 Dec 2023 20:31:36 UTC
The branch stable/14 has been updated by rmacklem:

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

commit 71ccbf8956556962e6199ca277afe16f76a9a1fc
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-12-03 23:31:01 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-12-17 20:30:18 +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 c986b3927f1b..42264c947f32 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -3006,7 +3006,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