Skip to content

Commit 7701e68

Browse files
committed
md/md-llbitmap: skip reading rdevs that are not in_sync
When reading bitmap pages from member disks, the code iterates through all rdevs and attempts to read from the first available one. However, it only checks for raid_disk assignment and Faulty flag, missing the In_sync flag check. This can cause bitmap data to be read from spare disks that are still being rebuilt and don't have valid bitmap information yet. Reading stale or uninitialized bitmap data from such disks can lead to incorrect dirty bit tracking, potentially causing data corruption during recovery or normal operation. Add the In_sync flag check to ensure bitmap pages are only read from fully synchronized member disks that have valid bitmap data. Cc: stable@vger.kernel.org Fixes: 5ab829f ("md/md-llbitmap: introduce new lockless bitmap") Link: https://lore.kernel.org/linux-raid/20260223024038.3084853-2-yukuai@fnnas.com Signed-off-by: Yu Kuai <yukuai@fnnas.com>
1 parent d51e166 commit 7701e68

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/md/md-llbitmap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ static struct page *llbitmap_read_page(struct llbitmap *llbitmap, int idx)
459459
rdev_for_each(rdev, mddev) {
460460
sector_t sector;
461461

462-
if (rdev->raid_disk < 0 || test_bit(Faulty, &rdev->flags))
462+
if (rdev->raid_disk < 0 || test_bit(Faulty, &rdev->flags) ||
463+
!test_bit(In_sync, &rdev->flags))
463464
continue;
464465

465466
sector = mddev->bitmap_info.offset +

0 commit comments

Comments
 (0)