提交 3d75948b 编写于 作者: M Mike Christie 提交者: Martin K. Petersen

scsi: target: core: Flush submission work during TMR processing

If a cmd is on the submission workqueue then the TMR code will miss it, and
end up returning task not found or success for LUN resets. The fabric
driver might then tell the initiator that the running cmds have been
handled when they are about to run.

This adds a flush when we are processing TMRs to make sure queued cmds do
not run after returning the TMR response.

Link: https://lore.kernel.org/r/20210227170006.5077-25-michael.christie@oracle.comTested-by: NLaurence Oberman <loberman@redhat.com>
Reviewed-by: NBodo Stroesser <bostroesser@gmail.com>
Signed-off-by: NMike Christie <michael.christie@oracle.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 6888da81
...@@ -124,6 +124,8 @@ void core_tmr_abort_task( ...@@ -124,6 +124,8 @@ void core_tmr_abort_task(
int i; int i;
for (i = 0; i < dev->queue_cnt; i++) { for (i = 0; i < dev->queue_cnt; i++) {
flush_work(&dev->queues[i].sq.work);
spin_lock_irqsave(&dev->queues[i].lock, flags); spin_lock_irqsave(&dev->queues[i].lock, flags);
list_for_each_entry_safe(se_cmd, next, &dev->queues[i].state_list, list_for_each_entry_safe(se_cmd, next, &dev->queues[i].state_list,
state_list) { state_list) {
...@@ -302,6 +304,8 @@ static void core_tmr_drain_state_list( ...@@ -302,6 +304,8 @@ static void core_tmr_drain_state_list(
* in the Control Mode Page. * in the Control Mode Page.
*/ */
for (i = 0; i < dev->queue_cnt; i++) { for (i = 0; i < dev->queue_cnt; i++) {
flush_work(&dev->queues[i].sq.work);
spin_lock_irqsave(&dev->queues[i].lock, flags); spin_lock_irqsave(&dev->queues[i].lock, flags);
list_for_each_entry_safe(cmd, next, &dev->queues[i].state_list, list_for_each_entry_safe(cmd, next, &dev->queues[i].state_list,
state_list) { state_list) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册