aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2024-04-25 16:41:23 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2024-04-25 16:41:23 +0000
commit54c3aa02e926268ba5551cd7d28fddf38b3589a2 (patch)
tree4f8398cffe46fbb985baac1918380451c83185af
parent514773a5486d1fa4f2d5acb5af1766965c20765b (diff)
downloadsrc-54c3aa02e926268ba5551cd7d28fddf38b3589a2.tar.gz
src-54c3aa02e926268ba5551cd7d28fddf38b3589a2.zip
Revert "nfsd: Fix NFSv4.1/4.2 Claim_Deleg_Cur_FH"
This reverts commit f300335d9aebf2e99862bf783978bd44ede23550. It turns out that the old code was correct and it was wireshark that was broken and indicated that the RPC's XDR was bogus. Found during IETF bakeathon testing this week.
-rw-r--r--sys/fs/nfsserver/nfs_nfsdserv.c10
-rw-r--r--sys/fs/nfsserver/nfs_nfsdstate.c16
2 files changed, 6 insertions, 20 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index 899e88508b60..8141ee6cbdb6 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -3003,18 +3003,12 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram,
*/
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
claim = fxdr_unsigned(int, *tl);
- if (claim == NFSV4OPEN_CLAIMDELEGATECUR) {
+ if (claim == NFSV4OPEN_CLAIMDELEGATECUR || claim ==
+ NFSV4OPEN_CLAIMDELEGATECURFH) {
NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID);
stateid.seqid = fxdr_unsigned(u_int32_t, *tl++);
NFSBCOPY((caddr_t)tl,(caddr_t)stateid.other,NFSX_STATEIDOTHER);
stp->ls_flags |= NFSLCK_DELEGCUR;
- } else if (claim == NFSV4OPEN_CLAIMDELEGATECURFH) {
- /* Fill in most of the stateid from the clientid. */
- stateid.seqid = 0;
- stateid.other[0] = clientid.lval[0];
- stateid.other[1] = clientid.lval[1];
- stateid.other[2] = 0;
- stp->ls_flags |= NFSLCK_DELEGCUR;
} else if (claim == NFSV4OPEN_CLAIMDELEGATEPREV || claim ==
NFSV4OPEN_CLAIMDELEGATEPREVFH) {
stp->ls_flags |= NFSLCK_DELEGPREV;
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index da57ebde7a52..c73840277022 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -2568,10 +2568,6 @@ tryagain:
/*
* For Delegate_Cur, search for the matching Delegation,
* which indicates no conflict.
- * For NFSv4.1/4.2 Claim_Deleg_Cur_FH only provides
- * the clientid, which is the first two "other" elements
- * for the stateid. This should be sufficient, since there
- * is only one delegation per client and file.
* An old delegation should have been recovered by the
* client doing a Claim_DELEGATE_Prev, so I won't let
* it match and return NFSERR_EXPIRED. Should I let it
@@ -2582,8 +2578,8 @@ tryagain:
(((nd->nd_flag & ND_NFSV41) != 0 &&
stateidp->seqid == 0) ||
stateidp->seqid == stp->ls_stateid.seqid) &&
- stateidp->other[0] == stp->ls_stateid.other[0] &&
- stateidp->other[1] == stp->ls_stateid.other[1])
+ !NFSBCMP(stateidp->other, stp->ls_stateid.other,
+ NFSX_STATEIDOTHER))
break;
}
if (stp == LIST_END(&lfp->lf_deleg) ||
@@ -2834,10 +2830,6 @@ tryagain:
/*
* For Delegate_Cur, search for the matching Delegation,
* which indicates no conflict.
- * For NFSv4.1/4.2 Claim_Deleg_Cur_FH only provides
- * the clientid, which is the first two "other" elements
- * for the stateid. This should be sufficient, since there
- * is only one delegation per client and file.
* An old delegation should have been recovered by the
* client doing a Claim_DELEGATE_Prev, so I won't let
* it match and return NFSERR_EXPIRED. Should I let it
@@ -2848,8 +2840,8 @@ tryagain:
(((nd->nd_flag & ND_NFSV41) != 0 &&
stateidp->seqid == 0) ||
stateidp->seqid == stp->ls_stateid.seqid) &&
- stateidp->other[0] == stp->ls_stateid.other[0] &&
- stateidp->other[1] == stp->ls_stateid.other[1])
+ !NFSBCMP(stateidp->other, stp->ls_stateid.other,
+ NFSX_STATEIDOTHER))
break;
}
if (stp == LIST_END(&lfp->lf_deleg) ||