[pnfs] [PATCH 2/2] Update stateid generation number handling per latest draft
Sager, Mike
Mike.Sager at netapp.com
Wed Sep 12 15:33:32 EDT 2007
If the generation number is 0, use the current generation number. Also,
reinstate generation number checking for bad or old stateids.
Signed-off-by: Mike Sager <sager at netapp.com>
---
fs/nfsd/nfs4state.c | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index b364707..be3600b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2762,15 +2762,22 @@ nfs4_preprocess_stateid_op(struct svc_fh
*current_fh, stateid_t *stateid, int fl
goto out;
stidp = &stp->st_stateid;
}
- if (flags & NFS_4_1 && stateid->si_generation !=0 )
- goto out;
- if (!(flags & NFS_4_1) && stateid->si_generation >
stidp->si_generation)
+ /*
+ * In 4.1, if the stateid's generation number is 0, use the
+ * current generation
+ */
+ if ((flags & NFS_4_1) && stateid->si_generation == 0)
+ goto checkmode;
+
+ if (stateid->si_generation > stidp->si_generation)
goto out;
/* OLD STATEID */
status = nfserr_old_stateid;
- if (!(flags & NFS_4_1) && stateid->si_generation <
stidp->si_generation)
+ if (stateid->si_generation < stidp->si_generation)
goto out;
+
+checkmode:
if (stp) {
if ((status =
nfs4_check_openmode(stp->st_access_bmap,flags)))
goto out;
@@ -2894,12 +2901,12 @@ nfs4_preprocess_seqid_op(struct svc_fh
*current_fh, u32 seqid, stateid_t *statei
return nfserr_bad_stateid;
}
- if (sop->so_minorversion == 1) {
- if (stateid->si_generation != 0)
- return nfserr_bad_stateid;
- else
- goto renew; /* skip v4.0 generation number
checks */
- }
+ /*
+ * In 4.1, if the stateid's generation number is 0, use the
+ * current generation
+ */
+ if (sop->so_minorversion == 1 && stateid->si_generation == 0)
+ goto renew;
if (stateid->si_generation > stp->st_stateid.si_generation) {
printk("NFSD: preprocess_seqid_op: future stateid?!\n");
--
1.5.2.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linux-nfs.org/pipermail/pnfs/attachments/20070912/cc19a964/attachment.htm
More information about the pNFS
mailing list