summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunye Zhao <yunye.zhao@linux.alibaba.com>2026-07-23 21:55:33 +0800
committerYu Kuai <yukuai@fygo.io>2026-08-07 15:25:32 +0800
commit47f1441b281decde6954a2fa82b4131637d685ac (patch)
tree074c894cf436f8198567de6913491f55c9bf47fe
parent661102bb87e43b7e476f3a2ff34e916b800b5627 (diff)
md/raid10: fix still_degraded being inverted in raid10_sync_request()
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@vger.kernel.org Signed-off-by: Yunye Zhao <yunye.zhao@linux.alibaba.com> Reviewed-by: Mykola Marzhan <mykola@meshstor.io> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de> Reviewed-by: Yu Kuai <yukuai@fygo.io> Link: https://patch.msgid.link/20260723135535.101995-2-yunye.zhao@linux.alibaba.com Signed-off-by: Yu Kuai <yukuai@fygo.io>
-rw-r--r--drivers/md/raid10.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 562a325a7195..1093c798d9dd 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3337,7 +3337,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
struct md_rdev *rdev = conf->mirrors[j].rdev;
if (rdev == NULL || test_bit(Faulty, &rdev->flags)) {
- still_degraded = false;
+ still_degraded = true;
break;
}
}