Skip to contentSkip to conversation

md/bitmap: fix missing_pages restore in resize rollback

PATCH Superseded Chengyu Liu 2 participants 3 messages Nov 7 MD RAID

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 md/bitmap: fix missing_pages restore in resize rollback

The rollback for a failed clustered-raid bitmap preallocation copies old_counts.pages into missing_pages instead of old_counts.missing_pages. The counter then reports every page as missing and can grow past the page count as pages are freed later, making the used_pages stat in /proc/mdstat wrap around. Accounting only, no corruption.

---
 drivers/md/md-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md-bitmap.c +1 -1
index b8325cb09a37..66ed92a0715b 100644
@@ -2495,7 +2495,7 @@
 				/* restore some fields from old_counts */
 				bitmap->counts.bp = old_counts.bp;
 				bitmap->counts.pages = old_counts.pages;
-				bitmap->counts.missing_pages = old_counts.pages;
+				bitmap->counts.missing_pages = old_counts.missing_pages;
 				bitmap->counts.chunkshift = old_counts.chunkshift;
 				bitmap->counts.chunks = old_counts.chunks;
 				bitmap->mddev->bitmap_info.chunksize =
Signature · 1 line
2.25.1
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] md/bitmap: missing Fixes trailer for commit c9d650322829 --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] md/bitmap: missing Fixes trailer for commit c9d650322829 --

commit 5db0c6c47a033569a681ebcef85c2c4ea4329e98
Author: Chengyu Liu <[email protected]>

Quoted 9 lines

md/bitmap: fix missing_pages restore in resize rollback

The rollback for a failed clustered-raid bitmap preallocation copies old_counts.pages into missing_pages instead of old_counts.missing_pages. The counter then reports every page as missing and can grow past the page count as pages are freed later, making the used_pages stat in /proc/mdstat wrap around. Accounting only, no corruption.

[Severity: Low]
Should this include a Fixes tag for the commit that introduced the preallocation rollback in __bitmap_resize()?

Fixes c9d650322829 ("md-cluster: always setup in-memory bitmap")
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
Quoted 1 line · On Sun, Nov 8, 2026 at 12:53 AM <[email protected]> wrote:

- [Low] md/bitmap: missing Fixes trailer for commit c9d650322829

Thanks, v2 sent with the Fixes tag.