• Z
    blk-mq: fix a hung issue when set device state to blocked and restore running · 448bb22e
    zhengbin 提交于
    euler inclusion
    category: bugfix
    bugzilla: 12808
    CVE: NA
    
    ---------------------------
    
    When I use dd test a SCSI device which use blk-mq in the following steps:
    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, unfortunately, still hung.
    
    After step2, the key code process is like 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 transter
    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.
    Signed-off-by: Nzhengbin <zhengbin13@huawei.com>
    Reviewed-by: NJason Yan <yanaijie@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    448bb22e
scsi_sysfs.c 41.1 KB