Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.com
Tested-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
3d75948b 6888da81

+4
+4
drivers/target/target_core_tmr.c
··· 124 124 int i; 125 125 126 126 for (i = 0; i < dev->queue_cnt; i++) { 127 + flush_work(&dev->queues[i].sq.work); 128 + 127 129 spin_lock_irqsave(&dev->queues[i].lock, flags); 128 130 list_for_each_entry_safe(se_cmd, next, &dev->queues[i].state_list, 129 131 state_list) { ··· 304 302 * in the Control Mode Page. 305 303 */ 306 304 for (i = 0; i < dev->queue_cnt; i++) { 305 + flush_work(&dev->queues[i].sq.work); 306 + 307 307 spin_lock_irqsave(&dev->queues[i].lock, flags); 308 308 list_for_each_entry_safe(cmd, next, &dev->queues[i].state_list, 309 309 state_list) {