Skip to contentSkip to conversation

md/bitmap: fix missing_pages restore in resize rollback

PATCH Applied Chengyu Liu 2 participants 2 messages Nov 7 – Nov 11 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

Fixes c9d650322829 ("md-cluster: always setup in-memory bitmap")

---
v2: add Fixes tag (spotted by sashiko)
v1: https://lore.kernel.org/linux-raid/[email protected]/

 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
maintainer Applied
#1 lore raw
Quoted 6 lines · Chengyu Liu

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.

Quoted 8 lines
Fixes c9d650322829 ("md-cluster: always setup in-memory bitmap")

---
v2: add Fixes tag (spotted by sashiko) v1:https://lore.kernel.org/linux-raid/[email protected]/

  drivers/md/md-bitmap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Applied

Signature · 2 lines
Thanks,
Kuai