aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAlexandros Batsakis <batsakis@netapp.com>2009-12-09 04:50:11 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-12-15 13:50:01 -0500
commit3bfb0fc59192f7fffae0a1caada8dc68af53997a (patch)
treead4c11861dc1e5d50875c725cca3723332b05be2 /fs
parent3ea6b3d0e6d0ffd91c0f8cadeb69b7133c038b32 (diff)
nfs: minor cleanup of session draining
Signed-off-by: Alexandros Batsakis <batsakis@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 9f5f11ecfd93..d117a7befd46 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -341,6 +341,23 @@ nfs4_free_slot(struct nfs4_slot_table *tbl, u8 free_slotid)
341 free_slotid, tbl->highest_used_slotid); 341 free_slotid, tbl->highest_used_slotid);
342} 342}
343 343
344/*
345 * Signal state manager thread if session is drained
346 */
347static void nfs41_check_drain_session_complete(struct nfs4_session *ses)
348{
349 if (!test_bit(NFS4CLNT_SESSION_DRAINING, &ses->clp->cl_state)) {
350 rpc_wake_up_next(&ses->fc_slot_table.slot_tbl_waitq);
351 return;
352 }
353
354 if (ses->fc_slot_table.highest_used_slotid != -1)
355 return;
356
357 dprintk("%s COMPLETE: Session Drained\n", __func__);
358 complete(&ses->complete);
359}
360
344static void nfs41_sequence_free_slot(const struct nfs_client *clp, 361static void nfs41_sequence_free_slot(const struct nfs_client *clp,
345 struct nfs4_sequence_res *res) 362 struct nfs4_sequence_res *res)
346{ 363{
@@ -356,15 +373,7 @@ static void nfs41_sequence_free_slot(const struct nfs_client *clp,
356 373
357 spin_lock(&tbl->slot_tbl_lock); 374 spin_lock(&tbl->slot_tbl_lock);
358 nfs4_free_slot(tbl, res->sr_slotid); 375 nfs4_free_slot(tbl, res->sr_slotid);
359 376 nfs41_check_drain_session_complete(clp->cl_session);
360 /* Signal state manager thread if session is drained */
361 if (test_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state)) {
362 if (tbl->highest_used_slotid == -1) {
363 dprintk("%s COMPLETE: Session Drained\n", __func__);
364 complete(&clp->cl_session->complete);
365 }
366 } else
367 rpc_wake_up_next(&tbl->slot_tbl_waitq);
368 spin_unlock(&tbl->slot_tbl_lock); 377 spin_unlock(&tbl->slot_tbl_lock);
369 res->sr_slotid = NFS4_MAX_SLOT_TABLE; 378 res->sr_slotid = NFS4_MAX_SLOT_TABLE;
370} 379}