This should fix the filesystem corruption during RAID resync. Checking this condition in raid1_check_read_range is not ideal, but this is only a debug patch. Link: https://lore.kernel.org/lkml/20240724141906.10b4fc4e@peluse-desk5/T/#m671d6d3a7eda44d39d0882864a98824f52c52917 Signed-off-by: Mateusz Jończyk <mat.jonczyk@xxxxx> Cc: Yu Kuai <yukuai3@xxxxxxxxxx> Cc: Song Liu <song@xxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx --- drivers/md/raid1-10.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c index 2ea1710a3b70..4ab896e8cb12 100644 --- a/drivers/md/raid1-10.c +++ b/drivers/md/raid1-10.c @@ -252,6 +252,10 @@ static inline int raid1_check_read_range(struct md_rdev *rdev, sector_t first_bad; int bad_sectors; + if (!test_bit(In_sync, &rdev->flags) && + rdev->recovery_offset < this_sector + *len) + return 0; + /* no bad block overlap */ if (!is_badblock(rdev, this_sector, *len, &first_bad, &bad_sectors)) return *len; -- 2.25.1