Re: [PATCH v3 20/21] md/raid5: wire llbitmap reshape lifecycle

[email protected] Tue, 28 Jul 2026 09:21:53 +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] Setting mddev->resync_offset = 0 unconditionally upon reshape finish forces an unnecessary full parity resync for RAID5.
--

--- Patch [20]: [PATCH v3 20/21] md/raid5: wire llbitmap reshape lifecycle ---
commit 692471147c5f67f1af148855c6b48cd2fffeec7a
Author: Yu Kuai <[email protected]>

md/raid5: wire llbitmap reshape lifecycle

This commit prepares the llbitmap before a RAID5 reshape starts, checkpoints
the bitmap before advancing the reshape position, and completes the llbitmap
geometry update when the reshape finishes.

> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
[ ... ]
> @@ -8688,8 +8717,16 @@ static void raid5_finish_reshape(struct mddev *mddev)
>  {
>  	struct r5conf *conf = mddev->private;
>  	struct md_rdev *rdev;
> +	bool llbitmap = mddev->bitmap_id == ID_LLBITMAP &&
> +		md_bitmap_enabled(mddev, false);
>  
>  	if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
> +		if (llbitmap && mddev->bitmap_ops->reshape_finish)
> +			mddev->bitmap_ops->reshape_finish(mddev);
> +		if (llbitmap) {
> +			mddev->resync_offset = 0;

[Severity: High]
Does setting mddev->resync_offset to 0 here force an unnecessary full parity
resync for the array?

Since a RAID reshape already migrates data and parity, unconditionally resetting
the resync_offset to 0 informs the MD core that the parity needs to be fully
re-synchronized from sector 0.

> +			mddev->resync_max_sectors = mddev->dev_sectors;
> +		}
>  
>  		if (mddev->delta_disks <= 0) {
>  			int d;

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=20