Date: Wed, 10 Sep 2014 14:04:10 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271395 - in head/sys: cam/ctl dev/iscsi Message-ID: <201409101404.s8AE4A9S079760@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Wed Sep 10 14:04:10 2014 New Revision: 271395 URL: http://svnweb.freebsd.org/changeset/base/271395 Log: Make sure we handle less than zero timeouts in iSCSI initiator and target in a reasonable way. Sponsored by: The FreeBSD Foundation Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/dev/iscsi/iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Wed Sep 10 13:38:52 2014 (r271394) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Wed Sep 10 14:04:10 2014 (r271395) @@ -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); Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Wed Sep 10 13:38:52 2014 (r271394) +++ head/sys/dev/iscsi/iscsi.c Wed Sep 10 14:04:10 2014 (r271395) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409101404.s8AE4A9S079760>