]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
scsi: core: Run queues for all non-SDEV_DEL devices from scsi_run_host_queues
authorDavid Jeffery <djeffery@redhat.com>
Fri, 15 May 2026 18:09:41 +0000 (14:09 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 23 May 2026 01:09:23 +0000 (21:09 -0400)
commit7205b58702273baf21d6ba7992e6ba15852325f7
treeccd729f64b9420d86f258a6c0043a129332afff9
parentb71cb088b2e3427924a470fc43e7aedb8a40d2e3
scsi: core: Run queues for all non-SDEV_DEL devices from scsi_run_host_queues

While a SCSI host is in a recovery state, scsi_mq_requeue_cmd() will not
set the requeue list for a requeued command to be kicked in the future.
The expectation is a call to scsi_run_host_queues() will kick all SCSI
devices once the recovery state is cleared.

However, scsi_run_host_queues() uses shost_for_each_device() which uses
scsi_device_get() and so will ignore devices in a partially removed
state like SDEV_CANCEL. But these devices may also have requeued
requests, leaving their requests stuck from not being kicked and causing
the removal process of the device to hang.

scsi_run_host_queues() needs to run against more devices than the macro
shost_for_each_device() allows. Instead of using the too limiting
scsi_device_get() state checks, only ignore devices in SDEV_DEL state or
when unable to acquire a reference. Attempt to run the queues for all
other devices when scsi_run_host_queues() is called.

Fixes: 8b566edbdbfb ("scsi: core: Only kick the requeue list if necessary")
Signed-off-by: David Jeffery <djeffery@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260515180941.9698-1-djeffery@redhat.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c