aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/state.h
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-09-15 15:02:41 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-09-19 06:33:57 -0400
commitd3b313a463c64c54d57c6af09c4a5d20106c1d1c (patch)
tree9ade49e59a3771f2a4dedf50baf0f44d55b11b46 /fs/nfsd/state.h
parent2da1cec713bc6d3ec9732e7d48b8bc0453580fd3 (diff)
nfsd4: construct stateid from clientid and counter
Including the full clientid in the on-the-wire stateid allows more reliable detection of bad vs. expired stateid's, simplifies code, and ensures we won't reuse the opaque part of the stateid (as we currently do when the same openowner closes and reopens the same file). Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/state.h')
-rw-r--r--fs/nfsd/state.h18
1 files changed, 5 insertions, 13 deletions
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index e807abb116f6..d6aec4f8d3dd 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -45,24 +45,20 @@ typedef struct {
45} clientid_t; 45} clientid_t;
46 46
47typedef struct { 47typedef struct {
48 u32 so_boot; 48 clientid_t so_clid;
49 u32 so_stateownerid; 49 u32 so_id;
50 u32 so_fileid;
51} stateid_opaque_t; 50} stateid_opaque_t;
52 51
53typedef struct { 52typedef struct {
54 u32 si_generation; 53 u32 si_generation;
55 stateid_opaque_t si_opaque; 54 stateid_opaque_t si_opaque;
56} stateid_t; 55} stateid_t;
57#define si_boot si_opaque.so_boot
58#define si_stateownerid si_opaque.so_stateownerid
59#define si_fileid si_opaque.so_fileid
60 56
61#define STATEID_FMT "(%08x/%08x/%08x/%08x)" 57#define STATEID_FMT "(%08x/%08x/%08x/%08x)"
62#define STATEID_VAL(s) \ 58#define STATEID_VAL(s) \
63 (s)->si_boot, \ 59 (s)->si_opaque.so_clid.cl_boot, \
64 (s)->si_stateownerid, \ 60 (s)->si_opaque.so_clid.cl_id, \
65 (s)->si_fileid, \ 61 (s)->si_opaque.so_id, \
66 (s)->si_generation 62 (s)->si_generation
67 63
68struct nfsd4_callback { 64struct nfsd4_callback {
@@ -353,11 +349,9 @@ struct nfs4_replay {
353*/ 349*/
354 350
355struct nfs4_stateowner { 351struct nfs4_stateowner {
356 struct list_head so_idhash; /* hash by so_id */
357 struct list_head so_strhash; /* hash by op_name */ 352 struct list_head so_strhash; /* hash by op_name */
358 struct list_head so_stateids; 353 struct list_head so_stateids;
359 int so_is_open_owner; /* 1=openowner,0=lockowner */ 354 int so_is_open_owner; /* 1=openowner,0=lockowner */
360 u32 so_id;
361 struct nfs4_client * so_client; 355 struct nfs4_client * so_client;
362 /* after increment in ENCODE_SEQID_OP_TAIL, represents the next 356 /* after increment in ENCODE_SEQID_OP_TAIL, represents the next
363 * sequence id expected from the client: */ 357 * sequence id expected from the client: */
@@ -415,8 +409,6 @@ struct nfs4_file {
415 struct file_lock *fi_lease; 409 struct file_lock *fi_lease;
416 atomic_t fi_delegees; 410 atomic_t fi_delegees;
417 struct inode *fi_inode; 411 struct inode *fi_inode;
418 u32 fi_id; /* used with stateowner->so_id
419 * for stateid_hashtbl hash */
420 bool fi_had_conflict; 412 bool fi_had_conflict;
421}; 413};
422 414