All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Yi Zhang <yi.zhang@redhat.com>
Cc: linux-block <linux-block@vger.kernel.org>
Subject: Re: [bug report] WARNING at block/mq-deadline.c:600 dd_exit_sched+0x1c6/0x260 triggered with blktests block/031
Date: Sat, 27 Nov 2021 00:24:56 +0800	[thread overview]
Message-ID: <YaEKWPlAmDJYV6Si@T590> (raw)
In-Reply-To: <YaBGI7bR/9ot514F@T590>

On Fri, Nov 26, 2021 at 10:27:47AM +0800, Ming Lei wrote:
> Hi Yi,
> 
> On Thu, Nov 25, 2021 at 07:02:43PM +0800, Yi Zhang wrote:
> > Hello
> > 
> > blktests block/031 triggered below WARNING with latest
> > linux-block/for-next[1], pls check it.
> > 
> > [1]
> > f0afafc21027 (HEAD, origin/for-next) Merge branch 'for-5.17/io_uring'
> > into for-next
> 
> After running block/031 for several times in today's linus tree, not
> reproduce the issue:

Yi, it should be one for-5.17/block only issue, please test the
following patch:


From 13b6abb5545f08bbe7dfea34a1bfc186e04932ac Mon Sep 17 00:00:00 2001
From: Ming Lei <ming.lei@redhat.com>
Date: Sat, 27 Nov 2021 00:19:43 +0800
Subject: [PATCH] blk-mq: use bio->bi_opf after bio is checked

bio->bi_opf isn't finalized before checking the bio, so use it after
submit_bio_checks() returns.

Fixes: f1880d26e517 ("blk-mq: cleanup request allocation")
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 82491ab676fb..b57c4373e59b 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2712,7 +2712,6 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
 	struct blk_mq_alloc_data data = {
 		.q		= q,
 		.nr_tags	= 1,
-		.cmd_flags	= bio->bi_opf,
 	};
 	struct request *rq;
 
@@ -2725,6 +2724,8 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
 
 	rq_qos_throttle(q, bio);
 
+	/* ->bi_opf is finalized after submit_bio_checks() returns */
+	data.cmd_flags	= bio->bi_opf;
 	if (plug) {
 		data.nr_tags = plug->nr_ios;
 		plug->nr_ios = 1;
-- 
2.31.1



Thanks, 
Ming


  parent reply	other threads:[~2021-11-26 16:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25 11:02 [bug report] WARNING at block/mq-deadline.c:600 dd_exit_sched+0x1c6/0x260 triggered with blktests block/031 Yi Zhang
2021-11-26  2:27 ` Ming Lei
     [not found]   ` <CAHj4cs8L0Q0oS2RgNOr+cC55NeALKCYW_BzeFxctWvcrub-iVQ@mail.gmail.com>
2021-11-26  9:10     ` Ming Lei
2021-11-26 16:24   ` Ming Lei [this message]
2021-11-26 16:38     ` Jens Axboe
2021-11-27  2:19       ` Yi Zhang

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=YaEKWPlAmDJYV6Si@T590 \
    --to=ming.lei@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=yi.zhang@redhat.com \
    /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.