Skip to content

Commit 63f8865

Browse files
Damien Le Moalaxboe
authored andcommitted
block: null_blk: Fix handling of fake timeout request
When injecting a fake timeout into the null_blk driver using fail_io_timeout, the request timeout handler does not execute blk_mq_complete_request(), so the complete callback is never executed for a timedout request. The null_blk driver also has a driver-specific fake timeout mechanism which does not have this problem. Fix the problem with fail_io_timeout by using the same meachanism as null_blk internal timeout feature, using the fake_timeout field of null_blk commands. Reported-by: Akinobu Mita <[email protected]> Fixes: de3510e ("null_blk: fix command timeout completion handling") Signed-off-by: Damien Le Moal <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 00e885e commit 63f8865

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/block/null_blk/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,8 +1413,7 @@ static inline void nullb_complete_cmd(struct nullb_cmd *cmd)
14131413
case NULL_IRQ_SOFTIRQ:
14141414
switch (cmd->nq->dev->queue_mode) {
14151415
case NULL_Q_MQ:
1416-
if (likely(!blk_should_fake_timeout(cmd->rq->q)))
1417-
blk_mq_complete_request(cmd->rq);
1416+
blk_mq_complete_request(cmd->rq);
14181417
break;
14191418
case NULL_Q_BIO:
14201419
/*
@@ -1675,7 +1674,8 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,
16751674
cmd->rq = bd->rq;
16761675
cmd->error = BLK_STS_OK;
16771676
cmd->nq = nq;
1678-
cmd->fake_timeout = should_timeout_request(bd->rq);
1677+
cmd->fake_timeout = should_timeout_request(bd->rq) ||
1678+
blk_should_fake_timeout(bd->rq->q);
16791679

16801680
blk_mq_start_request(bd->rq);
16811681

0 commit comments

Comments
 (0)