]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nbft: Silence connection failures for unavailable SSNS
authorTomas Bzatek <tbzatek@redhat.com>
Tue, 13 Feb 2024 14:26:14 +0000 (09:26 -0500)
committerDaniel Wagner <wagi@monom.org>
Tue, 19 Mar 2024 16:44:03 +0000 (17:44 +0100)
In case a SSNS is marked as 'unavailable' by the firmware,
let's give it another try but silence any errors.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
nbft.c

diff --git a/nbft.c b/nbft.c
index 023fed28309ed4c614fba30bde7a4caba1791353..9b39c9aa506a850bb7a9829b6a507994d53b1456 100644 (file)
--- a/nbft.c
+++ b/nbft.c
@@ -162,6 +162,17 @@ int discover_from_nbft(nvme_root_t r, char *hostnqn_arg, char *hostid_arg,
                                errno = 0;
                                ret = nvmf_add_ctrl(h, c, cfg);
 
+                               /*
+                                * In case this SSNS was marked as 'unavailable' and
+                                * the connection attempt failed again, ignore it.
+                                */
+                               if (ret == -1 && (*ss)->unavailable) {
+                                       if (verbose >= 1)
+                                               fprintf(stderr,
+                                                       "subsystem reported as unavailable, skipping\n");
+                                       continue;
+                               }
+
                                /*
                                 * With TCP/DHCP, it can happen that the OS
                                 * obtains a different local IP address than the