Skip to content

Commit 3d75948

Browse files
mikechristiemartinkpetersen
authored andcommitted
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/[email protected] Tested-by: Laurence Oberman <[email protected]> Reviewed-by: Bodo Stroesser <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6888da8 commit 3d75948

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/target/target_core_tmr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ void core_tmr_abort_task(
124124
int i;
125125

126126
for (i = 0; i < dev->queue_cnt; i++) {
127+
flush_work(&dev->queues[i].sq.work);
128+
127129
spin_lock_irqsave(&dev->queues[i].lock, flags);
128130
list_for_each_entry_safe(se_cmd, next, &dev->queues[i].state_list,
129131
state_list) {
@@ -302,6 +304,8 @@ static void core_tmr_drain_state_list(
302304
* in the Control Mode Page.
303305
*/
304306
for (i = 0; i < dev->queue_cnt; i++) {
307+
flush_work(&dev->queues[i].sq.work);
308+
305309
spin_lock_irqsave(&dev->queues[i].lock, flags);
306310
list_for_each_entry_safe(cmd, next, &dev->queues[i].state_list,
307311
state_list) {

0 commit comments

Comments
 (0)