]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: core: Run queue when state is set to running after being blocked
authorzhengbin <zhengbin13@huawei.com>
Fri, 22 Mar 2019 02:56:46 +0000 (10:56 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 28 Mar 2019 01:21:07 +0000 (21:21 -0400)
commitf8402e71157d95a9b704fd0b7a9f4da302633f5f
treec6cbeb81c888d70a14616e2b425a1b2cdcfb1ce5
parentdaf2ed120c2fd334bbf68b5709404ad4f7237228
scsi: core: Run queue when state is set to running after being blocked

Use dd to test a SCSI device:

  1. echo "blocked" >/sys/block/sda/device/state
  2. dd if=/dev/sda of=/mnt/t.log bs=1M count=10
  3. echo "running" >/sys/block/sda/device/state

dd should finish this work after step 3, but it hangs.

After step2, the call chain is this:

blk_mq_dispatch_rq_list-->scsi_queue_rq-->prep_to_mq

prep_to_mq will return BLK_STS_RESOURCE, and scsi_queue_rq will
transition it to BLK_STS_DEV_RESOURCE which means that driver can
guarantee that IO dispatch will be triggered in future when the
resource is available.  Need to follow the rule if we set the device
state to running.

[mkp: tweaked commit description and code comment as suggested by Bart]

Signed-off-by: zhengbin <zhengbin13@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_sysfs.c