]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
fabrics: fix endless loop in connect-all for NVME_NQN_CURR
authorSagi Grimberg <sagi@grimberg.me>
Sun, 28 Nov 2021 13:03:03 +0000 (15:03 +0200)
committerHannes Reinecke <hare@suse.de>
Mon, 29 Nov 2021 06:46:45 +0000 (07:46 +0100)
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@grimberg.me>
src/nvme/fabrics.c

index 686a5641aa9cace517bc31243880ed0df0cfce6a..9207296ba95735c67c8e58becf41b2744f0235e7 100644 (file)
@@ -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);