Re: [PATCH v5 25/29] md/raid10: split reshape bios before bitmap accounting
From: sashiko-bot@kernel.org
Date: 2026-08-02 20:46:44
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Double-splitting a bio using the same mempool-backed bioset causes a deadlock under concurrent load. --
--- Patch [25]: [PATCH v5 25/29] md/raid10: split reshape bios before bitmap accounting ---commit 6f3a3e2c85f7d5d7d630d6c3cb813006807edbdc Author: Yu Kuai [off-list ref] md/raid10: split reshape bios before bitmap accounting Use the shared mddev_bio_split_at_reshape_offset() helper so RAID10 submits only one-side bios to llbitmap during reshape.
quoted hunk ↗ jump to hunk
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c@@ -1873,6 +1874,15 @@ static bool raid10_make_request(struct mddev *mddev, struct bio *bio) sectors = chunk_sects - (bio->bi_iter.bi_sector & (chunk_sects - 1)); + + bio = mddev_bio_split_at_reshape_offset(mddev, bio, §ors, + &conf->bio_split);
[Severity: High]
Does this introduce a mempool deadlock if we need to split the bio again later?
If this initial split succeeds, the thread holds a bio from the conf->bio_split
mempool. Later, the thread proceeds to __make_request() and then to
raid10_write_request().
If the target disks have bad blocks, max_sectors is further reduced, causing a
second split attempt from the exact same mempool:
raid10_write_request() {
...
if (max_sectors < r10_bio->sectors) {
...
bio = bio_submit_split_bioset(bio, r10_bio->sectors,
&conf->bio_split);
...
}
Since the conf->bio_split bioset is initialized with BIO_POOL_SIZE (2), if two
concurrent I/O requests cross chunk boundaries and hit bad blocks
simultaneously, could both threads allocate one bio each, and then both
permanently block in mempool_alloc() waiting for a second bio?
+ if (!bio) {
+ if (rw == WRITE)
+ md_write_end(mddev);
+ return true;
+ }
+
if (!__make_request(mddev, bio, sectors))
md_write_end(mddev);-- Sashiko AI review · https://sashiko.dev/#/patchset/20260802195038.164272-1-yukuai@kernel.org?part=25