From: Tomas Bzatek Date: Tue, 13 Feb 2024 14:26:14 +0000 (-0500) Subject: nbft: Silence connection failures for unavailable SSNS X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9f521d9583c4ab29c3ed5cb2665ae0bd45c3318f;p=users%2Fsagi%2Fnvme-cli.git nbft: Silence connection failures for unavailable SSNS 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 --- diff --git a/nbft.c b/nbft.c index 023fed28..9b39c9aa 100644 --- 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