If the initial connect fails we fail the login process right away ignoring node.session.initial_login_retry_max and node.conn[0].timeo.login_timeout.

This patch has the initial connect process obey the iscsid.conf node.session.initial_login_retry_max count and the (node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max) max wait time limit when the connect failure is returned immediately like is done with other connect failures.

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

diff --git a/usr/initiator.c b/usr/initiator.c
index b1cbc9e..5eb05b5 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1719,19 +1719,22 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
                return ISCSI_ERR_LOGIN;
        }
 
-       conn->state = STATE_XPT_WAIT;
-       if (iscsi_conn_connect(conn, qtask)) {
-               __session_destroy(session);
-               return ISCSI_ERR_TRANS;
-       }
-
        if (gettimeofday(&conn->initial_connect_time, NULL))
                log_error("Could not get initial connect time. If "
                          "login errors iscsid may give up the initial "
                          "login early. You should manually login.");
 
+       conn->state = STATE_XPT_WAIT;
        qtask->rsp.command = MGMT_IPC_SESSION_LOGIN;
        qtask->rsp.err = ISCSI_SUCCESS;
+
+       if (iscsi_conn_connect(conn, qtask)) {
+               log_debug(4, "Initial connect failed. Waiting %u seconds "
+                         "before trying to reconnect.\n",
+                         ISCSI_CONN_ERR_REOPEN_DELAY);
+               queue_delayed_reopen(qtask, ISCSI_CONN_ERR_REOPEN_DELAY);
+       }
+
        return ISCSI_SUCCESS;
 }
 

Reply via email to