[PATCH libnvme] fabrics: fix endless loop in connect-all for NVME_NQN_CURR

Sagi Grimberg sagi at grimberg.me
Sun Nov 28 05:00:33 PST 2021


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")
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 src/nvme/fabrics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c
index 686a5641aa9c..b657b0a41d74 100644
--- a/src/nvme/fabrics.c
+++ b/src/nvme/fabrics.c
@@ -657,8 +657,9 @@ 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);
+	case NVME_NQN_DISC:
 		if (discover)
 			*discover = true;
 		nvme_ctrl_set_discovery_ctrl(c, true);
-- 
2.30.2




More information about the Linux-nvme mailing list