Oscar Ou has uploaded this change for review.

View Change

STATE: return NFS4ERR_BAD_STATEID for a layout stateid with seqid zero

nfs4_Check_Stateid() compares every layout stateid's seqid with the
current one, so seqid zero came out as "behind" and was answered with
NFS4ERR_OLD_STATEID. For a layout stateid zero is not an old seqid but
an invalid one, and RFC 5661 names the error for it.

Section 12.5.3:

The "seqid" field is initially set to one, and is never zero on any
NFSv4.1 operation that uses layout stateids, whether it is a fore
channel or backchannel operation.

Section 12.5.5.2.1.4:

If the server finds the "seqid" is zero, the NFS4ERR_BAD_STATEID
error is returned to the client.

Section 18.44.3 (LAYOUTRETURN):

The client uses the precise lora_recallstateid value and MUST NOT
set the stateid's seqid to zero; otherwise, NFS4ERR_BAD_STATEID MUST
be returned.

A layout state found with seqid zero now fails with
NFS4ERR_BAD_STATEID before the seqid comparison, for every operation
that takes a layout stateid. The special stateids are matched by their
"other" field earlier and are not affected.

Change-Id: I51ea27b31d461b52ab21cd63790396231516a183
Signed-off-by: Oscar Ou <oscarou@synology.com>
---
M src/SAL/nfs4_state_id.c
1 file changed, 14 insertions(+), 0 deletions(-)

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

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

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