diff options
Diffstat (limited to 'fs/nfsd/state.h')
-rw-r--r-- | fs/nfsd/state.h | 83 |
1 files changed, 54 insertions, 29 deletions
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 322518c88e4b..6bd2f3c21f2b 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #ifndef _NFSD4_STATE_H | 35 | #ifndef _NFSD4_STATE_H |
36 | #define _NFSD4_STATE_H | 36 | #define _NFSD4_STATE_H |
37 | 37 | ||
38 | #include <linux/sunrpc/svc_xprt.h> | ||
38 | #include <linux/nfsd/nfsfh.h> | 39 | #include <linux/nfsd/nfsfh.h> |
39 | #include "nfsfh.h" | 40 | #include "nfsfh.h" |
40 | 41 | ||
@@ -64,20 +65,15 @@ typedef struct { | |||
64 | (s)->si_fileid, \ | 65 | (s)->si_fileid, \ |
65 | (s)->si_generation | 66 | (s)->si_generation |
66 | 67 | ||
67 | struct nfsd4_cb_sequence { | ||
68 | /* args/res */ | ||
69 | u32 cbs_minorversion; | ||
70 | struct nfs4_client *cbs_clp; | ||
71 | }; | ||
72 | |||
73 | struct nfs4_rpc_args { | ||
74 | void *args_op; | ||
75 | struct nfsd4_cb_sequence args_seq; | ||
76 | }; | ||
77 | |||
78 | struct nfsd4_callback { | 68 | struct nfsd4_callback { |
79 | struct nfs4_rpc_args cb_args; | 69 | void *cb_op; |
70 | struct nfs4_client *cb_clp; | ||
71 | struct list_head cb_per_client; | ||
72 | u32 cb_minorversion; | ||
73 | struct rpc_message cb_msg; | ||
74 | const struct rpc_call_ops *cb_ops; | ||
80 | struct work_struct cb_work; | 75 | struct work_struct cb_work; |
76 | bool cb_done; | ||
81 | }; | 77 | }; |
82 | 78 | ||
83 | struct nfs4_delegation { | 79 | struct nfs4_delegation { |
@@ -87,11 +83,9 @@ struct nfs4_delegation { | |||
87 | atomic_t dl_count; /* ref count */ | 83 | atomic_t dl_count; /* ref count */ |
88 | struct nfs4_client *dl_client; | 84 | struct nfs4_client *dl_client; |
89 | struct nfs4_file *dl_file; | 85 | struct nfs4_file *dl_file; |
90 | struct file_lock *dl_flock; | ||
91 | u32 dl_type; | 86 | u32 dl_type; |
92 | time_t dl_time; | 87 | time_t dl_time; |
93 | /* For recall: */ | 88 | /* For recall: */ |
94 | u32 dl_ident; | ||
95 | stateid_t dl_stateid; | 89 | stateid_t dl_stateid; |
96 | struct knfsd_fh dl_fh; | 90 | struct knfsd_fh dl_fh; |
97 | int dl_retries; | 91 | int dl_retries; |
@@ -102,9 +96,10 @@ struct nfs4_delegation { | |||
102 | struct nfs4_cb_conn { | 96 | struct nfs4_cb_conn { |
103 | /* SETCLIENTID info */ | 97 | /* SETCLIENTID info */ |
104 | struct sockaddr_storage cb_addr; | 98 | struct sockaddr_storage cb_addr; |
99 | struct sockaddr_storage cb_saddr; | ||
105 | size_t cb_addrlen; | 100 | size_t cb_addrlen; |
106 | u32 cb_prog; | 101 | u32 cb_prog; /* used only in 4.0 case; |
107 | u32 cb_minorversion; | 102 | per-session otherwise */ |
108 | u32 cb_ident; /* minorversion 0 only */ | 103 | u32 cb_ident; /* minorversion 0 only */ |
109 | struct svc_xprt *cb_xprt; /* minorversion 1 only */ | 104 | struct svc_xprt *cb_xprt; /* minorversion 1 only */ |
110 | }; | 105 | }; |
@@ -153,6 +148,11 @@ struct nfsd4_create_session { | |||
153 | u32 gid; | 148 | u32 gid; |
154 | }; | 149 | }; |
155 | 150 | ||
151 | struct nfsd4_bind_conn_to_session { | ||
152 | struct nfs4_sessionid sessionid; | ||
153 | u32 dir; | ||
154 | }; | ||
155 | |||
156 | /* The single slot clientid cache structure */ | 156 | /* The single slot clientid cache structure */ |
157 | struct nfsd4_clid_slot { | 157 | struct nfsd4_clid_slot { |
158 | u32 sl_seqid; | 158 | u32 sl_seqid; |
@@ -160,6 +160,15 @@ struct nfsd4_clid_slot { | |||
160 | struct nfsd4_create_session sl_cr_ses; | 160 | struct nfsd4_create_session sl_cr_ses; |
161 | }; | 161 | }; |
162 | 162 | ||
163 | struct nfsd4_conn { | ||
164 | struct list_head cn_persession; | ||
165 | struct svc_xprt *cn_xprt; | ||
166 | struct svc_xpt_user cn_xpt_user; | ||
167 | struct nfsd4_session *cn_session; | ||
168 | /* CDFC4_FORE, CDFC4_BACK: */ | ||
169 | unsigned char cn_flags; | ||
170 | }; | ||
171 | |||
163 | struct nfsd4_session { | 172 | struct nfsd4_session { |
164 | struct kref se_ref; | 173 | struct kref se_ref; |
165 | struct list_head se_hash; /* hash by sessionid */ | 174 | struct list_head se_hash; /* hash by sessionid */ |
@@ -169,6 +178,9 @@ struct nfsd4_session { | |||
169 | struct nfs4_sessionid se_sessionid; | 178 | struct nfs4_sessionid se_sessionid; |
170 | struct nfsd4_channel_attrs se_fchannel; | 179 | struct nfsd4_channel_attrs se_fchannel; |
171 | struct nfsd4_channel_attrs se_bchannel; | 180 | struct nfsd4_channel_attrs se_bchannel; |
181 | struct list_head se_conns; | ||
182 | u32 se_cb_prog; | ||
183 | u32 se_cb_seq_nr; | ||
172 | struct nfsd4_slot *se_slots[]; /* forward channel slots */ | 184 | struct nfsd4_slot *se_slots[]; /* forward channel slots */ |
173 | }; | 185 | }; |
174 | 186 | ||
@@ -221,24 +233,36 @@ struct nfs4_client { | |||
221 | clientid_t cl_clientid; /* generated by server */ | 233 | clientid_t cl_clientid; /* generated by server */ |
222 | nfs4_verifier cl_confirm; /* generated by server */ | 234 | nfs4_verifier cl_confirm; /* generated by server */ |
223 | u32 cl_firststate; /* recovery dir creation */ | 235 | u32 cl_firststate; /* recovery dir creation */ |
236 | u32 cl_minorversion; | ||
224 | 237 | ||
225 | /* for v4.0 and v4.1 callbacks: */ | 238 | /* for v4.0 and v4.1 callbacks: */ |
226 | struct nfs4_cb_conn cl_cb_conn; | 239 | struct nfs4_cb_conn cl_cb_conn; |
240 | #define NFSD4_CLIENT_CB_UPDATE 1 | ||
241 | #define NFSD4_CLIENT_KILL 2 | ||
242 | unsigned long cl_cb_flags; | ||
227 | struct rpc_clnt *cl_cb_client; | 243 | struct rpc_clnt *cl_cb_client; |
228 | atomic_t cl_cb_set; | 244 | u32 cl_cb_ident; |
245 | #define NFSD4_CB_UP 0 | ||
246 | #define NFSD4_CB_UNKNOWN 1 | ||
247 | #define NFSD4_CB_DOWN 2 | ||
248 | int cl_cb_state; | ||
249 | struct nfsd4_callback cl_cb_null; | ||
250 | struct nfsd4_session *cl_cb_session; | ||
251 | struct list_head cl_callbacks; /* list of in-progress callbacks */ | ||
252 | |||
253 | /* for all client information that callback code might need: */ | ||
254 | spinlock_t cl_lock; | ||
229 | 255 | ||
230 | /* for nfs41 */ | 256 | /* for nfs41 */ |
231 | struct list_head cl_sessions; | 257 | struct list_head cl_sessions; |
232 | struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */ | 258 | struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */ |
233 | u32 cl_exchange_flags; | 259 | u32 cl_exchange_flags; |
234 | struct nfs4_sessionid cl_sessionid; | ||
235 | /* number of rpc's in progress over an associated session: */ | 260 | /* number of rpc's in progress over an associated session: */ |
236 | atomic_t cl_refcount; | 261 | atomic_t cl_refcount; |
237 | 262 | ||
238 | /* for nfs41 callbacks */ | 263 | /* for nfs41 callbacks */ |
239 | /* We currently support a single back channel with a single slot */ | 264 | /* We currently support a single back channel with a single slot */ |
240 | unsigned long cl_cb_slot_busy; | 265 | unsigned long cl_cb_slot_busy; |
241 | u32 cl_cb_seq_nr; | ||
242 | struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */ | 266 | struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */ |
243 | /* wait here for slots */ | 267 | /* wait here for slots */ |
244 | }; | 268 | }; |
@@ -343,16 +367,15 @@ struct nfs4_file { | |||
343 | struct list_head fi_delegations; | 367 | struct list_head fi_delegations; |
344 | /* One each for O_RDONLY, O_WRONLY, O_RDWR: */ | 368 | /* One each for O_RDONLY, O_WRONLY, O_RDWR: */ |
345 | struct file * fi_fds[3]; | 369 | struct file * fi_fds[3]; |
346 | /* One each for O_RDONLY, O_WRONLY: */ | ||
347 | atomic_t fi_access[2]; | ||
348 | /* | 370 | /* |
349 | * Each open stateid contributes 1 to either fi_readers or | 371 | * Each open or lock stateid contributes 1 to either |
350 | * fi_writers, or both, depending on the open mode. A | 372 | * fi_access[O_RDONLY], fi_access[O_WRONLY], or both, depending |
351 | * delegation also takes an fi_readers reference. Lock | 373 | * on open or lock mode: |
352 | * stateid's take none. | ||
353 | */ | 374 | */ |
354 | atomic_t fi_readers; | 375 | atomic_t fi_access[2]; |
355 | atomic_t fi_writers; | 376 | struct file *fi_deleg_file; |
377 | struct file_lock *fi_lease; | ||
378 | atomic_t fi_delegees; | ||
356 | struct inode *fi_inode; | 379 | struct inode *fi_inode; |
357 | u32 fi_id; /* used with stateowner->so_id | 380 | u32 fi_id; /* used with stateowner->so_id |
358 | * for stateid_hashtbl hash */ | 381 | * for stateid_hashtbl hash */ |
@@ -440,12 +463,14 @@ extern int nfs4_in_grace(void); | |||
440 | extern __be32 nfs4_check_open_reclaim(clientid_t *clid); | 463 | extern __be32 nfs4_check_open_reclaim(clientid_t *clid); |
441 | extern void nfs4_free_stateowner(struct kref *kref); | 464 | extern void nfs4_free_stateowner(struct kref *kref); |
442 | extern int set_callback_cred(void); | 465 | extern int set_callback_cred(void); |
443 | extern void nfsd4_probe_callback(struct nfs4_client *clp, struct nfs4_cb_conn *); | 466 | extern void nfsd4_probe_callback(struct nfs4_client *clp); |
467 | extern void nfsd4_probe_callback_sync(struct nfs4_client *clp); | ||
468 | extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *); | ||
444 | extern void nfsd4_do_callback_rpc(struct work_struct *); | 469 | extern void nfsd4_do_callback_rpc(struct work_struct *); |
445 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); | 470 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); |
446 | extern int nfsd4_create_callback_queue(void); | 471 | extern int nfsd4_create_callback_queue(void); |
447 | extern void nfsd4_destroy_callback_queue(void); | 472 | extern void nfsd4_destroy_callback_queue(void); |
448 | extern void nfsd4_set_callback_client(struct nfs4_client *, struct rpc_clnt *); | 473 | extern void nfsd4_shutdown_callback(struct nfs4_client *); |
449 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); | 474 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); |
450 | extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); | 475 | extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); |
451 | extern void nfsd4_init_recdir(char *recdir_name); | 476 | extern void nfsd4_init_recdir(char *recdir_name); |