From: Christoph Hellwig <hch@lst.de>
To: Yu Kuai <yukuai@fnnas.com>
Cc: Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
Keith Busch <kbusch@meta.com>,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
axboe@kernel.dk
Subject: Re: [PATCHv5 1/2] block: accumulate memory segment gaps per bio
Date: Tue, 11 Nov 2025 10:39:03 +0100 [thread overview]
Message-ID: <20251111093903.GB14438@lst.de> (raw)
In-Reply-To: <024631dc-3c65-49a8-a97a-f9110fd00e9a@fnnas.com>
On Tue, Nov 11, 2025 at 05:36:39PM +0800, Yu Kuai wrote:
> This can be reproduced 100% with branch for-6.19/block now, just:
>
> blkdiscard /dev/md0
>
> Where discard IO will be split to different underlying disks and then
> merge. And for discard bio, bio->bi_io_vec is NULL. So when discard
> bio ends up to the merge path, bio->bi_io_vec will be dereferenced
> unconditionally.
Ah, so it's not a NULL req->bio but bio->bi_io_vec.
>
> How about following simple fix:
>
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 3ca6fbf8b787..31f460422fe3 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -740,6 +740,9 @@ u8 bio_seg_gap(struct request_queue *q, struct bio *prev, struct bio *next,
> gaps_bit = min_not_zero(gaps_bit, prev->bi_bvec_gap_bit);
> gaps_bit = min_not_zero(gaps_bit, next->bi_bvec_gap_bit);
>
> + if (op_is_discard(prev->bi_opf) || op_is_discard(next->bi_opf))
> + return gaps_bit;
> +
I think the problem is how we even end up here? The only merging
for discard should be the special multi-segment merge. So I think
something higher up is messed up
next prev parent reply other threads:[~2025-11-11 9:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 15:04 [PATCHv5 0/2] block, nvme: removing virtual boundary mask reliance Keith Busch
2025-10-14 15:04 ` [PATCHv5 1/2] block: accumulate memory segment gaps per bio Keith Busch
2025-10-14 21:18 ` Martin K. Petersen
2025-10-15 4:08 ` Christoph Hellwig
2025-11-11 4:26 ` Matthew Wilcox
2025-11-11 4:50 ` Keith Busch
2025-11-11 7:14 ` Christoph Hellwig
2025-11-11 9:36 ` Yu Kuai
2025-11-11 9:39 ` Christoph Hellwig [this message]
2025-11-11 10:14 ` Yu Kuai
2025-11-11 13:25 ` Keith Busch
2025-11-11 13:40 ` Christoph Hellwig
2025-11-11 13:54 ` Keith Busch
2025-11-11 13:58 ` Christoph Hellwig
2025-11-11 14:03 ` Yu Kuai
2025-10-14 15:04 ` [PATCHv5 2/2] nvme: remove virtual boundary for sgl capable devices Keith Busch
2025-10-14 21:19 ` Martin K. Petersen
2025-11-07 1:03 ` [PATCHv5 0/2] block, nvme: removing virtual boundary mask reliance Keith Busch
2025-11-07 1:12 ` Jens Axboe
2025-11-07 1:12 ` Jens Axboe
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=20251111093903.GB14438@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=willy@infradead.org \
--cc=yukuai@fnnas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox