nvme: Skip checking heads without namespaces
Subsystems (2)
PATCH 1/1 nvme: Skip checking heads without namespaces
If a task is holding a reference to a namespace on a removed controller, the head will not be released. If the same controller is added again later, its namespaces may not be successfully added. Instead, the user will see kernel message "Duplicate IDs for nsid <X>".
This patch fixes that by skipping heads that don't have namespaces when considering if a new namespace is safe to add.
--- drivers/nvme/host/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
@@ -2793,6 +2793,7 @@ static int __nvme_check_ids(struct nvme_subsystem *subsys,list_for_each_entry (h, &subsys->nsheads, entry) {if (nvme_ns_ids_valid (&new->ids) && + !list_empty (&h->list) &&nvme_ns_ids_equal (&new->ids, &h->ids))return -EINVAL ; }
Signature · 1 line
2.14.3
Christoph Hellwig
maintainerPATCH 1/1 nvme: Skip checking heads without namespaces
Quoted 7 lines · Keith Busch
If a task is holding a reference to a namespace on a removed controller, the head will not be released. If the same controller is added again later, its namespaces may not be successfully added. Instead, the user will see kernel message "Duplicate IDs for nsid <X>".
This patch fixes that by skipping heads that don't have namespaces when considering if a new namespace is safe to add.
Delayed reference strike once again, sigh.
Looks fine:
PATCH 1/1 nvme: Skip checking heads without namespaces
In reply to Keith BuschQuoted 21 lines · Keith Busch
If a task is holding a reference to a namespace on a removed controller, the head will not be released. If the same controller is added again later, its namespaces may not be successfully added. Instead, the user will see kernel message "Duplicate IDs for nsid <X>".
This patch fixes that by skipping heads that don't have namespaces when considering if a new namespace is safe to add.
Reported-by Alex Gagniuc <Alex_Gagniuc at Dellteam.com>Cc stable at vger.kernel.orgSigned-off-by Keith Busch <keith.busch at intel.com>--- drivers/nvme/host/core.c | 1 + 1 file changed, 1 insertion(+)drivers/nvme/host/core.c +0
-0
drivers/nvme/host/core.c static int __nvme_check_ids(struct nvme_subsystem *subsys, · line 2799
Quoted 7 lines
drivers/nvme/host/core.c +1
-0@@ -2793,6 +2793,7 @@ static int __nvme_check_ids(struct nvme_subsystem *subsys,list_for_each_entry (h, &subsys->nsheads, entry) {if (nvme_ns_ids_valid (&new->ids) && + !list_empty (&h->list) &&nvme_ns_ids_equal (&new->ids, &h->ids))return -EINVAL ; }
Looks good,
PATCH 1/1 nvme: Skip checking heads without namespaces
Thannks for the reviews. Applied for 4.17.