All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Treat discovery subsystems as unique subsystems
@ 2019-08-30 20:11 James Smart
  2019-08-30 21:04 ` Sagi Grimberg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: James Smart @ 2019-08-30 20:11 UTC (permalink / raw)
  To: linux-nvme; +Cc: 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 <jsmart2021@gmail.com>
---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4660505eded9..3edafe57c7f7 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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;
-- 
2.13.7


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme: Treat discovery subsystems as unique subsystems
  2019-08-30 20:11 [PATCH] nvme: Treat discovery subsystems as unique subsystems James Smart
@ 2019-08-30 21:04 ` Sagi Grimberg
  2019-09-01 10:04 ` Max Gurtovoy
  2019-09-02 16:12 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2019-08-30 21:04 UTC (permalink / raw)
  To: James Smart, linux-nvme

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme: Treat discovery subsystems as unique subsystems
  2019-08-30 20:11 [PATCH] nvme: Treat discovery subsystems as unique subsystems James Smart
  2019-08-30 21:04 ` Sagi Grimberg
@ 2019-09-01 10:04 ` Max Gurtovoy
  2019-09-01 14:41   ` James Smart
  2019-09-02 16:12 ` Christoph Hellwig
  2 siblings, 1 reply; 5+ messages in thread
From: Max Gurtovoy @ 2019-09-01 10:04 UTC (permalink / raw)
  To: James Smart, linux-nvme


On 8/30/2019 11:11 PM, James Smart wrote:
> 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 ?


> 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 <jsmart2021@gmail.com>
> ---
>   drivers/nvme/host/core.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 4660505eded9..3edafe57c7f7 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -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
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme: Treat discovery subsystems as unique subsystems
  2019-09-01 10:04 ` Max Gurtovoy
@ 2019-09-01 14:41   ` James Smart
  0 siblings, 0 replies; 5+ messages in thread
From: James Smart @ 2019-09-01 14:41 UTC (permalink / raw)
  To: Max Gurtovoy; +Cc: linux-nvme



> On Sep 1, 2019, at 3:04 AM, Max Gurtovoy <maxg@mellanox.com> wrote:
> 
> 
> On 8/30/2019 11:11 PM, James Smart wrote:
>> 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 ?
> 

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
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme: Treat discovery subsystems as unique subsystems
  2019-08-30 20:11 [PATCH] nvme: Treat discovery subsystems as unique subsystems James Smart
  2019-08-30 21:04 ` Sagi Grimberg
  2019-09-01 10:04 ` Max Gurtovoy
@ 2019-09-02 16:12 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2019-09-02 16:12 UTC (permalink / raw)
  To: James Smart; +Cc: linux-nvme

On Fri, Aug 30, 2019 at 01:11:45PM -0700, James Smart wrote:
> @@ -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:

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-02 16:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 20:11 [PATCH] nvme: Treat discovery subsystems as unique subsystems James Smart
2019-08-30 21:04 ` Sagi Grimberg
2019-09-01 10:04 ` Max Gurtovoy
2019-09-01 14:41   ` James Smart
2019-09-02 16:12 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.