diff options
| author | Neil Brown <neilb@cse.unsw.edu.au> | 2004-10-19 18:24:43 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-19 18:24:43 -0700 |
| commit | d384d7c2d812dba3405e7c3a29ce4d6e6c7a89c5 (patch) | |
| tree | ceba822451a642dc6e36e33eaae97a93b8f85706 /include | |
| parent | 49398b8cedb62e63245687be614c1b5c98c0c7b6 (diff) | |
[PATCH] nfsd4: reference count stateowners
Reference-counting the nfsd4 stateowner structs will let us fix a race and
simplify some of the xdr code a bit, and may also help us make the nfsd4
locking a little more fine-grained in the future.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/nfsd/state.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index 97d84c887853..a56399b985a4 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h @@ -38,6 +38,7 @@ #define _NFSD4_STATE_H #include <linux/list.h> +#include <linux/kref.h> #include <linux/sunrpc/clnt.h> #define NFS4_OPAQUE_LIMIT 1024 @@ -168,6 +169,7 @@ struct nfs4_replay { * reaped by laundramat thread after lease period. */ struct nfs4_stateowner { + struct kref so_ref; struct list_head so_idhash; /* hash by so_id */ struct list_head so_strhash; /* hash by op_name */ struct list_head so_perclient; /* nfs4_client->cl_perclient */ @@ -248,4 +250,18 @@ extern void nfs4_lock_state(void); extern void nfs4_unlock_state(void); extern int nfs4_in_grace(void); extern int nfs4_check_open_reclaim(clientid_t *clid); +extern void nfs4_free_stateowner(struct kref *kref); + +static inline void +nfs4_put_stateowner(struct nfs4_stateowner *so) +{ + kref_put(&so->so_ref, nfs4_free_stateowner); +} + +static inline void +nfs4_get_stateowner(struct nfs4_stateowner *so) +{ + kref_get(&so->so_ref); +} + #endif /* NFSD4_STATE_H */ |
