diff options
author | Andy Adamson <andros@netapp.com> | 2011-01-05 21:04:34 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-01-06 14:46:25 -0500 |
commit | 42acd021824578fa0eeb6eb58d457c23ec5dc9c0 (patch) | |
tree | 7affe8e1108373906eefcea00498df088b6dfccb /fs/nfs/nfs4proc.c | |
parent | ece0de633c4d9106c39ea9f0db1638c42ead2541 (diff) |
NFS add session back channel draining
Currently session draining only drains the fore channel.
The back channel processing must also be drained.
Use the back channel highest_slot_used to indicate that a callback is being
processed by the callback thread. Move the session complete to be per channel.
When the session is draininig, wait for any current back channel processing
to complete and stop all new back channel processing by returning NFS4ERR_DELAY
to the back channel client.
Drain the back channel, then the fore channel.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e165c53db08f..18a4d5a9a4e9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -356,9 +356,9 @@ nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *free_slot) | |||
356 | } | 356 | } |
357 | 357 | ||
358 | /* | 358 | /* |
359 | * Signal state manager thread if session is drained | 359 | * Signal state manager thread if session fore channel is drained |
360 | */ | 360 | */ |
361 | static void nfs41_check_drain_session_complete(struct nfs4_session *ses) | 361 | static void nfs4_check_drain_fc_complete(struct nfs4_session *ses) |
362 | { | 362 | { |
363 | struct rpc_task *task; | 363 | struct rpc_task *task; |
364 | 364 | ||
@@ -372,8 +372,20 @@ static void nfs41_check_drain_session_complete(struct nfs4_session *ses) | |||
372 | if (ses->fc_slot_table.highest_used_slotid != -1) | 372 | if (ses->fc_slot_table.highest_used_slotid != -1) |
373 | return; | 373 | return; |
374 | 374 | ||
375 | dprintk("%s COMPLETE: Session Drained\n", __func__); | 375 | dprintk("%s COMPLETE: Session Fore Channel Drained\n", __func__); |
376 | complete(&ses->complete); | 376 | complete(&ses->fc_slot_table.complete); |
377 | } | ||
378 | |||
379 | /* | ||
380 | * Signal state manager thread if session back channel is drained | ||
381 | */ | ||
382 | void nfs4_check_drain_bc_complete(struct nfs4_session *ses) | ||
383 | { | ||
384 | if (!test_bit(NFS4_SESSION_DRAINING, &ses->session_state) || | ||
385 | ses->bc_slot_table.highest_used_slotid != -1) | ||
386 | return; | ||
387 | dprintk("%s COMPLETE: Session Back Channel Drained\n", __func__); | ||
388 | complete(&ses->bc_slot_table.complete); | ||
377 | } | 389 | } |
378 | 390 | ||
379 | static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res) | 391 | static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res) |
@@ -390,7 +402,7 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res) | |||
390 | 402 | ||
391 | spin_lock(&tbl->slot_tbl_lock); | 403 | spin_lock(&tbl->slot_tbl_lock); |
392 | nfs4_free_slot(tbl, res->sr_slot); | 404 | nfs4_free_slot(tbl, res->sr_slot); |
393 | nfs41_check_drain_session_complete(res->sr_session); | 405 | nfs4_check_drain_fc_complete(res->sr_session); |
394 | spin_unlock(&tbl->slot_tbl_lock); | 406 | spin_unlock(&tbl->slot_tbl_lock); |
395 | res->sr_slot = NULL; | 407 | res->sr_slot = NULL; |
396 | } | 408 | } |
@@ -4777,17 +4789,17 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp) | |||
4777 | if (!session) | 4789 | if (!session) |
4778 | return NULL; | 4790 | return NULL; |
4779 | 4791 | ||
4780 | init_completion(&session->complete); | ||
4781 | |||
4782 | tbl = &session->fc_slot_table; | 4792 | tbl = &session->fc_slot_table; |
4783 | tbl->highest_used_slotid = -1; | 4793 | tbl->highest_used_slotid = -1; |
4784 | spin_lock_init(&tbl->slot_tbl_lock); | 4794 | spin_lock_init(&tbl->slot_tbl_lock); |
4785 | rpc_init_priority_wait_queue(&tbl->slot_tbl_waitq, "ForeChannel Slot table"); | 4795 | rpc_init_priority_wait_queue(&tbl->slot_tbl_waitq, "ForeChannel Slot table"); |
4796 | init_completion(&tbl->complete); | ||
4786 | 4797 | ||
4787 | tbl = &session->bc_slot_table; | 4798 | tbl = &session->bc_slot_table; |
4788 | tbl->highest_used_slotid = -1; | 4799 | tbl->highest_used_slotid = -1; |
4789 | spin_lock_init(&tbl->slot_tbl_lock); | 4800 | spin_lock_init(&tbl->slot_tbl_lock); |
4790 | rpc_init_wait_queue(&tbl->slot_tbl_waitq, "BackChannel Slot table"); | 4801 | rpc_init_wait_queue(&tbl->slot_tbl_waitq, "BackChannel Slot table"); |
4802 | init_completion(&tbl->complete); | ||
4791 | 4803 | ||
4792 | session->session_state = 1<<NFS4_SESSION_INITING; | 4804 | session->session_state = 1<<NFS4_SESSION_INITING; |
4793 | 4805 | ||