From: Yu Kuai <yukuai@fnnas.com>
To: song@kernel.org
Cc: linan122@huawei.com, xni@redhat.com, colyli@fnnas.com,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/5] md/md-llbitmap: skip reading rdevs that are not in_sync
Date: Mon, 23 Feb 2026 10:40:34 +0800 [thread overview]
Message-ID: <20260223024038.3084853-2-yukuai@fnnas.com> (raw)
In-Reply-To: <20260223024038.3084853-1-yukuai@fnnas.com>
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")
Signed-off-by: Yu Kuai <yukuai@fnnas.com>
---
drivers/md/md-llbitmap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/md-llbitmap.c b/drivers/md/md-llbitmap.c
index cd713a7dc270..30d7e36b22c4 100644
--- a/drivers/md/md-llbitmap.c
+++ b/drivers/md/md-llbitmap.c
@@ -459,7 +459,8 @@ static struct page *llbitmap_read_page(struct llbitmap *llbitmap, int idx)
rdev_for_each(rdev, mddev) {
sector_t sector;
- if (rdev->raid_disk < 0 || test_bit(Faulty, &rdev->flags))
+ if (rdev->raid_disk < 0 || test_bit(Faulty, &rdev->flags) ||
+ !test_bit(In_sync, &rdev->flags))
continue;
sector = mddev->bitmap_info.offset +
--
2.51.0
next prev parent reply other threads:[~2026-02-23 2:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 2:40 [PATCH v2 0/5] md/md-llbitmap: fixes and proactive parity building support Yu Kuai
2026-02-23 2:40 ` Yu Kuai [this message]
2026-03-09 7:32 ` [PATCH v2 1/5] md/md-llbitmap: skip reading rdevs that are not in_sync Xiao Ni
2026-02-23 2:40 ` [PATCH v2 2/5] md/md-llbitmap: raise barrier before state machine transition Yu Kuai
2026-03-09 13:05 ` Xiao Ni
2026-03-15 16:57 ` Yu Kuai
2026-02-23 2:40 ` [PATCH v2 3/5] md: add fallback to correct bitmap_ops on version mismatch Yu Kuai
2026-03-10 1:06 ` Xiao Ni
2026-03-15 17:01 ` Yu Kuai
2026-02-23 2:40 ` [PATCH v2 4/5] md/md-llbitmap: add CleanUnwritten state for RAID-5 proactive parity building Yu Kuai
2026-03-13 3:16 ` Xiao Ni
2026-03-17 3:36 ` Yu Kuai
2026-02-23 2:40 ` [PATCH v2 5/5] md/md-llbitmap: optimize initial sync with write_zeroes_unmap support Yu Kuai
2026-03-13 8:12 ` Xiao Ni
2026-03-22 18:30 ` [PATCH v2 0/5] md/md-llbitmap: fixes and proactive parity building support Yu Kuai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260223024038.3084853-2-yukuai@fnnas.com \
--to=yukuai@fnnas.com \
--cc=colyli@fnnas.com \
--cc=linan122@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=xni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®