nvme: Treat discovery subsystems as unique subsystems
PATCH 1/1 nvme: Treat discovery subsystems as unique subsystems
Current code matches subnqn and collapses all controllers to the same subnqn to a single subsystem structure. This is good for recognizing multiple controllers for the same subsystem. But with the well-known discovery subnqn, the subsystems aren't truly the same subsystem. As such, subsystem specific rules, such as no overlap of controller id, do not apply. With today's behavior, the check for overlap of controller id can fail, preventing the new discovery controller from being created.
When searching for like subsystem nqn, exclude the discovery nqn from matching. This will result in each discovery controller being attached to a unique subsystem structure.
--- drivers/nvme/host/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/core.c +3 -0
@@ -2358,6 +2358,9 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn)lockdep_assert_held (&nvme_subsystems_lock); +if (!strcmp (subsysnqn,NVME_DISC_SUBSYS_NAME )) +return NULL ; +list_for_each_entry (subsys, &nvme_subsystems, entry) {if (strcmp (subsys->subnqn, subsysnqn))continue ;
Signature · 7 lines
2.13.7 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 8 lines · James Smart
Current code matches subnqn and collapses all controllers to the same subnqn to a single subsystem structure. This is good for recognizing multiple controllers for the same subsystem. But with the well-known discovery subnqn, the subsystems aren't truly the same subsystem. As such, subsystem specific rules, such as no overlap of controller id, do not apply. With today's behavior, the check for overlap of controller id can fail, preventing the new discovery controller from being created.
so this fixes a scenario of multiple discovery in parallel ?
Quoted 14 lines
When searching for like subsystem nqn, exclude the discovery nqn from matching. This will result in each discovery controller being attached to a unique subsystem structure.
Signed-off-by James Smart <[email protected]>--- drivers/nvme/host/core.c | 3 +++ 1 file changed, 3 insertions(+)drivers/nvme/host/core.c +0
-0
drivers/nvme/host/core.c static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn) · line 2366
Quoted 9 lines
drivers/nvme/host/core.c +3
-0@@ -2358,6 +2358,9 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn)lockdep_assert_held (&nvme_subsystems_lock); +if (!strcmp (subsysnqn,NVME_DISC_SUBSYS_NAME )) +return NULL ; +list_for_each_entry (subsys, &nvme_subsystems, entry) {if (strcmp (subsys->subnqn, subsysnqn))continue ;
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 15 lines · Max Gurtovoy
Quoted 8 lines · James Smart
Current code matches subnqn and collapses all controllers to the same subnqn to a single subsystem structure. This is good for recognizing multiple controllers for the same subsystem. But with the well-known discovery subnqn, the subsystems aren't truly the same subsystem. As such, subsystem specific rules, such as no overlap of controller id, do not apply. With today's behavior, the check for overlap of controller id can fail, preventing the new discovery controller from being created.
Quoted 2 lines
so this fixes a scenario of multiple discovery in parallel ?
It’s not to say that multiple discoveries in parallel doesn’t work, but I did see a scenario where it mapped into this. In most cases, the time taken for an ioctl or two to get the log, then delete the controller happens so fast it’s avoided. But I fully expect long-lived controllers to make this problematic.
— james
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
drivers/nvme/host/core.c static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn) · line 2363
Quoted 7 lines · James Smart
drivers/nvme/host/core.c +3
-0@@ -2358,6 +2358,9 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn)lockdep_assert_held (&nvme_subsystems_lock); +if (!strcmp (subsysnqn,NVME_DISC_SUBSYS_NAME )) +return NULL ; +
Can you throw in a comment here?
Otherwise this looks good:
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme