From: Keith Busch <kbusch@kernel.org>
To: Hannes Reinecke <hare@suse.de>
Cc: Keith Busch <kbusch@meta.com>,
linux-nvme@lists.infradead.org, hch@lst.de, mlombard@redhat.com,
jmeneghi@redhat.com
Subject: Re: [RFC-PATCH 2/2] nvme: use the namespace id for block device names
Date: Tue, 3 Mar 2026 09:53:30 -0700 [thread overview]
Message-ID: <aacSCnD-ag9-Llfg@kbusch-mbp> (raw)
In-Reply-To: <aacAzGpNJ2RXedvG@kbusch-mbp>
On Tue, Mar 03, 2026 at 08:39:56AM -0700, Keith Busch wrote:
> On Tue, Mar 03, 2026 at 08:34:38AM +0100, Hannes Reinecke wrote:
> > The idea is nice, and I would love to go into that
> > direction.
> > But have you checked how this holds up under
> > rescan/remapping (eg things like blktest/nvme/058)?
> > Removal of the sysfs nodes might be delayed, and we cannot
> > create new entries with the same name until then.
> > So if that is taken care of, fine, but I don't see that in
> > the patch ...
>
> I see. I set out to ensure everything was ordered, but apparently I've
> missed this case. Thanks for pointing out the test.
Okay, I think it's as simple as the head unlinking prior to actually
doing the del_gendisk creates a time when one scan work makes a new
namespace before the stale one is deleted in a different scan. This
should fix it:
---
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 3f2f9b2be87c2..e8dbb6cb85694 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4246,11 +4246,8 @@ static void nvme_ns_remove(struct nvme_ns *ns)
mutex_lock(&ns->ctrl->subsys->lock);
list_del_rcu(&ns->siblings);
- if (list_empty(&ns->head->list)) {
- if (!nvme_mpath_queue_if_no_path(ns->head))
- list_del_init(&ns->head->entry);
+ if (list_empty(&ns->head->list))
last_path = true;
- }
mutex_unlock(&ns->ctrl->subsys->lock);
/* guarantee not available in head->list */
--
This opens a different race where Controller A is deleting the last
path, and Controller B is bringing up a new namespace that reused the
NSID. An earlier patch from me should fix that by reschudeling B's
scan_work once A detects it removed the last path. It should work, but
it feels a bit off to me, so I'll think about it a little more.
next prev parent reply other threads:[~2026-03-03 16:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 22:25 [RFC-PATCH 1/2] nvme-multipath: delete gendisk under subsys lock Keith Busch
2026-03-02 22:25 ` [RFC-PATCH 2/2] nvme: use the namespace id for block device names Keith Busch
2026-03-03 7:34 ` Hannes Reinecke
2026-03-03 15:39 ` Keith Busch
2026-03-03 16:53 ` Keith Busch [this message]
2026-03-04 11:55 ` Nilay Shroff
2026-03-04 14:53 ` Keith Busch
2026-03-03 7:29 ` [RFC-PATCH 1/2] nvme-multipath: delete gendisk under subsys lock Hannes Reinecke
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=aacSCnD-ag9-Llfg@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jmeneghi@redhat.com \
--cc=kbusch@meta.com \
--cc=linux-nvme@lists.infradead.org \
--cc=mlombard@redhat.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