Skip to content

Commit 3f5ad13

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fix from James Bottomley: "A single fix for a race introduced by a fix that went into 5.14-rc5" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: core: Fix hang of freezing queue between blocking and running device
2 parents 447e238 + 02c6dcd commit 3f5ad13

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/scsi/scsi_sysfs.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,12 +808,15 @@ store_state_field(struct device *dev, struct device_attribute *attr,
808808
ret = scsi_device_set_state(sdev, state);
809809
/*
810810
* If the device state changes to SDEV_RUNNING, we need to
811-
* rescan the device to revalidate it, and run the queue to
812-
* avoid I/O hang.
811+
* run the queue to avoid I/O hang, and rescan the device
812+
* to revalidate it. Running the queue first is necessary
813+
* because another thread may be waiting inside
814+
* blk_mq_freeze_queue_wait() and because that call may be
815+
* waiting for pending I/O to finish.
813816
*/
814817
if (ret == 0 && state == SDEV_RUNNING) {
815-
scsi_rescan_device(dev);
816818
blk_mq_run_hw_queues(sdev->request_queue, true);
819+
scsi_rescan_device(dev);
817820
}
818821
mutex_unlock(&sdev->state_mutex);
819822

0 commit comments

Comments
 (0)