2005-04-08 01:57:24

by NeilBrown

[permalink] [raw]
Subject: [PATCH kNFSd 009 of 16] nfsd4: fix fh_expire_type


We're returning NFS4_FH_NOEXPIRE_WITH_OPEN | NFS4_FH_VOL_RENAME for the
fh_expire_type attribute. This is incorrect:
1. The spec actually only allows NOEXPIRE_WITH_OPEN when
VOLATILE_ANY is also set.
2. Filehandles for open files can expire, if the file is removed
and there is a reboot.
3. Filehandles are only volatile on rename in the nosubtree check
case.

Unfortunately, there's no way to indicate that we only expire on remove.
So our only choice is FH4_VOLATILE_ANY. Although it's redundant, we also set
FH4_VOL_RENAME in the subtree check case, since subtreecheck does actually
cause problems in practice and it seems possibly useful to give clients
some way to distinguish that case.

Fix a mispelled #define while we're at it.

Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Neil Brown <[email protected]>

### Diffstat output
./fs/nfsd/nfs4xdr.c | 5 ++++-
./include/linux/nfs4.h | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)

diff ./fs/nfsd/nfs4xdr.c~current~ ./fs/nfsd/nfs4xdr.c
--- ./fs/nfsd/nfs4xdr.c~current~ 2005-04-08 10:31:12.000000000 +1000
+++ ./fs/nfsd/nfs4xdr.c 2005-04-08 10:42:53.000000000 +1000
@@ -1366,7 +1366,10 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s
if (bmval0 & FATTR4_WORD0_FH_EXPIRE_TYPE) {
if ((buflen -= 4) < 0)
goto out_resource;
- WRITE32( NFS4_FH_NOEXPIRE_WITH_OPEN | NFS4_FH_VOL_RENAME );
+ if (exp->ex_flags & NFSEXP_NOSUBTREECHECK)
+ WRITE32(NFS4_FH_VOLATILE_ANY);
+ else
+ WRITE32(NFS4_FH_VOLATILE_ANY|NFS4_FH_VOL_RENAME);
}
if (bmval0 & FATTR4_WORD0_CHANGE) {
/*

diff ./include/linux/nfs4.h~current~ ./include/linux/nfs4.h
--- ./include/linux/nfs4.h~current~ 2005-04-08 10:31:12.000000000 +1000
+++ ./include/linux/nfs4.h 2005-04-08 10:42:53.000000000 +1000
@@ -28,7 +28,7 @@
#define NFS4_ACCESS_DELETE 0x0010
#define NFS4_ACCESS_EXECUTE 0x0020

-#define NFS4_FH_PERISTENT 0x0000
+#define NFS4_FH_PERSISTENT 0x0000
#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001
#define NFS4_FH_VOLATILE_ANY 0x0002
#define NFS4_FH_VOL_MIGRATION 0x0004


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs