Revert "nfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661"

This reverts commit 9edaceca81.

It turns out that the Linux client intentionally does an NFSv4.1
RPC with only a Sequence operation in it and with "seqid + 1"
for the slot.  This is used to re-synchronize the slot's seqid
and the client expects the NFS4ERR_SEQ_MISORDERED error reply.

As such, revert the patch, so that the server remains RFC5661
compliant.
This commit is contained in:
Rick Macklem 2021-04-15 14:08:40 -07:00
parent 6b8ef0d428
commit 34256484af

View File

@ -98,11 +98,6 @@ int nfs_maxcopyrange = 10 * 1024 * 1024;
SYSCTL_INT(_vfs_nfs, OID_AUTO, maxcopyrange, CTLFLAG_RW,
&nfs_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable");
static int nfs_allowskip_sessionseq = 1;
SYSCTL_INT(_vfs_nfs, OID_AUTO, linuxseqsesshack, CTLFLAG_RW,
&nfs_allowskip_sessionseq, 0, "Allow client to skip ahead one seq# for"
" session slot");
/*
* This array of structures indicates, for V4:
* retfh - which of 3 types of calling args are used
@ -4619,7 +4614,7 @@ nfsv4_getipaddr(struct nfsrv_descript *nd, struct sockaddr_in *sin,
* Handle an NFSv4.1 Sequence request for the session.
* If reply != NULL, use it to return the cached reply, as required.
* The client gets a cached reply via this call for callbacks, however the
* server gets a cached reply via the nfsv4_seqsess_cacherep() call.
* server gets a cached reply via the nfsv4_seqsess_cachereply() call.
*/
int
nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot,
@ -4653,24 +4648,12 @@ nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot,
} else
/* No reply cached, so just do it. */
slots[slotid].nfssl_inprog = 1;
} else if (slots[slotid].nfssl_seq + 1 == seqid ||
(slots[slotid].nfssl_seq + 2 == seqid &&
nfs_allowskip_sessionseq != 0)) {
/*
* Allowing the seqid to be ahead by 2 is technically
* a violation of RFC5661, but it seems harmless to do
* and avoids returning NFSERR_SEQMISORDERED to a
* slightly broken Linux NFSv4.1/4.2 client.
* If the RPCs are really out of order, one with a
* lower seqid will be subsequently received and that
* one will get a NFSERR_SEQMISORDERED reply.
* Can be disabled by setting vfs.nfs.linuxseqsesshack to 0.
*/
} else if ((slots[slotid].nfssl_seq + 1) == seqid) {
if (slots[slotid].nfssl_reply != NULL)
m_freem(slots[slotid].nfssl_reply);
slots[slotid].nfssl_reply = NULL;
slots[slotid].nfssl_inprog = 1;
slots[slotid].nfssl_seq = seqid;
slots[slotid].nfssl_seq++;
} else
error = NFSERR_SEQMISORDERED;
return (error);