summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4_fs.h
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2019-09-20 13:23:44 +0200
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-09-20 21:44:45 +0200
commit922839570920c024baf740ef45dfa98009f0192e (patch)
treef77cbcca0b1d3379af7c5162383cc3ed7f7e75c7 /fs/nfs/nfs4_fs.h
parentNFSv4: Handle RPC level errors in LAYOUTRETURN (diff)
downloadlinux-922839570920c024baf740ef45dfa98009f0192e.tar.xz
linux-922839570920c024baf740ef45dfa98009f0192e.zip
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>
Diffstat (limited to 'fs/nfs/nfs4_fs.h')
-rw-r--r--fs/nfs/nfs4_fs.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 3564da1ba8a1..e8f74ed98e42 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -574,6 +574,15 @@ static inline bool nfs4_stateid_is_newer(const nfs4_stateid *s1, const nfs4_stat
return (s32)(be32_to_cpu(s1->seqid) - be32_to_cpu(s2->seqid)) > 0;
}
+static inline void nfs4_stateid_seqid_inc(nfs4_stateid *s1)
+{
+ u32 seqid = be32_to_cpu(s1->seqid);
+
+ if (++seqid == 0)
+ ++seqid;
+ s1->seqid = cpu_to_be32(seqid);
+}
+
static inline bool nfs4_valid_open_stateid(const struct nfs4_state *state)
{
return test_bit(NFS_STATE_RECOVERY_FAILED, &state->flags) == 0;