Re: [bug report] WARNING at block/mq-deadline.c:600 dd_exit_sched+0x1c6/0x260 triggered with blktests block/031

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
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@xxxxxx>
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux