Oscar Ou has uploaded this change for review.

View Change

STATE: accept old layout seqid in LAYOUTGET

nfs4_Check_Stateid() applied the ordinary stateid rule to layout
stateids and returned NFS4ERR_OLD_STATEID whenever LAYOUTGET carried a
seqid behind the current one. A client with several LAYOUTGETs in
flight sends each with the seqid it held when it started, so all but
the first were refused.

RFC 5661 exempts layout stateids from that rule. Section 8.2.2:

Except for layout stateids (Section 12.5.3), when a client sends a
stateid to the server, it has two choices with regard to the seqid
sent. [...] the server is required to return NFS4ERR_OLD_STATEID if
the seqid is lower than the most current value and
NFS4ERR_BAD_STATEID if the seqid is greater than the most current
value.

Section 12.5.3:

Given the design goal of pNFS to provide parallelism, the layout
stateid differs from other stateid types in that the client is
expected to send LAYOUTGET and LAYOUTRETURN operations in parallel.

Section 12.5.5.2.1.4:

If the client is sending multiple layout operations to the server
in parallel, by definition, the "seqid" value in the supplied
stateid will not be the current "seqid" as held by the server. The
range of parallelism spans from the highest or current "seqid" to a
"seqid" value in the past. [...]
The server MUST support a minimum VALID_SEQID_RANGE. [...] The
server MAY support a VALID_SEQID_RANGE value larger than the
minimum. The maximum VALID_SEQID_RANGE is (2 ^ 32 - 2) (accounting
for zero not being a valid "seqid" value).

Add a STATEID_SPECIAL_OLD_LAYOUT flag for nfs4_Check_Stateid() and pass
it from LAYOUTGET. With it, a seqid behind the current one on a layout
state is accepted: the maximum range the RFC allows. Seqid zero is
refused as NFS4ERR_BAD_STATEID before this check, and a seqid ahead of
the current one is still NFS4ERR_BAD_STATEID. Every caller that does
not pass the flag keeps the ordinary rule.

This is limited to LAYOUTGET. LAYOUTRETURN keeps returning
NFS4ERR_OLD_STATEID for an old seqid, which section 18.44.3 allows:

NFS4ERR_OLD_STATEID can be returned if the client is using an old
seqid, and the server knows the client should not be using the old
seqid.

A client that gets it refreshes the seqid and resends, as the Linux
client does.

Change-Id: I958b52e6c8ec435b73dd38d0ce8f819597d149ca
Signed-off-by: Oscar Ou <oscarou@synology.com>
---
M src/Protocols/NFS/nfs4_op_layoutget.c
M src/SAL/nfs4_state_id.c
M src/include/sal_functions.h
3 files changed, 16 insertions(+), 6 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/85/1261485/1

To view, visit change 1261485. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I958b52e6c8ec435b73dd38d0ce8f819597d149ca
Gerrit-Change-Number: 1261485
Gerrit-PatchSet: 1
Gerrit-Owner: Oscar Ou <oscarou@synology.com>