Re: [PATCH v5 27/29] md/raid5: reject llbitmap reshape when md chunk shrinks
[email protected] Sun, 02 Aug 2026 20:42:59 +0000
| Newsgroups | org.kernel.vger.linux-raid |
|---|---|
| Message-ID | <[email protected]> |
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 llbi= tmap 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 <[email protected]> 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. > 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 [ ... ] > @@ -8580,6 +8580,9 @@ static int check_reshape(struct mddev *mddev) > if (!check_stripe_cache(mddev)) > return -ENOSPC; > =20 > + if (mddev->bitmap_id =3D=3D 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, --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260802195038.1642= [email protected]?part=3D27