Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Chengyu Liu <lui2012qwq@gmail.com>
To: linux-raid@vger.kernel.org
Cc: song@kernel.org, yukuai@fygo.io, Chengyu Liu <lui2012qwq@gmail.com>
Subject: [PATCH v2] md/bitmap: fix missing_pages restore in resize rollback
Date: Sun,  8 Nov 2026 01:57:34 +0800	[thread overview]
Message-ID: <20261107175734.25918-1-lui2012qwq@gmail.com> (raw)

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")
Signed-off-by: Chengyu Liu <lui2012qwq@gmail.com>
---
v2: add Fixes tag (spotted by sashiko)
v1: https://lore.kernel.org/linux-raid/20261107164305.11476-1-lui2012qwq@gmail.com/

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

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index b8325cb09a37..66ed92a0715b 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -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 =
-- 
2.25.1

             reply	other threads:[~2026-11-07 17:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 17:57 Chengyu Liu [this message]
2026-11-11  1:23 ` [PATCH v2] md/bitmap: fix missing_pages restore in resize rollback 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=20261107175734.25918-1-lui2012qwq@gmail.com \
    --to=lui2012qwq@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=yukuai@fygo.io \
    /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