Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 5ab829f1971d ("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>

Yu Kuai 7701e68b d51e1668

+2 -1
+2 -1
drivers/md/md-llbitmap.c
··· 459 459 rdev_for_each(rdev, mddev) { 460 460 sector_t sector; 461 461 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)) 463 464 continue; 464 465 465 466 sector = mddev->bitmap_info.offset +