From: sashiko-bot@kernel.org
To: "Yingjie Wang" <x-professor@outlook.com>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
yukuai@fygo.io
Subject: Re: [PATCH 2/2] md/raid5: preserve active PPL log when removing a replacement
Date: Mon, 09 Nov 2026 09:27:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-204695@kernel.org> (raw)
In-Reply-To: <4e31c3b1c402e1b80cfd027c3441684dfd1909a6.1794215128.git.x-professor@outlook.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] md/raid5: raid5_remove_disk() fails to clear slot beyond
raid_disks with PPL
--
commit ade16f0f32de5eb72fa3bf67b1040d7514f41d37
Author: Yingjie Wang <x-professor@outlook.com>
md/raid5: preserve active PPL log when removing a replacement
This commit restricts the log_modify(conf, rdev, false) call in
raid5_remove_disk() to cases where the removed device is the slot's active
rdev rather than a replacement device, and moves clearing *rdevp after
log_modify().
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 455e36ddceeed..2f4fe416113c0 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);
[Severity: Medium]
Does moving WRITE_ONCE(*rdevp, NULL) after log_modify() prevent removing a
disk in a slot where number >= conf->raid_disks when PPL is enabled?
After shrinking an array, conf->raid_disks is smaller than conf->pool_size
while extra disks remain in conf->disks[number].rdev. If PPL is enabled
before those disks are detached, ppl_conf->count is initialized to
conf->raid_disks, and ppl_modify_log() rejects any slot at or beyond
conf->raid_disks:
drivers/md/raid5-ppl.c:ppl_modify_log() {
...
if (rdev->raid_disk >= ppl_conf->count)
return -ENODEV;
...
}
Jumping to abort on that error before clearing *rdevp leaves rdev stuck in
p->rdev, and every subsequent removal attempt fails with -ENODEV.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1794215128.git.x-professor@outlook.com?part=2
prev parent reply other threads:[~2026-11-09 9:27 UTC|newest]
Thread overview: 4+ 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 ` [PATCH 2/2] md/raid5: preserve active PPL log when removing a replacement Yingjie Wang
2026-11-09 9:27 ` sashiko-bot [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=sashiko-outbox-204695@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=x-professor@outlook.com \
--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