md/bitmap: fix missing_pages restore in resize rollback
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.
---
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
@@ -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
Quoted 6 lines · Chengyu Liu
The rollback for a failed clustered-raid bitmap preallocation copies old_counts.pages into
missing_pagesinstead 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 theused_pagesstat in/proc/mdstatwrap around. Accounting only, no corruption.
Quoted 8 lines
Fixes c9d650322829 ("md-cluster: always setup in-memory bitmap")Signed-off-by Chengyu Liu<[email protected]>---
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