diff options
author | Mike Christie <michael.christie@oracle.com> | 2021-12-03 17:27:47 -0600 |
---|---|---|
committer | Mike Christie <michael.christie@oracle.com> | 2021-12-03 18:10:14 -0600 |
commit | 403cd999c537ad13fe0dc108da44f00e1b17eeed (patch) | |
tree | 9eb7c09177b5a72f6aa65c1470efc149f5026d27 /usr | |
parent | 26446c13be2b04ea3ac83f174db75476491e5c45 (diff) | |
download | open-iscsi-403cd999c537ad13fe0dc108da44f00e1b17eeed.tar.gz |
iscsistart: fix login timeout handling
We should set the timeout to -1 for the login request becuase if we've
connected to our event loop then the login will either complete, fail
and hit the login retries limit in the initiator, or we will crash and
we will exit. Either way we are going to return evetually, and the
user can configure the retries so they can also limit the time they
will wait.
If we've sent a login request to our event loop we also don't want to
send another one because the initiator will see it on its session loop
and just return immediately.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Diffstat (limited to 'usr')
-rw-r--r-- | usr/iscsistart.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/usr/iscsistart.c b/usr/iscsistart.c index 7eb573e..b23751b 100644 --- a/usr/iscsistart.c +++ b/usr/iscsistart.c @@ -241,26 +241,18 @@ static int login_session(struct node_rec *rec) /* * Need to handle race where iscsid proc is starting up while we are * trying to connect. Retry with exponential backoff, start from 50 ms. - * - * NOTE: another race condition can occur if the system is just coming - * up, where our login request will be sent, but the login response - * takes a while. In such a case, if we timeout and give up, the - * login response may still show up once we give up, in which case - * it seems to get iscsistart into a state where it cannot try to - * login again because it thinks there's already a session. So make - * sure our timeout is long enough, on each try, to give the response - * a chance to show up. The old value of 1 second was not enough, - * so we multiply that by 10, which seems reasonable for initial - * login. */ for (msec = 50; msec <= 15000; msec <<= 1) { - int tmo = ISCSID_REQ_TIMEOUT * 10; - - rc = iscsid_exec_req(&req, &rsp, 0, tmo); + /* + * Once our event loop is up then we want to wait for the login + * response. Either it logs in, we hit the login retries count, + * or this program crashes, so there no need for the response + * timeout. + */ + rc = iscsid_exec_req(&req, &rsp, 0, -1); if (rc == 0) { return rc; - } else if (rc == ISCSI_ERR_SESSION_NOT_CONNECTED || - rc == ISCSI_ERR_ISCSID_NOTCONN) { + } else if (rc == ISCSI_ERR_ISCSID_NOTCONN) { ts.tv_sec = msec / 1000; ts.tv_nsec = (msec % 1000) * 1000000L; |