Any errors in the discovery process would previously cause a
short-circuit jump out of the main per-interface loop.  There are some
error conditions which should not be fatal to the process (such as if
the portal we are trying to discover is not reachable on one of a number
of interfaces), so allow the other ifaces to still be tried in those
cases.

Signed-off-by: Jim Ramsay <jim_ram...@dell.com>
---
 usr/idbm.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/usr/idbm.c b/usr/idbm.c
index cca32e2..4f78250 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -1879,6 +1879,20 @@ static int idbm_bind_iface_to_nodes(idbm_disc_nodes_fn 
*disc_node_fn,
        return 0;
 }
 
+static int
+discovery_error_fatal(int err)
+{
+       switch (err) {
+       /* No error */
+       case ISCSI_SUCCESS:
+       /* Transport errors or timeouts are not fatal */
+       case ISCSI_ERR_TRANS:
+       case ISCSI_ERR_TRANS_TIMEOUT:
+               return 0;
+       }
+       return 1;
+}
+
 int idbm_bind_ifaces_to_nodes(idbm_disc_nodes_fn *disc_node_fn,
                              void *data, struct list_head *ifaces,
                              struct list_head *bound_recs)
@@ -1910,7 +1924,7 @@ int idbm_bind_ifaces_to_nodes(idbm_disc_nodes_fn 
*disc_node_fn,
                        rc = idbm_bind_iface_to_nodes(disc_node_fn, data, iface,
                                                      bound_recs);
                        free(iface);
-                       if (rc)
+                       if (discovery_error_fatal(rc))
                                goto fail;
                        found = 1;
                }
@@ -1937,7 +1951,7 @@ int idbm_bind_ifaces_to_nodes(idbm_disc_nodes_fn 
*disc_node_fn,
 
                        rc = idbm_bind_iface_to_nodes(disc_node_fn, data, iface,
                                                      bound_recs);
-                       if (rc)
+                       if (discovery_error_fatal(rc))
                                goto fail;
                }
        }
-- 
1.7.6

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to