SCSI fixes on 20210828

A single fix for a race introduced by a fix that went up in 5.14-rc5.
 
 Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com>
 -----BEGIN PGP SIGNATURE-----
 
 iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCYSp3/SYcamFtZXMuYm90
 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishUeaAQD63ivy
 fSrg0CeNZL2UVM2mUT3GxuXBXvwVj56pFUscxAD/ajpaWc8YkCkG0AvCXrCVY0SZ
 SAj9xRZX0Ox6jzLT1Uk=
 =qWVH
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2021-08-28 11:39:16 -07:00
commit 3f5ad13cb0

View File

@ -808,12 +808,15 @@ store_state_field(struct device *dev, struct device_attribute *attr,
ret = scsi_device_set_state(sdev, state); ret = scsi_device_set_state(sdev, state);
/* /*
* If the device state changes to SDEV_RUNNING, we need to * If the device state changes to SDEV_RUNNING, we need to
* rescan the device to revalidate it, and run the queue to * run the queue to avoid I/O hang, and rescan the device
* avoid I/O hang. * to revalidate it. Running the queue first is necessary
* because another thread may be waiting inside
* blk_mq_freeze_queue_wait() and because that call may be
* waiting for pending I/O to finish.
*/ */
if (ret == 0 && state == SDEV_RUNNING) { if (ret == 0 && state == SDEV_RUNNING) {
scsi_rescan_device(dev);
blk_mq_run_hw_queues(sdev->request_queue, true); blk_mq_run_hw_queues(sdev->request_queue, true);
scsi_rescan_device(dev);
} }
mutex_unlock(&sdev->state_mutex); mutex_unlock(&sdev->state_mutex);