]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
md/raid10: fix any_working flag handling in raid10_sync_request
authorLi Nan <linan122@huawei.com>
Mon, 5 Jan 2026 11:02:58 +0000 (19:02 +0800)
committerYu Kuai <yukuai@fnnas.com>
Mon, 26 Jan 2026 05:16:25 +0000 (13:16 +0800)
In raid10_sync_request(), 'any_working' indicates if any IO will
be submitted. When there's only one In_sync disk with badblocks,
'any_working' might be set to 1 but no IO is submitted. Fix it by
setting 'any_working' after badblock checks.

Link: https://lore.kernel.org/linux-raid/20260105110300.1442509-11-linan666@huaweicloud.com
Fixes: e875ecea266a ("md/raid10 record bad blocks as needed during recovery.")
Signed-off-by: Li Nan <linan122@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Yu Kuai <yukuai@fnnas.com>
drivers/md/raid10.c

index 7fe363729a5a115e4bff5d828c9db038bafd58ce..b258ed8b4e3af3753548d4319593dd9d8c408c0c 100644 (file)
@@ -3395,7 +3395,6 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
                                    !test_bit(In_sync, &rdev->flags))
                                        continue;
                                /* This is where we read from */
-                               any_working = 1;
                                sector = r10_bio->devs[j].addr;
 
                                if (is_badblock(rdev, sector, max_sync,
@@ -3410,6 +3409,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
                                                continue;
                                        }
                                }
+                               any_working = 1;
                                bio = r10_bio->devs[0].bio;
                                bio->bi_next = biolist;
                                biolist = bio;