aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/state.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/state.h')
-rw-r--r--fs/nfsd/state.h64
1 files changed, 51 insertions, 13 deletions
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index e036894bce57..d1c229feed52 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -150,6 +150,12 @@ struct nfsd4_channel_attrs {
150 u32 rdma_attrs; 150 u32 rdma_attrs;
151}; 151};
152 152
153struct nfsd4_cb_sec {
154 u32 flavor; /* (u32)(-1) used to mean "no valid flavor" */
155 u32 uid;
156 u32 gid;
157};
158
153struct nfsd4_create_session { 159struct nfsd4_create_session {
154 clientid_t clientid; 160 clientid_t clientid;
155 struct nfs4_sessionid sessionid; 161 struct nfs4_sessionid sessionid;
@@ -158,8 +164,12 @@ struct nfsd4_create_session {
158 struct nfsd4_channel_attrs fore_channel; 164 struct nfsd4_channel_attrs fore_channel;
159 struct nfsd4_channel_attrs back_channel; 165 struct nfsd4_channel_attrs back_channel;
160 u32 callback_prog; 166 u32 callback_prog;
161 u32 uid; 167 struct nfsd4_cb_sec cb_sec;
162 u32 gid; 168};
169
170struct nfsd4_backchannel_ctl {
171 u32 bc_cb_program;
172 struct nfsd4_cb_sec bc_cb_sec;
163}; 173};
164 174
165struct nfsd4_bind_conn_to_session { 175struct nfsd4_bind_conn_to_session {
@@ -192,6 +202,7 @@ struct nfsd4_session {
192 struct nfs4_sessionid se_sessionid; 202 struct nfs4_sessionid se_sessionid;
193 struct nfsd4_channel_attrs se_fchannel; 203 struct nfsd4_channel_attrs se_fchannel;
194 struct nfsd4_channel_attrs se_bchannel; 204 struct nfsd4_channel_attrs se_bchannel;
205 struct nfsd4_cb_sec se_cb_sec;
195 struct list_head se_conns; 206 struct list_head se_conns;
196 u32 se_cb_prog; 207 u32 se_cb_prog;
197 u32 se_cb_seq_nr; 208 u32 se_cb_seq_nr;
@@ -221,13 +232,12 @@ struct nfsd4_sessionid {
221 */ 232 */
222struct nfs4_client { 233struct nfs4_client {
223 struct list_head cl_idhash; /* hash by cl_clientid.id */ 234 struct list_head cl_idhash; /* hash by cl_clientid.id */
224 struct list_head cl_strhash; /* hash by cl_name */ 235 struct rb_node cl_namenode; /* link into by-name trees */
225 struct list_head cl_openowners; 236 struct list_head cl_openowners;
226 struct idr cl_stateids; /* stateid lookup */ 237 struct idr cl_stateids; /* stateid lookup */
227 struct list_head cl_delegations; 238 struct list_head cl_delegations;
228 struct list_head cl_lru; /* tail queue */ 239 struct list_head cl_lru; /* tail queue */
229 struct xdr_netobj cl_name; /* id generated by client */ 240 struct xdr_netobj cl_name; /* id generated by client */
230 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
231 nfs4_verifier cl_verifier; /* generated by client */ 241 nfs4_verifier cl_verifier; /* generated by client */
232 time_t cl_time; /* time of last lease renewal */ 242 time_t cl_time; /* time of last lease renewal */
233 struct sockaddr_storage cl_addr; /* client ipaddress */ 243 struct sockaddr_storage cl_addr; /* client ipaddress */
@@ -242,9 +252,11 @@ struct nfs4_client {
242#define NFSD4_CLIENT_CB_KILL (1) 252#define NFSD4_CLIENT_CB_KILL (1)
243#define NFSD4_CLIENT_STABLE (2) /* client on stable storage */ 253#define NFSD4_CLIENT_STABLE (2) /* client on stable storage */
244#define NFSD4_CLIENT_RECLAIM_COMPLETE (3) /* reclaim_complete done */ 254#define NFSD4_CLIENT_RECLAIM_COMPLETE (3) /* reclaim_complete done */
255#define NFSD4_CLIENT_CONFIRMED (4) /* client is confirmed */
245#define NFSD4_CLIENT_CB_FLAG_MASK (1 << NFSD4_CLIENT_CB_UPDATE | \ 256#define NFSD4_CLIENT_CB_FLAG_MASK (1 << NFSD4_CLIENT_CB_UPDATE | \
246 1 << NFSD4_CLIENT_CB_KILL) 257 1 << NFSD4_CLIENT_CB_KILL)
247 unsigned long cl_flags; 258 unsigned long cl_flags;
259 struct rpc_cred *cl_cb_cred;
248 struct rpc_clnt *cl_cb_client; 260 struct rpc_clnt *cl_cb_client;
249 u32 cl_cb_ident; 261 u32 cl_cb_ident;
250#define NFSD4_CB_UP 0 262#define NFSD4_CB_UP 0
@@ -271,6 +283,7 @@ struct nfs4_client {
271 unsigned long cl_cb_slot_busy; 283 unsigned long cl_cb_slot_busy;
272 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */ 284 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
273 /* wait here for slots */ 285 /* wait here for slots */
286 struct net *net;
274}; 287};
275 288
276static inline void 289static inline void
@@ -292,6 +305,7 @@ is_client_expired(struct nfs4_client *clp)
292 */ 305 */
293struct nfs4_client_reclaim { 306struct nfs4_client_reclaim {
294 struct list_head cr_strhash; /* hash by cr_name */ 307 struct list_head cr_strhash; /* hash by cr_name */
308 struct nfs4_client *cr_clp; /* pointer to associated clp */
295 char cr_recdir[HEXDIR_LEN]; /* recover dir */ 309 char cr_recdir[HEXDIR_LEN]; /* recover dir */
296}; 310};
297 311
@@ -452,25 +466,26 @@ extern __be32 nfs4_preprocess_stateid_op(struct net *net,
452 stateid_t *stateid, int flags, struct file **filp); 466 stateid_t *stateid, int flags, struct file **filp);
453extern void nfs4_lock_state(void); 467extern void nfs4_lock_state(void);
454extern void nfs4_unlock_state(void); 468extern void nfs4_unlock_state(void);
455extern int nfs4_in_grace(void); 469void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *, struct nfsd_net *);
456extern void nfs4_release_reclaim(void); 470extern void nfs4_release_reclaim(struct nfsd_net *);
457extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(struct nfs4_client *crp); 471extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir,
458extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions); 472 struct nfsd_net *nn);
473extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions, struct nfsd_net *nn);
459extern void nfs4_free_openowner(struct nfs4_openowner *); 474extern void nfs4_free_openowner(struct nfs4_openowner *);
460extern void nfs4_free_lockowner(struct nfs4_lockowner *); 475extern void nfs4_free_lockowner(struct nfs4_lockowner *);
461extern int set_callback_cred(void); 476extern int set_callback_cred(void);
477extern void nfsd4_init_callback(struct nfsd4_callback *);
462extern void nfsd4_probe_callback(struct nfs4_client *clp); 478extern void nfsd4_probe_callback(struct nfs4_client *clp);
463extern void nfsd4_probe_callback_sync(struct nfs4_client *clp); 479extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
464extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *); 480extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);
465extern void nfsd4_do_callback_rpc(struct work_struct *);
466extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 481extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
467extern int nfsd4_create_callback_queue(void); 482extern int nfsd4_create_callback_queue(void);
468extern void nfsd4_destroy_callback_queue(void); 483extern void nfsd4_destroy_callback_queue(void);
469extern void nfsd4_shutdown_callback(struct nfs4_client *); 484extern void nfsd4_shutdown_callback(struct nfs4_client *);
470extern void nfs4_put_delegation(struct nfs4_delegation *dp); 485extern void nfs4_put_delegation(struct nfs4_delegation *dp);
471extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); 486extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(const char *name,
472extern int nfs4_client_to_reclaim(const char *name); 487 struct nfsd_net *nn);
473extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id); 488extern bool nfs4_has_reclaimed_state(const char *name, struct nfsd_net *nn);
474extern void release_session_client(struct nfsd4_session *); 489extern void release_session_client(struct nfsd4_session *);
475extern void nfsd4_purge_closed_stateid(struct nfs4_stateowner *); 490extern void nfsd4_purge_closed_stateid(struct nfs4_stateowner *);
476 491
@@ -480,5 +495,28 @@ extern void nfsd4_client_tracking_exit(struct net *net);
480extern void nfsd4_client_record_create(struct nfs4_client *clp); 495extern void nfsd4_client_record_create(struct nfs4_client *clp);
481extern void nfsd4_client_record_remove(struct nfs4_client *clp); 496extern void nfsd4_client_record_remove(struct nfs4_client *clp);
482extern int nfsd4_client_record_check(struct nfs4_client *clp); 497extern int nfsd4_client_record_check(struct nfs4_client *clp);
483extern void nfsd4_record_grace_done(struct net *net, time_t boot_time); 498extern void nfsd4_record_grace_done(struct nfsd_net *nn, time_t boot_time);
499
500/* nfs fault injection functions */
501#ifdef CONFIG_NFSD_FAULT_INJECTION
502int nfsd_fault_inject_init(void);
503void nfsd_fault_inject_cleanup(void);
504u64 nfsd_for_n_state(u64, u64 (*)(struct nfs4_client *, u64));
505struct nfs4_client *nfsd_find_client(struct sockaddr_storage *, size_t);
506
507u64 nfsd_forget_client(struct nfs4_client *, u64);
508u64 nfsd_forget_client_locks(struct nfs4_client*, u64);
509u64 nfsd_forget_client_openowners(struct nfs4_client *, u64);
510u64 nfsd_forget_client_delegations(struct nfs4_client *, u64);
511u64 nfsd_recall_client_delegations(struct nfs4_client *, u64);
512
513u64 nfsd_print_client(struct nfs4_client *, u64);
514u64 nfsd_print_client_locks(struct nfs4_client *, u64);
515u64 nfsd_print_client_openowners(struct nfs4_client *, u64);
516u64 nfsd_print_client_delegations(struct nfs4_client *, u64);
517#else /* CONFIG_NFSD_FAULT_INJECTION */
518static inline int nfsd_fault_inject_init(void) { return 0; }
519static inline void nfsd_fault_inject_cleanup(void) {}
520#endif /* CONFIG_NFSD_FAULT_INJECTION */
521
484#endif /* NFSD4_STATE_H */ 522#endif /* NFSD4_STATE_H */