Thread (54 messages) flat view 54 messages, 3 authors, 20h ago

Re: [PATCH v5 27/29] md/raid5: reject llbitmap reshape when md chunk shrinks

From: sashiko-bot@kernel.org
Date: 2026-08-02 20:43:00

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incomplete check for shrinking sectors_per_chunk during RAID5 llbitmap reshape allows unsupported geometry changes.
--
--- Patch [27]: [PATCH v5 27/29] md/raid5: reject llbitmap reshape when md chunk shrinks ---
commit 25700e5b0d24da1aa9addea044a934a4d475781a
Author: Yu Kuai [off-list ref]

md/raid5: reject llbitmap reshape when md chunk shrinks

This commit prevents llbitmap reshapes from proceeding when the md chunk
size shrinks, as this reduces the effective data range covered by each
bitmap bit.
quoted hunk ↗ jump to hunk
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 88bf5a9ce5737..67d56c92c8a44 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -8580,6 +8580,9 @@ static int check_reshape(struct mddev *mddev)
 	if (!check_stripe_cache(mddev))
 		return -ENOSPC;
 
+	if (mddev->bitmap_id == ID_LLBITMAP &&
+	    mddev->new_chunk_sectors < mddev->chunk_sectors)
+		return -EOPNOTSUPP;
[Severity: High]
Does this check adequately cover reshapes that remove disks?

Looking at raid5_bitmap_sector_map(), sectors_per_chunk is calculated as
chunk_sectors * (raid_disks - max_degraded). If a reshape removes disks
(delta_disks < 0), the number of data disks decreases.

This means the effective sectors_per_chunk can shrink even if
new_chunk_sectors is equal to or slightly larger than chunk_sectors.

Will omitting a check for delta_disks < 0 allow these shrinking reshapes
to proceed, causing a single bitmap bit to incorrectly map to a smaller
logical data range and potentially corrupting the dirty bit mapping?
 	if (mddev->new_chunk_sectors > mddev->chunk_sectors ||
 	    mddev->delta_disks > 0)
 		if (resize_chunks(conf,
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260802195038.164272-1-yukuai@kernel.org?part=27
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help