Skip to contentSkip to conversation

fabrics: fix endless loop in connect-all for NVME_NQN_CURR

PATCH In review Sagi Grimberg 2 participants 2 messages Nov 28, 2021 – Nov 29, 2021 NVMe

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH v2 1/1 fabrics: fix endless loop in connect-all for NVME_NQN_CURR

For a discovery log page entry that indicates the discovery controller that returned it (i.e. itself), we need to set the controller as discovered (because we got the discovery log page by connecting to it).

Without this connect-all goes in an endless loop keep connecting and retrieving the log page from the same discovery subsystem port.

Fixes 06a8f001d314 ("tree,fabrics: detect discovery loops")

---
Changes from v1:
- add break as we don't need the discovery ctrl setting

 src/nvme/fabrics.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/nvme/fabrics.c +3 -1
index 686a5641aa9c..9207296ba957 100644
@@ -657,8 +657,10 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
 	}
 
 	switch (e->subtype) {
-	case NVME_NQN_DISC:
 	case NVME_NQN_CURR:
+		nvme_ctrl_set_discovered(c, true);
+		break;
+	case NVME_NQN_DISC:
 		if (discover)
 			*discover = true;
 		nvme_ctrl_set_discovery_ctrl(c, true);
Signature · 1 line
2.30.2
#1 lore raw
Quoted 23 lines · Sagi Grimberg

For a discovery log page entry that indicates the discovery controller that returned it (i.e. itself), we need to set the controller as discovered (because we got the discovery log page by connecting to it).

Without this connect-all goes in an endless loop keep connecting and retrieving the log page from the same discovery subsystem port.

Fixes 06a8f001d314 ("tree,fabrics: detect discovery loops")

---
Changes from v1:
- add break as we don't need the discovery ctrl setting

  src/nvme/fabrics.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
src/nvme/fabrics.c +0 -0
index 686a5641aa9c..9207296ba957 100644
@@ -657,8 +657,10 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
  	}

src/nvme/fabrics.c nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h, · line 666

Quoted 10 lines
src/nvme/fabrics.c +3 -1
 
  	switch (e->subtype) {
-	case NVME_NQN_DISC:
  	case NVME_NQN_CURR:
+		nvme_ctrl_set_discovered(c, true);
+		break;
+	case NVME_NQN_DISC:
  		if (discover)
  			*discover = true;
  		nvme_ctrl_set_discovery_ctrl(c, true);

Merged with https://github.com/linux-nvme/libnvme

Cheers,

Hannes