From: Dongli Zhang Date: Fri, 29 May 2020 17:31:08 +0000 (-0700) Subject: null_blk: force complete for timeout request X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=32215469489ad2ad5139ab6fb779c9edfd61618d;p=linux.git null_blk: force complete for timeout request The commit 7b11eab041da ("blk-mq: blk-mq: provide forced completion method") exports new API to force a request to complete without error injection. There should be no error injection when completing a request by timeout handler. Otherwise, the below would hang because timeout handler is failed. echo 100 > /sys/kernel/debug/fail_io_timeout/probability echo 1000 > /sys/kernel/debug/fail_io_timeout/times echo 1 > /sys/block/nullb0/io-timeout-fail dd if=/dev/zero of=/dev/nullb0 bs=512 count=1 oflag=direct With this patch, the timeout handler is able to complete the IO. Signed-off-by: Dongli Zhang Signed-off-by: Jens Axboe --- diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 4f37b9fb28bbd..5a1548a74d628 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -1423,7 +1423,7 @@ static bool should_requeue_request(struct request *rq) static enum blk_eh_timer_return null_timeout_rq(struct request *rq, bool res) { pr_info("rq %p timed out\n", rq); - blk_mq_complete_request(rq); + blk_mq_force_complete_rq(rq); return BLK_EH_DONE; }