From: Yingjie Wang <x-professor@outlook.com>
To: Song Liu <song@kernel.org>
Cc: Yu Kuai <yukuai@fygo.io>, Li Nan <magiclinan@didiglobal.com>,
Xiao Ni <xiao@kernel.org>,
Artur Paszkiewicz <artur.paszkiewicz@intel.com>,
"linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: [PATCH 2/2] md/raid5: preserve active PPL log when removing a replacement
Date: Mon, 9 Nov 2026 09:05:40 +0000 [thread overview]
Message-ID: <4e31c3b1c402e1b80cfd027c3441684dfd1909a6.1794215128.git.x-professor@outlook.com> (raw)
In-Reply-To: <cover.1794215128.git.x-professor@outlook.com>
raid5_remove_disk() selects either the active member or its replacement,
but then clears the slot PPL log regardless of which device is being
removed. Removing an unpromoted replacement therefore sets log->rdev to
NULL even though the active member remains in the slot.
ppl_write_stripe() subsequently returns -EAGAIN for that slot, which
lets ops_run_io() dispatch the writes without first recording them in
PPL.
Only change the PPL log when the active rdev is removed. Keep it attached
to the active member while an unpromoted replacement is detached.
Fixes: 6358c239d88c ("raid5-ppl: support disk hot add/remove with PPL")
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <x-professor@outlook.com>
---
drivers/md/raid5.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 455e36ddceee..2f4fe416113c 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8474,12 +8474,12 @@ static int raid5_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
err = -EBUSY;
goto abort;
}
- WRITE_ONCE(*rdevp, NULL);
- if (!err) {
+ if (rdev == p->rdev) {
err = log_modify(conf, rdev, false);
if (err)
goto abort;
}
+ WRITE_ONCE(*rdevp, NULL);
tmp = p->replacement;
if (tmp) {
--
2.43.0
prev parent reply other threads:[~2026-11-09 9:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 9:05 [PATCH 0/2] md/raid5: fix PPL disk add and replacement removal Yingjie Wang
2026-11-09 9:05 ` [PATCH 1/2] md/raid5: roll back failed PPL disk additions Yingjie Wang
2026-11-09 9:05 ` Yingjie Wang [this message]
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=4e31c3b1c402e1b80cfd027c3441684dfd1909a6.1794215128.git.x-professor@outlook.com \
--to=x-professor@outlook.com \
--cc=artur.paszkiewicz@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=magiclinan@didiglobal.com \
--cc=song@kernel.org \
--cc=stable@vger.kernel.org \
--cc=xiao@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
all inboxes | Powered by JetHome®