From: sashiko-bot@kernel.org
To: "Jack Wang" <jinpu.wang@ionos.com>
Cc: yukuai@fygo.io, linux-raid@vger.kernel.org
Subject: Re: [PATCH v2 2/8] md: don't wait for q->limits_lock in check_sb_changes()
Date: Thu, 10 Sep 2026 08:36:02 +0000 [thread overview]
Message-ID: <20260910083603.6F8431F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260910081114.1605746-3-jinpu.wang@ionos.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Bypassing queue limit stacking for hot-added disks on cluster peer nodes leaves the array with potentially invalid queue limits.
--
commit 82a21bb72118b2177a8f4af3c99a80190f1aac3e
Author: Jack Wang <jinpu.wang@cloud.ionos.com>
md: don't wait for q->limits_lock in check_sb_changes()
This commit modifies check_sb_changes() to bypass queue limit stacking for
a newly activated spare by passing MDDEV_STACK_SKIP to remove_and_add_spares().
This is intended to prevent deadlocks when reconfig_mutex is held.
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 28fc903ffeea3..e60dc2c7eb90e 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -10885,7 +10885,14 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev)
> rdev2->saved_raid_disk = -1;
> else
> rdev2->saved_raid_disk = role;
> - ret = remove_and_add_spares(mddev, rdev2, NULL);
> + /*
> + * reconfig_mutex is held, so q->limits_lock
> + * cannot be taken here. The device is
> + * already a member, its limits are stacked,
> + * so add it without touching them.
> + */
> + ret = remove_and_add_spares(mddev, rdev2,
> + MDDEV_STACK_SKIP);
[Severity: High]
Does this code permanently bypass limit stacking for disks hot-added on
cluster peer nodes?
In a clustered MD array, when a remote node adds a new disk, the local peer
processes the NEWDISK message via md_add_new_disk() and add_bound_rdev().
Because personalities like raid1 and raid10 implement hot_remove_disk,
add_bound_rdev() intentionally skips calling hot_add_disk(), meaning the new
disk's limits are not stacked at that time.
When the remote node later activates the disk and sends a METADATA_UPDATED
message, this check_sb_changes() code handles it. By passing
MDDEV_STACK_SKIP, the personality's hot_add_disk() detects the flag and
bypasses mddev_stack_new_rdev():
drivers/md/raid1.c:raid1_add_disk() {
...
if (lim == MDDEV_STACK_SKIP)
err = 0;
else if (lim)
err = mddev_stack_rdev_into(mddev, rdev, lim);
...
}
Since the disk is marked with raid_disk >= 0, the sync thread will ignore it,
so it seems its limits will never be stacked. Can this leave the array with
invalid queue limits, potentially causing the local block layer to submit
incompatible I/O to the newly activated disk?
Also, the commit message states "The device is already a member, so its
limits are stacked", which appears to be inaccurate for Candidate disks
added remotely. I noticed that none of the follow-up patches in this series
correct this missing limits update.
> pr_info("Activated spare: %pg\n",
> rdev2->bdev);
> /* wakeup mddev->thread here, so array could
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910081114.1605746-1-jinpu.wang@ionos.com?part=2
next prev parent reply other threads:[~2026-09-10 8:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 8:11 [PATCH v2 0/8] md: don't wait for q->limits_lock while md holds back I/O Jack Wang
2026-09-10 8:11 ` [PATCH v2 1/8] md: pass a queue_limits down to ->hot_add_disk() Jack Wang
2026-09-10 8:31 ` sashiko-bot
2026-09-11 10:46 ` Nilay Shroff
2026-09-10 8:11 ` [PATCH v2 2/8] md: don't wait for q->limits_lock in check_sb_changes() Jack Wang
2026-09-10 8:36 ` sashiko-bot [this message]
2026-09-10 8:11 ` [PATCH v2 3/8] md: pass a queue_limits through the rdev sysfs stores Jack Wang
2026-09-10 8:11 ` [PATCH v2 4/8] md: defer the io_opt update out of the sync thread Jack Wang
2026-09-10 8:37 ` sashiko-bot
2026-09-10 8:11 ` [PATCH v2 5/8] md: take q->limits_lock before locking and suspending the array Jack Wang
2026-09-10 8:51 ` sashiko-bot
2026-09-10 8:11 ` [PATCH v2 6/8] md: pass a queue_limits through ->run() Jack Wang
2026-09-10 8:49 ` sashiko-bot
2026-09-11 10:54 ` Nilay Shroff
2026-09-10 8:11 ` [PATCH v2 7/8] md: open new legs before locking the array Jack Wang
2026-09-10 8:48 ` sashiko-bot
2026-09-10 8:11 ` [PATCH v2 8/8] md: link a new leg's holder " Jack Wang
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=20260910083603.6F8431F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jinpu.wang@ionos.com \
--cc=linux-raid@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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