From: sashiko-bot@kernel.org
To: "Yunye Zhao" <yunye.zhao@linux.alibaba.com>, linux-raid@vger.kernel.org
Cc: yukuai@fygo.io
Subject: Re: [PATCH 6.6.y] md/raid0: fix data corruption when chunk size is below PAGE_SIZE
Date: Tue, 13 Oct 2026 13:44:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-169850@kernel.org> (raw)
In-Reply-To: <20261013133243.42145-1-yunye.zhao@linux.alibaba.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] md: missing queue freeze before blk_queue_chunk_sectors()
--
commit b6776719727e7cf128eed60b1bbe45a3b0836f15
Author: YunyeZhao <yunye.zhao@linux.alibaba.com>
md/raid0: fix data corruption when chunk size is below PAGE_SIZE
Fixes silent data corruption that occurs when bios spanning multiple RAID0
chunks are not split properly by the block layer. Sets the chunk boundary
after stacking member limits to ensure block-layer bio splitting respects
the RAID0 chunk size.
> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> index c50a7abda744a..5a57e327c6ba4 100644
> --- a/drivers/md/raid0.c
> +++ b/drivers/md/raid0.c
[ ... ]
> @@ -413,6 +415,18 @@ static int raid0_run(struct mddev *mddev)
> disk_stack_limits(mddev->gendisk, rdev->bdev,
> rdev->data_offset << 9);
> }
> +
> + /*
> + * Set the chunk boundary after stacking member limits, which
> + * may clear or reduce it. Without it a bio may span several
> + * chunks when chunk size < PAGE_SIZE. Keep it a multiple of
> + * the logical block size so the block layer can split at it.
> + */
> + chunk_limit = gcd(mddev->queue->limits.chunk_sectors,
> + mddev->chunk_sectors);
> + if (!(chunk_limit %
> + (mddev->queue->limits.logical_block_size >> SECTOR_SHIFT)))
> + blk_queue_chunk_sectors(mddev->queue, chunk_limit);
[Severity: High]
Could modifying the block queue limits here without freezing the queue expose
the block layer to torn limit reads?
When an array is reconfigured, raid0_run() is invoked to update limits. While
mddev_suspend() is used during reconfiguration, it only drains
mddev->active_io, which pauses bios deep in the MD stack at
md_handle_request().
It does not prevent new bios from entering the generic block layer via
submit_bio_noacct() and executing blk_queue_split(). Because the queue is not
frozen via blk_mq_freeze_queue(), these concurrent bios might read torn
values of q->limits.chunk_sectors while raid0_run() modifies it, potentially
leading to inconsistent splitting and silent data corruption.
> }
>
> /* calculate array device size */
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013133243.42145-1-yunye.zhao@linux.alibaba.com?part=1
prev parent reply other threads:[~2026-10-13 13:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 13:32 [PATCH 6.6.y] md/raid0: fix data corruption when chunk size is below PAGE_SIZE Yunye Zhao
2026-10-13 13:44 ` sashiko-bot [this message]
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=sashiko-outbox-169850@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yukuai@fygo.io \
--cc=yunye.zhao@linux.alibaba.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.