diff options
author | Yufen Yu <yuyufen@huawei.com> | 2022-08-03 10:33:55 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-08-18 07:39:01 -0600 |
commit | d3b38596875dbc709b4e721a5873f4663d8a9ea2 (patch) | |
tree | 879990ea953bb5783af1fe7d917ac153cd9159a6 /kernel/cfi.c | |
parent | a8239f0342bae5a51acca967ba95b9a8ad56dd62 (diff) | |
download | linux-d3b38596875dbc709b4e721a5873f4663d8a9ea2.tar.bz2 |
blk-mq: run queue no matter whether the request is the last request
We do test on a virtio scsi device (/dev/sda) and the default mq
scheduler is 'none'. We found a IO hung as following:
blk_finish_plug
blk_mq_plug_issue_direct
scsi_mq_get_budget
//get budget_token fail and sdev->restarts=1
scsi_end_request
scsi_run_queue_async
//sdev->restart=0 and run queue
blk_mq_request_bypass_insert
//add request to hctx->dispatch list
//continue to dispath plug list
blk_mq_dispatch_plug_list
blk_mq_try_issue_list_directly
//success issue all requests from plug list
After .get_budget fail, scsi_mq_get_budget will increase 'restarts'.
Normally, it will run hw queue when io complete and set 'restarts'
as 0. But if we run queue before adding request to the dispatch list
and blk_mq_dispatch_plug_list also success issue all requests, then
on one will run queue, and the request will be stall in the dispatch
list and cannot complete forever.
It is wrong to use last request of plug list to decide if run queue is
needed since all the remained requests in plug list may be from other
hctxs. To fix the bug, pass run_queue as true always to
blk_mq_request_bypass_insert().
Fix-suggested-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Fixes: dc5fc361d891 ("block: attempt direct issue of plug list")
Link: https://lore.kernel.org/r/20220803023355.3687360-1-yuyufen@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'kernel/cfi.c')
0 files changed, 0 insertions, 0 deletions