summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-09-10 14:04:10 +0000
committertrasz <trasz@FreeBSD.org>2014-09-10 14:04:10 +0000
commitd8aaa0480ad6b6338180fa978ed574f0cb35004c (patch)
tree400d24a3377dc2a7d765fd4084f8697160136c25
parenta363841a1850d81bd271ae11c02cd4195ff4abc7 (diff)
downloadFreeBSD-src-d8aaa0480ad6b6338180fa978ed574f0cb35004c.zip
FreeBSD-src-d8aaa0480ad6b6338180fa978ed574f0cb35004c.tar.gz
Make sure we handle less than zero timeouts in iSCSI initiator and target
in a reasonable way. Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c2
-rw-r--r--sys/dev/iscsi/iscsi.c14
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 247b4ee..2dbc8d1 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -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);
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index c08abf9..f3961ff 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -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);
OpenPOWER on IntegriCloud