nvme: Treat discovery subsystems as unique subsystems
PATCH v2 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.
---
v2: add comment
--- drivers/nvme/host/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/nvme/host/core.c +11 -0
@@ -2358,6 +2358,17 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn)lockdep_assert_held (&nvme_subsystems_lock); +/* +* Fail matches for discovery subsystems. This results +* in each discovery controller bound to a unique subsystem. +* This avoids issues with validating controller values +* that can only be true when there is a single unique subsystem. +* There may be multiple and completely independent entities +* that provide discovery controllers. +*/ +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
Quoted 9 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 3 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.
Looks good,
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 35 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.
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]>Reviewed-by Sagi Grimberg <[email protected]>Reviewed-by Christoph Hellwig <[email protected]>---
v2: add comment--- drivers/nvme/host/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/nvme/host/core.c +4
-0@@ -2358,6 +2358,17 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn)lockdep_assert_held (&nvme_subsystems_lock); +/* +* Fail matches for discovery subsystems. This results +* in each discovery controller bound to a unique subsystem. +* This avoids issues with validating controller values
drivers/nvme/host/core.c static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn) · line 2374
Quoted 10 lines
drivers/nvme/host/core.c +7
-0+* that can only be true when there is a single unique subsystem. +* There may be multiple and completely independent entities +* that provide discovery controllers. +*/ +if (!strcmp (subsysnqn,NVME_DISC_SUBSYS_NAME )) +return NULL ; +list_for_each_entry (subsys, &nvme_subsystems, entry) {if (strcmp (subsys->subnqn, subsysnqn))continue ;
Looks good,
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme