summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2022-08-21 05:59:00 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2022-09-01 05:39:58 +0200
commita4345557527f7d9dab6684fc2d1dd7800e99d73a (patch)
tree2960db5be16c9b317c065387959c016ce4b2fe00 /drivers
parentscsi: qla2xxx: Remove unused qlt_tmr_work() (diff)
downloadlinux-a4345557527f7d9dab6684fc2d1dd7800e99d73a.tar.xz
linux-a4345557527f7d9dab6684fc2d1dd7800e99d73a.zip
scsi: qla2xxx: Always wait for qlt_sess_work_fn() from qlt_stop_phase1()
Currently qlt_stop_phase1() may fail to call flush_scheduled_work(), for list_empty() may return true as soon as qlt_sess_work_fn() called list_del(). In order to close this race window, check list_empty() after calling flush_scheduled_work(). If this patch causes problems, please check commit c4f135d64382 ("workqueue: Wrap flush_workqueue() using a macro"). We are on the way to remove all flush_scheduled_work() calls from the kernel. Link: https://lore.kernel.org/r/7f24469d-9e39-3398-d851-329b54c0b923@I-love.SAKURA.ne.jp Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index b170ebbd05b7..9013c162d4aa 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1557,11 +1557,11 @@ int qlt_stop_phase1(struct qla_tgt *tgt)
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf009,
"Waiting for sess works (tgt %p)", tgt);
spin_lock_irqsave(&tgt->sess_work_lock, flags);
- while (!list_empty(&tgt->sess_works_list)) {
+ do {
spin_unlock_irqrestore(&tgt->sess_work_lock, flags);
flush_scheduled_work();
spin_lock_irqsave(&tgt->sess_work_lock, flags);
- }
+ } while (!list_empty(&tgt->sess_works_list));
spin_unlock_irqrestore(&tgt->sess_work_lock, flags);
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00a,