The branch main has been updated by rmacklem:

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

commit 8efba70d7914324890b1f8fe3079036eb2b5c3db
Author:     Rick Macklem <rmack...@freebsd.org>
AuthorDate: 2024-04-25 19:32:02 +0000
Commit:     Rick Macklem <rmack...@freebsd.org>
CommitDate: 2024-04-25 19:32:02 +0000

    nfscl: Revert part of commit 196787f79e67
    
    Commit 196787f79e67 erroneously assumed that the client code for
    Open/Claim_deleg_cur_FH was broken, but it was not.
    It was actually wireshark that was broken and indicated
    that the correct XDR was bogus.
    
    This reverts the part of 196787f79e67 that changed the arguments for
    Open/Claim_deleg_cur_FH.
    
    Found during the IETF bakeathon testing event this week.
    
    MFC after:      3 days
---
 sys/fs/nfsclient/nfs_clrpcops.c | 33 ++++++++++-----------------------
 sys/fs/nfsclient/nfs_clstate.c  | 23 +----------------------
 sys/fs/nfsclient/nfsmount.h     |  1 -
 3 files changed, 11 insertions(+), 46 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 09660730d485..75bb5236cb65 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -561,34 +561,21 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t 
*nfhp, int fhlen,
                *tl = txdr_unsigned(delegtype);
        } else {
                if (dp != NULL) {
-                       if (NFSHASNFSV4N(nmp)) {
+                       if (NFSHASNFSV4N(nmp))
                                *tl = txdr_unsigned(
                                    NFSV4OPEN_CLAIMDELEGATECURFH);
-                               NFSLOCKMNT(nmp);
-                               if ((nmp->nm_privflag & NFSMNTP_BUGGYFBSDSRV) !=
-                                   0) {
-                                       NFSUNLOCKMNT(nmp);
-                                       /*
-                                        * Add a stateID argument to make old
-                                        * broken FreeBSD NFSv4.1/4.2 servers
-                                        * happy.
-                                        */
-                                       NFSM_BUILD(tl, uint32_t *,NFSX_STATEID);
-                                       *tl++ = 0;
-                                       *tl++ = dp->nfsdl_stateid.other[0];
-                                       *tl++ = dp->nfsdl_stateid.other[1];
-                                       *tl = dp->nfsdl_stateid.other[2];
-                               } else
-                                       NFSUNLOCKMNT(nmp);
-                       } else {
+                       else
                                *tl = txdr_unsigned(NFSV4OPEN_CLAIMDELEGATECUR);
-                               NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
+                       NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
+                       if (NFSHASNFSV4N(nmp))
+                               *tl++ = 0;
+                       else
                                *tl++ = dp->nfsdl_stateid.seqid;
-                               *tl++ = dp->nfsdl_stateid.other[0];
-                               *tl++ = dp->nfsdl_stateid.other[1];
-                               *tl = dp->nfsdl_stateid.other[2];
+                       *tl++ = dp->nfsdl_stateid.other[0];
+                       *tl++ = dp->nfsdl_stateid.other[1];
+                       *tl = dp->nfsdl_stateid.other[2];
+                       if (!NFSHASNFSV4N(nmp))
                                (void)nfsm_strtom(nd, name, namelen);
-                       }
                } else if (NFSHASNFSV4N(nmp)) {
                        *tl = txdr_unsigned(NFSV4OPEN_CLAIMFH);
                } else {
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index ebc11efea637..9fbaa6e63a56 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -4512,7 +4512,6 @@ nfscl_tryopen(struct nfsmount *nmp, vnode_t vp, u_int8_t 
*fhp, int fhlen,
 {
        int error;
        struct nfscldeleg *dp;
-       bool try_busted_xdr;
 
        dp = *ndpp;
        do {
@@ -4520,29 +4519,9 @@ nfscl_tryopen(struct nfsmount *nmp, vnode_t vp, u_int8_t 
*fhp, int fhlen,
                error = nfsrpc_openrpc(nmp, vp, fhp, fhlen, newfhp, newfhlen,
                    mode, op, name, namelen, ndpp, reclaim, delegtype, cred, p,
                    0, 0);
-               try_busted_xdr = false;
                if (error == NFSERR_DELAY)
                        (void) nfs_catnap(PZERO, error, "nfstryop");
-               else if (error == NFSERR_EXPIRED && NFSHASNFSV4N(nmp) &&
-                   reclaim == 0 && dp != NULL) {
-                       /* This case is a Claim_Deleg_Cur_FH Open. */
-                       NFSLOCKMNT(nmp);
-                       if ((nmp->nm_privflag & NFSMNTP_BUGGYFBSDSRV) == 0) {
-                               /*
-                                * Old FreeBSD NFSv4.1/4.2 servers erroneously
-                                * expect a stateID argument for Open
-                                * Claim_Deleg_Cur_FH and interpret the
-                                * Getattr reply as a stateID.  This results
-                                * in an NFSERR_EXPIRED failure.
-                                * Setting NFSMNTP_BUGGYFBSDSRV makes the Open
-                                * send a stateID, in violation of RFC8881.
-                                */
-                               try_busted_xdr = true;
-                               nmp->nm_privflag |= NFSMNTP_BUGGYFBSDSRV;
-                       }
-                       NFSUNLOCKMNT(nmp);
-               }
-       } while (error == NFSERR_DELAY || try_busted_xdr);
+       } while (error == NFSERR_DELAY);
        if (error == EAUTH || error == EACCES) {
                /* Try again using system credentials */
                newnfs_setroot(cred);
diff --git a/sys/fs/nfsclient/nfsmount.h b/sys/fs/nfsclient/nfsmount.h
index 7571add27b9c..37b84a015dab 100644
--- a/sys/fs/nfsclient/nfsmount.h
+++ b/sys/fs/nfsclient/nfsmount.h
@@ -124,7 +124,6 @@ struct      nfsmount {
 #define        NFSMNTP_DELEGISSUED     0x00000400
 #define        NFSMNTP_NODEALLOCATE    0x00000800
 #define        NFSMNTP_FAKEROOTFH      0x00001000
-#define        NFSMNTP_BUGGYFBSDSRV    0x00002000
 
 /* New mount flags only used by the kernel via nmount(2). */
 #define        NFSMNT_TLS              0x00000001

Reply via email to