All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-block@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	Damien Le Moal <damien.lemoal@wdc.com>,
	Jens Axboe <axboe@kernel.dk>
Subject: [PATCH] null_blk: execute complete callback for fake timeout request
Date: Sun, 12 Mar 2023 21:35:56 +0900	[thread overview]
Message-ID: <20230312123556.12298-1-akinobu.mita@gmail.com> (raw)

When injecting a fake timeout into the null_blk driver by fail_io_timeout,
the request timeout handler doen't execute blk_mq_complete_request(), so
the complete callback will never be executed for that timed out request.

The null_blk driver also has a driver-specific fake timeout mechanism and
does not have the problem that occur when using the generic one.
Fix the problem by doing similar to what the driver-specific one does.

Fixes: de3510e52b0a ("null_blk: fix command timeout completion handling")
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/block/null_blk/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 4c601ca9552a..69250b3cfecd 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1413,7 +1413,9 @@ static inline void nullb_complete_cmd(struct nullb_cmd *cmd)
 	case NULL_IRQ_SOFTIRQ:
 		switch (cmd->nq->dev->queue_mode) {
 		case NULL_Q_MQ:
-			if (likely(!blk_should_fake_timeout(cmd->rq->q)))
+			if (unlikely(blk_should_fake_timeout(cmd->rq->q)))
+				cmd->fake_timeout = true;
+			else
 				blk_mq_complete_request(cmd->rq);
 			break;
 		case NULL_Q_BIO:
-- 
2.34.1


             reply	other threads:[~2023-03-12 12:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-12 12:35 Akinobu Mita [this message]
2023-03-13  1:00 ` [PATCH] null_blk: execute complete callback for fake timeout request Damien Le Moal
2023-03-13 16:39   ` Akinobu Mita
2023-03-13 16:50   ` Keith Busch
2023-03-14  3:56     ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230312123556.12298-1-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.