Commit 1d726aa6 authored by Mike Christie's avatar Mike Christie Committed by Martin K. Petersen

scsi: iscsi: Optimize work queue flush use

There is no need for one session to flush the entire iscsi_eh_timer_workq
when removing/unblocking a session. During removal we need to make sure our
works are not running anymore. And iscsi_unblock_session only needs to make
sure its work is done. The unblock work function will flush/cancel the
works it has conflicts with.

Link: https://lore.kernel.org/r/1593632868-6808-3-git-send-email-michael.christie@oracle.comSigned-off-by: default avatarMike Christie <michael.christie@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e463f96b
...@@ -1978,10 +1978,11 @@ void iscsi_unblock_session(struct iscsi_cls_session *session) ...@@ -1978,10 +1978,11 @@ void iscsi_unblock_session(struct iscsi_cls_session *session)
{ {
queue_work(iscsi_eh_timer_workq, &session->unblock_work); queue_work(iscsi_eh_timer_workq, &session->unblock_work);
/* /*
* make sure all the events have completed before tell the driver * Blocking the session can be done from any context so we only
* it is safe * queue the block work. Make sure the unblock work has completed
* because it flushes/cancels the other works and updates the state.
*/ */
flush_workqueue(iscsi_eh_timer_workq); flush_work(&session->unblock_work);
} }
EXPORT_SYMBOL_GPL(iscsi_unblock_session); EXPORT_SYMBOL_GPL(iscsi_unblock_session);
...@@ -2205,11 +2206,9 @@ void iscsi_remove_session(struct iscsi_cls_session *session) ...@@ -2205,11 +2206,9 @@ void iscsi_remove_session(struct iscsi_cls_session *session)
list_del(&session->sess_list); list_del(&session->sess_list);
spin_unlock_irqrestore(&sesslock, flags); spin_unlock_irqrestore(&sesslock, flags);
/* make sure there are no blocks/unblocks queued */ flush_work(&session->block_work);
flush_workqueue(iscsi_eh_timer_workq); flush_work(&session->unblock_work);
/* make sure the timedout callout is not running */ cancel_delayed_work_sync(&session->recovery_work);
if (!cancel_delayed_work(&session->recovery_work))
flush_workqueue(iscsi_eh_timer_workq);
/* /*
* If we are blocked let commands flow again. The lld or iscsi * If we are blocked let commands flow again. The lld or iscsi
* layer should set up the queuecommand to fail commands. * layer should set up the queuecommand to fail commands.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment