diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2010-06-04 20:04:45 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2010-10-01 19:29:44 -0400 |
commit | 6ff8da088766d70f0441feb982b82978a6cbf7ef (patch) | |
tree | 7d0e90e4e03323fec67a972cdff60c9b8a96925a /fs/nfsd/state.h | |
parent | fb003923263c3f0cb02adbd56a22fe16ef5c0e77 (diff) |
nfsd4: Move callback setup to callback queue
Instead of creating the new rpc client from a regular server thread,
set a flag, kick off a null call, and allow the null call to do the work
of setting up the client on the callback workqueue.
Use a spinlock to ensure the callback work gets a consistent view of the
callback parameters.
This allows, for example, changing the callback from contexts where
sleeping is not allowed. I hope it will also keep the locking simple as
we add more session and trunking features, by serializing most of the
callback-specific work.
This also closes a small race where the the new cb_ident could be used
with an old connection (or vice-versa).
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/state.h')
-rw-r--r-- | fs/nfsd/state.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 2ece6bee65f7..58bc2a63ca14 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -84,7 +84,6 @@ struct nfs4_delegation { | |||
84 | u32 dl_type; | 84 | u32 dl_type; |
85 | time_t dl_time; | 85 | time_t dl_time; |
86 | /* For recall: */ | 86 | /* For recall: */ |
87 | u32 dl_ident; | ||
88 | stateid_t dl_stateid; | 87 | stateid_t dl_stateid; |
89 | struct knfsd_fh dl_fh; | 88 | struct knfsd_fh dl_fh; |
90 | int dl_retries; | 89 | int dl_retries; |
@@ -217,10 +216,17 @@ struct nfs4_client { | |||
217 | 216 | ||
218 | /* for v4.0 and v4.1 callbacks: */ | 217 | /* for v4.0 and v4.1 callbacks: */ |
219 | struct nfs4_cb_conn cl_cb_conn; | 218 | struct nfs4_cb_conn cl_cb_conn; |
219 | #define NFSD4_CLIENT_CB_UPDATE 1 | ||
220 | #define NFSD4_CLIENT_KILL 2 | ||
221 | unsigned long cl_cb_flags; | ||
220 | struct rpc_clnt *cl_cb_client; | 222 | struct rpc_clnt *cl_cb_client; |
223 | u32 cl_cb_ident; | ||
221 | atomic_t cl_cb_set; | 224 | atomic_t cl_cb_set; |
222 | struct nfsd4_callback cl_cb_null; | 225 | struct nfsd4_callback cl_cb_null; |
223 | 226 | ||
227 | /* for all client information that callback code might need: */ | ||
228 | spinlock_t cl_lock; | ||
229 | |||
224 | /* for nfs41 */ | 230 | /* for nfs41 */ |
225 | struct list_head cl_sessions; | 231 | struct list_head cl_sessions; |
226 | struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */ | 232 | struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */ |
@@ -439,7 +445,7 @@ extern void nfsd4_do_callback_rpc(struct work_struct *); | |||
439 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); | 445 | extern void nfsd4_cb_recall(struct nfs4_delegation *dp); |
440 | extern int nfsd4_create_callback_queue(void); | 446 | extern int nfsd4_create_callback_queue(void); |
441 | extern void nfsd4_destroy_callback_queue(void); | 447 | extern void nfsd4_destroy_callback_queue(void); |
442 | extern void nfsd4_set_callback_client(struct nfs4_client *, struct rpc_clnt *); | 448 | extern void nfsd4_shutdown_callback(struct nfs4_client *); |
443 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); | 449 | extern void nfs4_put_delegation(struct nfs4_delegation *dp); |
444 | extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); | 450 | extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname); |
445 | extern void nfsd4_init_recdir(char *recdir_name); | 451 | extern void nfsd4_init_recdir(char *recdir_name); |