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/nfs4state.c | |
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/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2f464fb26afc..d3f12dcc1696 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -207,7 +207,6 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f | |||
207 | { | 207 | { |
208 | struct nfs4_delegation *dp; | 208 | struct nfs4_delegation *dp; |
209 | struct nfs4_file *fp = stp->st_file; | 209 | struct nfs4_file *fp = stp->st_file; |
210 | struct nfs4_cb_conn *conn = &stp->st_stateowner->so_client->cl_cb_conn; | ||
211 | 210 | ||
212 | dprintk("NFSD alloc_init_deleg\n"); | 211 | dprintk("NFSD alloc_init_deleg\n"); |
213 | /* | 212 | /* |
@@ -234,7 +233,6 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f | |||
234 | nfs4_file_get_access(fp, O_RDONLY); | 233 | nfs4_file_get_access(fp, O_RDONLY); |
235 | dp->dl_flock = NULL; | 234 | dp->dl_flock = NULL; |
236 | dp->dl_type = type; | 235 | dp->dl_type = type; |
237 | dp->dl_ident = conn->cb_ident; | ||
238 | dp->dl_stateid.si_boot = boot_time; | 236 | dp->dl_stateid.si_boot = boot_time; |
239 | dp->dl_stateid.si_stateownerid = current_delegid++; | 237 | dp->dl_stateid.si_stateownerid = current_delegid++; |
240 | dp->dl_stateid.si_fileid = 0; | 238 | dp->dl_stateid.si_fileid = 0; |
@@ -875,7 +873,7 @@ expire_client(struct nfs4_client *clp) | |||
875 | sop = list_entry(clp->cl_openowners.next, struct nfs4_stateowner, so_perclient); | 873 | sop = list_entry(clp->cl_openowners.next, struct nfs4_stateowner, so_perclient); |
876 | release_openowner(sop); | 874 | release_openowner(sop); |
877 | } | 875 | } |
878 | nfsd4_set_callback_client(clp, NULL); | 876 | nfsd4_shutdown_callback(clp); |
879 | if (clp->cl_cb_conn.cb_xprt) | 877 | if (clp->cl_cb_conn.cb_xprt) |
880 | svc_xprt_put(clp->cl_cb_conn.cb_xprt); | 878 | svc_xprt_put(clp->cl_cb_conn.cb_xprt); |
881 | list_del(&clp->cl_idhash); | 879 | list_del(&clp->cl_idhash); |
@@ -978,6 +976,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir, | |||
978 | INIT_LIST_HEAD(&clp->cl_delegations); | 976 | INIT_LIST_HEAD(&clp->cl_delegations); |
979 | INIT_LIST_HEAD(&clp->cl_sessions); | 977 | INIT_LIST_HEAD(&clp->cl_sessions); |
980 | INIT_LIST_HEAD(&clp->cl_lru); | 978 | INIT_LIST_HEAD(&clp->cl_lru); |
979 | spin_lock_init(&clp->cl_lock); | ||
981 | INIT_WORK(&clp->cl_cb_null.cb_work, nfsd4_do_callback_rpc); | 980 | INIT_WORK(&clp->cl_cb_null.cb_work, nfsd4_do_callback_rpc); |
982 | clp->cl_time = get_seconds(); | 981 | clp->cl_time = get_seconds(); |
983 | clear_bit(0, &clp->cl_cb_slot_busy); | 982 | clear_bit(0, &clp->cl_cb_slot_busy); |
@@ -1547,7 +1546,7 @@ nfsd4_destroy_session(struct svc_rqst *r, | |||
1547 | 1546 | ||
1548 | nfs4_lock_state(); | 1547 | nfs4_lock_state(); |
1549 | /* wait for callbacks */ | 1548 | /* wait for callbacks */ |
1550 | nfsd4_set_callback_client(ses->se_client, NULL); | 1549 | nfsd4_shutdown_callback(ses->se_client); |
1551 | nfs4_unlock_state(); | 1550 | nfs4_unlock_state(); |
1552 | nfsd4_put_session(ses); | 1551 | nfsd4_put_session(ses); |
1553 | status = nfs_ok; | 1552 | status = nfs_ok; |