From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@meta.com>
Cc: linux-nvme@lists.infradead.org, hch@lst.de, nilay@linux.ibm.com,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH 2/2] nvme: fix unmatched id's under delayed path deletion
Date: Thu, 26 Feb 2026 16:37:40 +0100 [thread overview]
Message-ID: <20260226153740.GB31615@lst.de> (raw)
In-Reply-To: <20260225202109.447144-2-kbusch@meta.com>
On Wed, Feb 25, 2026 at 12:21:09PM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> The NVMe controller is allowed to reuse an NSID for a new namespace after
> deleting the previous namespace that had been using it. The delayed removal may
> have the stale namespace head in the subsystem list pending the timer, which
Overlong lines.
> + bool retry = IS_ENABLED(CONFIG_NVME_MULTIPATH);
> struct nvme_ctrl *ctrl = ns->ctrl;
> struct nvme_ns_head *head = NULL;
> int ret;
> @@ -4008,6 +4009,7 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
> ctrl->quirks |= NVME_QUIRK_BOGUS_NID;
> }
>
> +again:
> mutex_lock(&ctrl->subsys->lock);
> head = nvme_find_ns_head(ctrl, info->nsid);
> if (!head) {
> @@ -4033,6 +4035,22 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
> goto out_put_ns_head;
> }
> if (!nvme_ns_ids_equal(&head->ids, &info->ids)) {
> + /*
> + * A newly created namespace can reuse an NSID that was
> + * previously deleted. If the head has no active paths,
> + * it is pending delayed removal and still occupying
> + * this NSID in the subsystem list. Flush the removal
> + * work to clear the stale head and retry.
> + */
> + if (retry && list_empty(&head->list)) {
I find the retry logic a bit odd and different from other places
do in similar areas. What I'd expected is either a "nr_retries" or
"did_retry" variable initialized to 0/false, then checked here to
be not set (plus the IS_ENABLED() for multipath) and incremented/set
below.
But independent of that, the actual logic looks fine.
next prev parent reply other threads:[~2026-02-26 15:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 20:21 [PATCH 1/2] nvme-multipath: fix leak on try_module_get failure Keith Busch
2026-02-25 20:21 ` [PATCH 2/2] nvme: fix unmatched id's under delayed path deletion Keith Busch
2026-02-25 20:34 ` Keith Busch
2026-02-26 7:04 ` Nilay Shroff
2026-02-26 15:37 ` Christoph Hellwig [this message]
2026-02-26 16:51 ` Keith Busch
2026-02-26 18:31 ` Nilay Shroff
2026-02-26 18:35 ` Keith Busch
2026-02-27 13:53 ` Christoph Hellwig
2026-02-26 6:35 ` [PATCH 1/2] nvme-multipath: fix leak on try_module_get failure Nilay Shroff
2026-02-26 8:31 ` John Garry
2026-02-26 15:35 ` Christoph Hellwig
2026-04-15 9:26 ` John Garry
2026-04-15 14:23 ` Keith Busch
2026-04-15 15:13 ` John Garry
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=20260226153740.GB31615@lst.de \
--to=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-nvme@lists.infradead.org \
--cc=nilay@linux.ibm.com \
/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