Skip to content

Commit 9228395

Browse files
trondmyamschuma-ntap
authored andcommitted
NFSv4: Add a helper to increment stateid seqids
Add a helper function to increment stateid seqids according to the rules specified in RFC5661 Section 8.2.2. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 6109bcf commit 9228395

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/nfs/nfs4_fs.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,15 @@ static inline bool nfs4_stateid_is_newer(const nfs4_stateid *s1, const nfs4_stat
574574
return (s32)(be32_to_cpu(s1->seqid) - be32_to_cpu(s2->seqid)) > 0;
575575
}
576576

577+
static inline void nfs4_stateid_seqid_inc(nfs4_stateid *s1)
578+
{
579+
u32 seqid = be32_to_cpu(s1->seqid);
580+
581+
if (++seqid == 0)
582+
++seqid;
583+
s1->seqid = cpu_to_be32(seqid);
584+
}
585+
577586
static inline bool nfs4_valid_open_stateid(const struct nfs4_state *state)
578587
{
579588
return test_bit(NFS_STATE_RECOVERY_FAILED, &state->flags) == 0;

0 commit comments

Comments
 (0)