Skip to contentSkip to conversation

nvme-fabrics: show well known discovery name

PATCH Applied Daniel Wagner 3 participants 3 messages Feb 21, 2023 – Feb 27, 2023 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-fabrics: show well known discovery name

The kernel always logs the unique subsystem name for a discovery controller, even in the case user space asked for the well known.

This has lead to confusion as the logs of nvme-cli and the kernel logs didn't match.

First, nvme-cli connects to the well known discovery controller to figure out if it supports TP8013. If so then nvme-cli disconnects and connects to the unique discovery controller. Currently, the kernel show that user space connected twice to the unique one.

To avoid further confusion, show the well known discovery controller if user space asked for it:

  $ nvme connect-all -v -t tcp -a 192.168.0.1
  nvme0: nqn.2014-08.org.nvmexpress.discovery connected
  nvme0: nqn.2014-08.org.nvmexpress.discovery disconnected
  nvme0: nqn.discovery connected

kernel log:
nvme nvme0: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 192.168.0.1:8009 nvme nvme0: Removing ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery" nvme nvme0: new ctrl: NQN "nqn.discovery", addr 192.168.0.1:8009

Fixes e5ea42faa773 ("nvme: display correct subsystem NQN")
Cc Hannes Reinecke <[email protected]>
Cc Chaitanya Kulkarni <[email protected]>
---
 drivers/nvme/host/fabrics.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/fabrics.h +2 -1
index a6e22116e139..dcac3df8a5f7 100644
@@ -189,7 +189,8 @@ nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl,
 
 static inline char *nvmf_ctrl_subsysnqn(struct nvme_ctrl *ctrl)
 {
-	if (!ctrl->subsys)
+	if (!ctrl->subsys ||
+	    !strcmp(ctrl->opts->subsysnqn, NVME_DISC_SUBSYS_NAME))
 		return ctrl->opts->subsysnqn;
 	return ctrl->subsys->subnqn;
 }
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 37 lines · Daniel Wagner

The kernel always logs the unique subsystem name for a discovery controller, even in the case user space asked for the well known.

This has lead to confusion as the logs of nvme-cli and the kernel logs didn't match.

First, nvme-cli connects to the well known discovery controller to figure out if it supports TP8013. If so then nvme-cli disconnects and connects to the unique discovery controller. Currently, the kernel show that user space connected twice to the unique one.

To avoid further confusion, show the well known discovery controller if user space asked for it:

   $ nvme connect-all -v -t tcp -a 192.168.0.1
   nvme0: nqn.2014-08.org.nvmexpress.discovery connected
   nvme0: nqn.2014-08.org.nvmexpress.discovery disconnected
   nvme0: nqn.discovery connected

kernel log:
nvme nvme0: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 192.168.0.1:8009 nvme nvme0: Removing ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery" nvme nvme0: new ctrl: NQN "nqn.discovery", addr 192.168.0.1:8009

Fixes e5ea42faa773 ("nvme: display correct subsystem NQN")
Cc Hannes Reinecke <[email protected]>
Cc Chaitanya Kulkarni <[email protected]>
---
  drivers/nvme/host/fabrics.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/fabrics.h +0 -0
index a6e22116e139..dcac3df8a5f7 100644

drivers/nvme/host/fabrics.h nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl, · line 196

Quoted 9 lines
drivers/nvme/host/fabrics.h +2 -1
@@ -189,7 +189,8 @@ nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl,
 
  static inline char *nvmf_ctrl_subsysnqn(struct nvme_ctrl *ctrl)
  {
-	if (!ctrl->subsys)
+	if (!ctrl->subsys ||
+	    !strcmp(ctrl->opts->subsysnqn, NVME_DISC_SUBSYS_NAME))
  		return ctrl->opts->subsysnqn;
  	return ctrl->subsys->subnqn;
  }

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman