[RFC-PATCH 2/2] nvme: use the namespace id for block device names
Keith Busch
kbusch at kernel.org
Wed Mar 4 06:53:08 PST 2026
On Wed, Mar 04, 2026 at 05:25:28PM +0530, Nilay Shroff wrote:
> I think we need to ensure that the head disk is fully removed from the
> system before a new head is created that may reuse the same NSID; otherwise
> we may run into name collisions. Since removal of the sysfs entries
> associated with the disk can be delayed, a namespace scan may attempt to
> create a new head with the same name while the previous one is still being
> torn down.
>
> To avoid this, it might be better to defer removing head->entry from the
> subsys->nsheads list until after the head node´s gendisk has been removed in
> nvme_remove_head().
>
> From your first patch in this series, I see that the removal of
> head->entry from subsys->nsheads was moved to the beginning of
> nvme_remove_head(). IMO, in addition to the change you proposed above, if we
> also move the removal of head->entry until after del_gendisk() is called,
> that should ensure the old disk is fully removed before a new head with the
> same NSID can be created.
Yeah, I'm really sure why it was done in two steps split across
different subsystem lock contexts.
I'll respin the series along with the last two patches from this one:
https://lore.kernel.org/linux-nvme/20260226183216.2098584-1-kbusch@meta.com/
More information about the Linux-nvme
mailing list