Re: [PATCH v2 1/3] md/raid10: fix still_degraded being inverted in raid10_sync_request()
From: yu kuai
Date: Fri Aug 07 2026 - 04:29:20 EST
在 2026/7/23 21:55, Yunye Zhao 写道:
> Commit fe6a19d40ceb ("md/md-bitmap: merge md_bitmap_start_sync() into
> bitmap_operations") converted still_degraded from int to bool, but
> inverted the assignment in the loop that checks whether the array will
> still be degraded after the current device is recovered:
> "still_degraded = 1" became "still_degraded = false".
>
> As a result, recovering a device while another mirror is still missing
> calls md_bitmap_start_sync() with degraded == false, which clears bitmap
> bits that the still-missing device needs. When that device is re-added,
> its bitmap-based recovery finds the bits already cleared and skips every
> region written while the array was degraded, so it is marked In_sync
> while holding stale data: silent corruption.
>
> Reproducer (raid10 near=2, 4 disks, internal bitmap):
> - fail and remove one disk of each mirror pair
> - write to the degraded array
> - re-add both disks and let recovery finish
> - "check" reports mismatch_cnt=262272 after 256 MiB of degraded
> writes and file contents differ; the second disk's "recovery"
> completes in milliseconds because everything is skipped
>
> The same conversion in raid1 got it right (still_degraded = true).
> Restore the correct value.
>
> Fixes: fe6a19d40ceb ("md/md-bitmap: merge md_bitmap_start_sync() into bitmap_operations")
> Cc:stable@xxxxxxxxxxxxxxx
> Signed-off-by: Yunye Zhao<yunye.zhao@xxxxxxxxxxxxxxxxx>
> ---
> drivers/md/raid10.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to md-7.3
--
Thanks,
Kuai