aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfsd/state.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/nfsd/state.h')
-rw-r--r--include/linux/nfsd/state.h47
1 files changed, 26 insertions, 21 deletions
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index b6b2fe1e7c63..a84a3fa99be1 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -61,11 +61,6 @@ typedef struct {
61#define si_stateownerid si_opaque.so_stateownerid 61#define si_stateownerid si_opaque.so_stateownerid
62#define si_fileid si_opaque.so_fileid 62#define si_fileid si_opaque.so_fileid
63 63
64extern stateid_t zerostateid;
65extern stateid_t onestateid;
66
67#define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
68#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
69 64
70struct nfs4_cb_recall { 65struct nfs4_cb_recall {
71 u32 cbr_ident; 66 u32 cbr_ident;
@@ -77,8 +72,8 @@ struct nfs4_cb_recall {
77}; 72};
78 73
79struct nfs4_delegation { 74struct nfs4_delegation {
80 struct list_head dl_del_perfile; /* nfs4_file->fi_del_perfile */ 75 struct list_head dl_perfile;
81 struct list_head dl_del_perclnt; /* nfs4_client->cl_del_perclnt*/ 76 struct list_head dl_perclnt;
82 struct list_head dl_recall_lru; /* delegation recalled */ 77 struct list_head dl_recall_lru; /* delegation recalled */
83 atomic_t dl_count; /* ref count */ 78 atomic_t dl_count; /* ref count */
84 struct nfs4_client *dl_client; 79 struct nfs4_client *dl_client;
@@ -97,7 +92,6 @@ struct nfs4_delegation {
97/* client delegation callback info */ 92/* client delegation callback info */
98struct nfs4_callback { 93struct nfs4_callback {
99 /* SETCLIENTID info */ 94 /* SETCLIENTID info */
100 u32 cb_parsed; /* addr parsed */
101 u32 cb_addr; 95 u32 cb_addr;
102 unsigned short cb_port; 96 unsigned short cb_port;
103 u32 cb_prog; 97 u32 cb_prog;
@@ -109,6 +103,8 @@ struct nfs4_callback {
109 struct rpc_clnt * cb_client; 103 struct rpc_clnt * cb_client;
110}; 104};
111 105
106#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */
107
112/* 108/*
113 * struct nfs4_client - one per client. Clientids live here. 109 * struct nfs4_client - one per client. Clientids live here.
114 * o Each nfs4_client is hashed by clientid. 110 * o Each nfs4_client is hashed by clientid.
@@ -122,10 +118,11 @@ struct nfs4_callback {
122struct nfs4_client { 118struct nfs4_client {
123 struct list_head cl_idhash; /* hash by cl_clientid.id */ 119 struct list_head cl_idhash; /* hash by cl_clientid.id */
124 struct list_head cl_strhash; /* hash by cl_name */ 120 struct list_head cl_strhash; /* hash by cl_name */
125 struct list_head cl_perclient; /* list: stateowners */ 121 struct list_head cl_openowners;
126 struct list_head cl_del_perclnt; /* list: delegations */ 122 struct list_head cl_delegations;
127 struct list_head cl_lru; /* tail queue */ 123 struct list_head cl_lru; /* tail queue */
128 struct xdr_netobj cl_name; /* id generated by client */ 124 struct xdr_netobj cl_name; /* id generated by client */
125 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
129 nfs4_verifier cl_verifier; /* generated by client */ 126 nfs4_verifier cl_verifier; /* generated by client */
130 time_t cl_time; /* time of last lease renewal */ 127 time_t cl_time; /* time of last lease renewal */
131 u32 cl_addr; /* client ipaddress */ 128 u32 cl_addr; /* client ipaddress */
@@ -134,6 +131,7 @@ struct nfs4_client {
134 nfs4_verifier cl_confirm; /* generated by server */ 131 nfs4_verifier cl_confirm; /* generated by server */
135 struct nfs4_callback cl_callback; /* callback info */ 132 struct nfs4_callback cl_callback; /* callback info */
136 atomic_t cl_count; /* ref count */ 133 atomic_t cl_count; /* ref count */
134 u32 cl_firststate; /* recovery dir creation */
137}; 135};
138 136
139/* struct nfs4_client_reset 137/* struct nfs4_client_reset
@@ -143,7 +141,7 @@ struct nfs4_client {
143 */ 141 */
144struct nfs4_client_reclaim { 142struct nfs4_client_reclaim {
145 struct list_head cr_strhash; /* hash by cr_name */ 143 struct list_head cr_strhash; /* hash by cr_name */
146 struct xdr_netobj cr_name; /* id generated by client */ 144 char cr_recdir[HEXDIR_LEN]; /* recover dir */
147}; 145};
148 146
149static inline void 147static inline void
@@ -197,9 +195,9 @@ struct nfs4_stateowner {
197 struct kref so_ref; 195 struct kref so_ref;
198 struct list_head so_idhash; /* hash by so_id */ 196 struct list_head so_idhash; /* hash by so_id */
199 struct list_head so_strhash; /* hash by op_name */ 197 struct list_head so_strhash; /* hash by op_name */
200 struct list_head so_perclient; /* nfs4_client->cl_perclient */ 198 struct list_head so_perclient;
201 struct list_head so_perfilestate; /* list: nfs4_stateid */ 199 struct list_head so_stateids;
202 struct list_head so_perlockowner; /* nfs4_stateid->st_perlockowner */ 200 struct list_head so_perstateid; /* for lockowners only */
203 struct list_head so_close_lru; /* tail queue */ 201 struct list_head so_close_lru; /* tail queue */
204 time_t so_time; /* time of placement on so_close_lru */ 202 time_t so_time; /* time of placement on so_close_lru */
205 int so_is_open_owner; /* 1=openowner,0=lockowner */ 203 int so_is_open_owner; /* 1=openowner,0=lockowner */
@@ -217,9 +215,10 @@ struct nfs4_stateowner {
217* share_acces, share_deny on the file. 215* share_acces, share_deny on the file.
218*/ 216*/
219struct nfs4_file { 217struct nfs4_file {
218 struct kref fi_ref;
220 struct list_head fi_hash; /* hash by "struct inode *" */ 219 struct list_head fi_hash; /* hash by "struct inode *" */
221 struct list_head fi_perfile; /* list: nfs4_stateid */ 220 struct list_head fi_stateids;
222 struct list_head fi_del_perfile; /* list: nfs4_delegation */ 221 struct list_head fi_delegations;
223 struct inode *fi_inode; 222 struct inode *fi_inode;
224 u32 fi_id; /* used with stateowner->so_id 223 u32 fi_id; /* used with stateowner->so_id
225 * for stateid_hashtbl hash */ 224 * for stateid_hashtbl hash */
@@ -241,8 +240,8 @@ struct nfs4_file {
241struct nfs4_stateid { 240struct nfs4_stateid {
242 struct list_head st_hash; 241 struct list_head st_hash;
243 struct list_head st_perfile; 242 struct list_head st_perfile;
244 struct list_head st_perfilestate; 243 struct list_head st_perstateowner;
245 struct list_head st_perlockowner; 244 struct list_head st_lockowners;
246 struct nfs4_stateowner * st_stateowner; 245 struct nfs4_stateowner * st_stateowner;
247 struct nfs4_file * st_file; 246 struct nfs4_file * st_file;
248 stateid_t st_stateid; 247 stateid_t st_stateid;
@@ -267,12 +266,9 @@ struct nfs4_stateid {
267 ((err) != nfserr_stale_stateid) && \ 266 ((err) != nfserr_stale_stateid) && \
268 ((err) != nfserr_bad_stateid)) 267 ((err) != nfserr_bad_stateid))
269 268
270extern time_t nfs4_laundromat(void);
271extern int nfsd4_renew(clientid_t *clid); 269extern int nfsd4_renew(clientid_t *clid);
272extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 270extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
273 stateid_t *stateid, int flags, struct file **filp); 271 stateid_t *stateid, int flags, struct file **filp);
274extern int nfs4_share_conflict(struct svc_fh *current_fh,
275 unsigned int deny_type);
276extern void nfs4_lock_state(void); 272extern void nfs4_lock_state(void);
277extern void nfs4_unlock_state(void); 273extern void nfs4_unlock_state(void);
278extern int nfs4_in_grace(void); 274extern int nfs4_in_grace(void);
@@ -282,6 +278,15 @@ extern void nfs4_free_stateowner(struct kref *kref);
282extern void nfsd4_probe_callback(struct nfs4_client *clp); 278extern void nfsd4_probe_callback(struct nfs4_client *clp);
283extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 279extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
284extern void nfs4_put_delegation(struct nfs4_delegation *dp); 280extern void nfs4_put_delegation(struct nfs4_delegation *dp);
281extern int nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
282extern void nfsd4_init_recdir(char *recdir_name);
283extern int nfsd4_recdir_load(void);
284extern void nfsd4_shutdown_recdir(void);
285extern int nfs4_client_to_reclaim(const char *name);
286extern int nfs4_has_reclaimed_state(const char *name);
287extern void nfsd4_recdir_purge_old(void);
288extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
289extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
285 290
286static inline void 291static inline void
287nfs4_put_stateowner(struct nfs4_stateowner *so) 292nfs4_put_stateowner(struct nfs4_stateowner *so)