[pnfs] [PATCH 2/2] Update stateid generation number handling per latest draft
Sager, Mike
Mike.Sager at netapp.com
Tue Sep 18 12:31:11 EDT 2007
Hi Andy,
My interpretation of this case comes from the start of the last
paragraph in 8.2.2:
"When stateids are sent to the server by the client, it has two choices
with regard to the seqid sent. It may set the seqid to zero to indicate
to the server that it wishes the most up-to-date seqid for that
stateid's "other" field to be used. This would be the common choice in
the case of stateid sent with a READ or WRITE operation."
Mike
-----Original Message-----
From: William A. (Andy) Adamson [mailto:andros at citi.umich.edu]
Sent: Tuesday, September 18, 2007 7:01 AM
To: Sager, Mike
Cc: pnfs at linux-nfs.org
Subject: Fwd: [pnfs] [PATCH 2/2] Update stateid generation
number handling per latest draft
Hi
I'm still not clear on parts of this patch.
>From my understanding on the discussion of this issue at the
Austin bakeathon, the 4.1 server is supposed to treat the 32 bit stateid
seqid just like the 4.0 server, to provide the 4.1 client an ordering of
server execution when the client "sprays" OPENs (or LOCK) across
sessions on a single clientid.
This patch allows 4.1 server to skip stateid seqid checks when
the stateid seqid is zero. Where does the draft say this? I can find a
discription of three other cases (other and seqid zero, other and seqid
all ones, other zero and seqid non-zero) but not a description of other
non-zero and seqid zero.
I'm probably just not finding it.
-->Andy
draft 13 section 8.2.3. Special Stateids
.......
The following combinations of "other" and "seqid" are defined in
NFSv4.1:
o When "other" and "seqid" are both zero, the stateid is
treated as
a special anonymous stateid, which can be used in READ,
WRITE, and
SETATTR requests to indicate the absence of any open state
associated with the request. When an anonymous stateid
value is
used, and an existing open denies the form of access
requested,
then access will be denied to the request. This stateid
MUST NOT
be used on operations to data servers (Section 14.7), nor
may it
be used as the argument to the WANT_DELEGATTION (Section
18.49)
operation.
o When "other" and "seqid" are both all ones, the stateid is
a
special read bypass stateid. When this value is used in
WRITE or
SETATTR, it is treated like the anonymous value. When
used in
READ, the server MAY grant access, even if access would
normally
be denied to READ requests. This stateid MUST NOT be used
on
operations to data servers, nor may it be used as the
argument to
Shepler, et al. Expires January 2, 2008
[Page 145]
^L
Internet-Draft NFSv4 Minor Version 1
July 2007
the WANT_DELEGATION operation.
o When "other" is zero and "seqid" is one, the stateid
represents
the current stateid, which is whatever value is the last
stateid
returned by an operation within the COMPOUND. In the case
of an
OPEN, the stateid returned for the open file, and not the
delegation is used. The stateid passed to the operation
in place
of the special value has its "seqid" value set to zero,
except
when the current stateid is used by the operation CLOSE or
OPEN_DOWNGRADE. If there is no operation in the COMPOUND
which
has returned a stateid value, the server MUST return the
error
NFS4ERR_BAD_STATEID.
---------- Forwarded message ----------
From: Sager, Mike <Mike.Sager at netapp.com>
Date: Sep 12, 2007 3:33 PM
Subject: [pnfs] [PATCH 2/2] Update stateid generation number
handling per latest draft
To: pnfs at linux-nfs.org
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
<mailto: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
_______________________________________________
pNFS mailing list
pNFS at linux-nfs.org
http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linux-nfs.org/pipermail/pnfs/attachments/20070918/ef29d36a/attachment.htm
More information about the pNFS
mailing list