nfsd: Add support for CLAIM_DELEG_CUR_FH to the NFSv4.1/4.2 Open

The Linux NFSv4.1/4.2 client now uses the CLAIM_DELEG_CUR_FH
variant of the Open operation when delegations are recalled and
the client has a local open of the file.  This patch adds
support for this variant of Open to the NFSv4.1/4.2 server.

This patch only affects mounts from Linux clients when delegations
are enabled on the server.

MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2021-05-18 15:53:54 -07:00
parent 3d846e4822
commit b3d4c70dc6

View File

@ -2981,7 +2981,8 @@ 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);
@ -3056,7 +3057,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram,
&exclusive_flag, &nva, cverf, create, aclp, &attrbits,
nd->nd_cred, exp, &vp);
} else if (claim == NFSV4OPEN_CLAIMPREVIOUS || claim ==
NFSV4OPEN_CLAIMFH) {
NFSV4OPEN_CLAIMFH || claim == NFSV4OPEN_CLAIMDELEGATECURFH) {
if (claim == NFSV4OPEN_CLAIMPREVIOUS) {
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
i = fxdr_unsigned(int, *tl);
@ -3074,7 +3075,6 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram,
}
stp->ls_flags |= NFSLCK_RECLAIM;
} else {
/* CLAIM_NULL_FH */
if (nd->nd_repstat == 0 && create == NFSV4OPEN_CREATE)
nd->nd_repstat = NFSERR_INVAL;
}