From: sashiko-bot@kernel.org
To: "Jack Wang" <jinpu.wang@ionos.com>
Cc: linux-raid@vger.kernel.org, yukuai@fygo.io
Subject: Re: [PATCH 3/6] md: don't wait for q->limits_lock in check_sb_changes()
Date: Mon, 07 Sep 2026 13:56:39 +0000 [thread overview]
Message-ID: <20260907135639.E94091F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <20260907133929.1081540-4-jinpu.wang@ionos.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The return value of queue_limits_commit_update() is ignored, allowing a disk to be permanently added to the array even if its queue limits are rejected.
--
commit 9dfb5955d3bac2bdadfd9671f084d71c343b76e2
Author: Jack Wang <jinpu.wang@cloud.ionos.com>
md: don't wait for q->limits_lock in check_sb_changes()
This patch updates check_sb_changes() to use a non-blocking trylock when
stacking queue limits for a newly added spare. If the lock is acquired, the
limits are stacked inline to avoid blocking on I/O while holding the
reconfig_mutex.
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
[ ... ]
> @@ -10885,7 +10900,24 @@ 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 don't wait for
> + * q->limits_lock; MD_RECOVERY_NEEDED below
> + * leaves a skipped add to md_start_sync().
> + */
> + if (mddev_stack_limits_trylock(mddev, &lim)) {
> + struct request_queue *q =
> + mddev->gendisk->queue;
> +
> + ret = remove_and_add_spares(mddev,
> + rdev2, &lim);
> + queue_limits_commit_update(q, &lim);
[Severity: High]
Is it safe to ignore the return value of queue_limits_commit_update() here?
If blk_validate_limits() fails inside queue_limits_commit_update(), it returns
an error and the limits are not applied. Because the return value is ignored
here, the disk could still be permanently added to the array even if its queue
limits (such as incompatible integrity profiles or alignments) were rejected.
Previously, a failure when committing limits would abort the disk addition
(for example, in mddev_stack_new_rdev()). Does splitting the limit stacking
from the commit and dropping the return value bypass this safety check?
> + } else if (mddev_is_dm(mddev)) {
> + ret = remove_and_add_spares(mddev,
> + rdev2, NULL);
> + } else {
> + ret = remove_spares(mddev, rdev2);
> + }
> pr_info("Activated spare: %pg\n",
> rdev2->bdev);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907133929.1081540-1-jinpu.wang@ionos.com?part=3
next prev parent reply other threads:[~2026-09-07 13:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 13:39 [PATCH 0/6] md: don't wait for q->limits_lock while md holds back I/O Jack Wang
2026-09-07 13:39 ` [PATCH 1/6] block: add queue_limits_start_update_trylock() Jack Wang
2026-09-09 6:29 ` Christoph Hellwig
2026-09-09 10:35 ` Jinpu Wang
2026-09-07 13:39 ` [PATCH 2/6] md: pass a queue_limits down to ->hot_add_disk() Jack Wang
2026-09-07 13:56 ` sashiko-bot
2026-09-08 4:43 ` Jinpu Wang
2026-09-07 13:39 ` [PATCH 3/6] md: don't wait for q->limits_lock in check_sb_changes() Jack Wang
2026-09-07 13:56 ` sashiko-bot [this message]
2026-09-08 4:41 ` Jinpu Wang
2026-09-07 13:39 ` [PATCH 4/6] md: pass a queue_limits through the rdev sysfs stores Jack Wang
2026-09-07 13:39 ` [PATCH 5/6] md: don't wait for q->limits_lock in mddev_update_io_opt() Jack Wang
2026-09-07 13:39 ` [PATCH 6/6] md: take q->limits_lock before locking and suspending the array Jack Wang
2026-09-07 14:00 ` sashiko-bot
2026-09-08 4:44 ` Jinpu Wang
2026-09-08 11:15 ` [PATCH 0/6] md: don't wait for q->limits_lock while md holds back I/O Nilay Shroff
2026-09-08 12:09 ` Jinpu Wang
2026-09-08 18:25 ` Nilay Shroff
2026-09-09 4:25 ` Jinpu Wang
2026-09-08 18:37 ` Abd-Alrhman Masalkhi
2026-09-08 21:51 ` Abd-Alrhman Masalkhi
2026-09-09 4:28 ` Jinpu Wang
2026-09-08 17:00 ` Johannes Thumshirn
2026-09-09 6:30 ` Christoph Hellwig
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=20260907135639.E94091F00A3F@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