diff options
author | mav <mav@FreeBSD.org> | 2014-10-20 07:28:18 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-10-20 07:28:18 +0000 |
commit | 072d9b12cad6e0a19c457a7b6b5bbe31540b642a (patch) | |
tree | 6a606813308aaa7c76b52ca78f7f7bf93b694eb2 /sys | |
parent | 7aaab4b0ed52a57f5bcb9af530b18ba47b9032f4 (diff) | |
download | FreeBSD-src-072d9b12cad6e0a19c457a7b6b5bbe31540b642a.zip FreeBSD-src-072d9b12cad6e0a19c457a7b6b5bbe31540b642a.tar.gz |
MFC r271395 (by trasz):
Make sure we handle less than zero timeouts in iSCSI initiator and target
in a reasonable way.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cam/ctl/ctl_frontend_iscsi.c | 2 | ||||
-rw-r--r-- | sys/dev/iscsi/iscsi.c | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index e691bec..5f9b62a 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -997,7 +997,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); diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index d958ee2..659d74e 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -543,7 +543,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); @@ -553,7 +553,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; @@ -561,6 +561,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); |