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/#m671d6d... Signed-off-by: Mateusz Jończyk mat.jonczyk@o2.pl Cc: Yu Kuai yukuai3@huawei.com Cc: Song Liu song@kernel.org Cc: stable@vger.kernel.org --- 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;