Commit f6d82485 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd4: fix sessions slotid wraparound logic

From RFC 5661 2.10.6.1: "If the previous sequence ID was 0xFFFFFFFF,
then the next request for the slot MUST have the sequence ID set to
zero."

While we're there, delete some redundant comments.
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 508f9227
...@@ -1575,16 +1575,11 @@ check_slot_seqid(u32 seqid, u32 slot_seqid, int slot_inuse) ...@@ -1575,16 +1575,11 @@ check_slot_seqid(u32 seqid, u32 slot_seqid, int slot_inuse)
else else
return nfserr_seq_misordered; return nfserr_seq_misordered;
} }
/* Normal */ /* Note unsigned 32-bit arithmetic handles wraparound: */
if (likely(seqid == slot_seqid + 1)) if (likely(seqid == slot_seqid + 1))
return nfs_ok; return nfs_ok;
/* Replay */
if (seqid == slot_seqid) if (seqid == slot_seqid)
return nfserr_replay_cache; return nfserr_replay_cache;
/* Wraparound */
if (seqid == 1 && (slot_seqid + 1) == 0)
return nfs_ok;
/* Misordered replay or misordered new request */
return nfserr_seq_misordered; return nfserr_seq_misordered;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment