Make sure we handle less than zero timeouts in iSCSI initiator and target

in a reasonable way.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2014-09-10 14:04:10 +00:00
parent d7f129a3cb
commit 2c5b89e54b
2 changed files with 13 additions and 3 deletions

View file

@ -993,7 +993,7 @@ cfiscsi_callout(void *context)
#ifdef ICL_KERNEL_PROXY
if (cs->cs_waiting_for_ctld || cs->cs_login_phase) {
if (cs->cs_timeout > login_timeout) {
if (login_timeout > 0 && cs->cs_timeout > login_timeout) {
CFISCSI_SESSION_WARN(cs, "login timed out after "
"%d seconds; dropping connection", cs->cs_timeout);
cfiscsi_session_terminate(cs);

View file

@ -538,7 +538,7 @@ iscsi_callout(void *context)
is->is_timeout++;
if (is->is_waiting_for_iscsid) {
if (is->is_timeout > iscsid_timeout) {
if (iscsid_timeout > 0 && is->is_timeout > iscsid_timeout) {
ISCSI_SESSION_WARN(is, "timed out waiting for iscsid(8) "
"for %d seconds; reconnecting",
is->is_timeout);
@ -548,7 +548,7 @@ iscsi_callout(void *context)
}
if (is->is_login_phase) {
if (is->is_timeout > login_timeout) {
if (login_timeout > 0 && is->is_timeout > login_timeout) {
ISCSI_SESSION_WARN(is, "login timed out after %d seconds; "
"reconnecting", is->is_timeout);
reconnect_needed = true;
@ -556,6 +556,16 @@ iscsi_callout(void *context)
goto out;
}
if (ping_timeout <= 0) {
/*
* Pings are disabled. Don't send NOP-Out in this case.
* Reset the timeout, to avoid triggering reconnection,
* should the user decide to reenable them.
*/
is->is_timeout = 0;
goto out;
}
if (is->is_timeout >= ping_timeout) {
ISCSI_SESSION_WARN(is, "no ping reply (NOP-In) after %d seconds; "
"reconnecting", ping_timeout);