git: c3a05933b34f - main - Revert "iSCSI: Fast and per-session timeouts"

From: Richard Scheffenegger <rscheff_at_FreeBSD.org>
Date: Fri, 06 Nov 2026 22:38:44 UTC
The branch main has been updated by rscheff:

URL: https://cgit.FreeBSD.org/src/commit/?id=c3a05933b34f705077e88a7a2d1c4bad85e73e79

commit c3a05933b34f705077e88a7a2d1c4bad85e73e79
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2026-11-06 22:38:25 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2026-11-06 22:38:25 +0000

    Revert "iSCSI: Fast and per-session timeouts"
    
    This reverts commit 6129bc4b65d8f00570bdcf2b2d36f3717e4b4741.
---
 share/man/man4/iscsi.4        |  7 +++---
 sys/dev/iscsi/iscsi.c         | 53 +++++++++++++++----------------------------
 sys/dev/iscsi/iscsi_ioctl.h   |  2 --
 usr.bin/iscsictl/iscsi.conf.5 |  6 ++---
 usr.bin/iscsictl/iscsictl.c   | 14 +++++-------
 usr.bin/iscsictl/parse.y      | 25 ++------------------
 usr.bin/iscsictl/token.l      |  1 -
 usr.sbin/iscsid/iscsid.c      |  8 ++-----
 8 files changed, 34 insertions(+), 82 deletions(-)

diff --git a/share/man/man4/iscsi.4 b/share/man/man4/iscsi.4
index 57422c6f8d22..77a5e816294f 100644
--- a/share/man/man4/iscsi.4
+++ b/share/man/man4/iscsi.4
@@ -20,7 +20,7 @@
 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
-.Dd November 6, 2026
+.Dd May 28, 2017
 .Dt ISCSI 4
 .Os
 .Sh NAME
@@ -72,7 +72,6 @@ In the event that there is no response within that time the session gets
 forcibly restarted.
 Set to 0 to disable sending NOP-Out PDUs.
 Defaults to 5.
-This can be set in increments of 0.1 seconds.
 .It Va kern.iscsi.iscsid_timeout
 The number of seconds to wait for
 .Xr iscsid 8
@@ -80,13 +79,13 @@ to establish a session.
 After that time
 .Nm
 will abort and retry.
-Defaults to 60 and accepts increments of 0.1.
+Defaults to 60.
 .It Va kern.iscsi.login_timeout
 The number of seconds to wait for a login attempt to succeed.
 After that time
 .Nm
 will abort and retry.
-Defaults to 60 and accepts increments of 0.1.
+Defaults to 60.
 .It Va kern.iscsi.maxtags
 The maximum number of outstanding IO requests.
 Defaults to 255.
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 01f1e15bbc52..4ed8f086ccde 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -104,15 +104,15 @@ static int debug = 1;
 SYSCTL_INT(_kern_iscsi, OID_AUTO, debug, CTLFLAG_RWTUN,
     &debug, 0, "Enable debug messages");
 
-static int ping_timeout = 5000;
+static int ping_timeout = 5;
 SYSCTL_INT(_kern_iscsi, OID_AUTO, ping_timeout, CTLFLAG_RWTUN, &ping_timeout,
-    0, "Timeout for ping (NOP-Out) requests, in milliseconds");
-static int iscsid_timeout = 60000;
+    0, "Timeout for ping (NOP-Out) requests, in seconds");
+static int iscsid_timeout = 60;
 SYSCTL_INT(_kern_iscsi, OID_AUTO, iscsid_timeout, CTLFLAG_RWTUN, &iscsid_timeout,
-    0, "Time to wait for iscsid(8) to handle reconnection, in milliseconds");
-static int login_timeout = 60000;
+    0, "Time to wait for iscsid(8) to handle reconnection, in seconds");
+static int login_timeout = 60;
 SYSCTL_INT(_kern_iscsi, OID_AUTO, login_timeout, CTLFLAG_RWTUN, &login_timeout,
-    0, "Time to wait for iscsid(8) to finish Login Phase, in milliseconds");
+    0, "Time to wait for iscsid(8) to finish Login Phase, in seconds");
 static int maxtags = 255;
 SYSCTL_INT(_kern_iscsi, OID_AUTO, maxtags, CTLFLAG_RWTUN, &maxtags,
     0, "Max number of IO requests queued");
@@ -585,8 +585,6 @@ iscsi_callout(void *context)
 	struct iscsi_session *is;
 	bool reconnect_needed = false;
 	sbintime_t sbt, pr;
-	bool fast_timer = false;
-	char tmpstr[5];
 
 	is = context;
 
@@ -596,38 +594,29 @@ iscsi_callout(void *context)
 		return;
 	}
 
-	fast_timer = ((is->is_ping_timeout <= 2000) ||
-			(is->is_login_timeout <= 2000));
-	sbt = mstosbt(fast_timer ? 95 : 995);
+	sbt = mstosbt(995);
 	pr  = mstosbt(10);
 	callout_schedule_sbt(&is->is_callout, sbt, pr, 0);
 
 	if (is->is_conf.isc_enable == 0)
 		goto out;
 
-	is->is_timeout += (fast_timer ? 100 : 1000);
+	is->is_timeout++;
 
-	tmpstr[0] = '\0';
 	if (is->is_waiting_for_iscsid) {
-		if (iscsid_timeout > 0 && is->is_timeout >= iscsid_timeout) {
-			if (fast_timer && ((is->is_timeout % 1000) != 0))
-				snprintf(tmpstr, sizeof(tmpstr), ".%d",
-					(is->is_timeout % 1000) / 100);
+		if (iscsid_timeout > 0 && is->is_timeout > iscsid_timeout) {
 			ISCSI_SESSION_WARN(is, "timed out waiting for iscsid(8) "
-			    "for %d%s seconds; reconnecting",
-			    is->is_timeout / 1000, tmpstr);
+			    "for %d seconds; reconnecting",
+			    is->is_timeout);
 			reconnect_needed = true;
 		}
 		goto out;
 	}
 
 	if (is->is_login_phase) {
-		if (is->is_login_timeout > 0 && is->is_timeout >= is->is_login_timeout) {
-			if (fast_timer && ((is->is_timeout % 1000) != 0))
-				snprintf(tmpstr, sizeof(tmpstr), ".%d",
-					(is->is_timeout % 1000) / 100);
-			ISCSI_SESSION_WARN(is, "login timed out after %d%s seconds; "
-			    "reconnecting", is->is_timeout / 1000, tmpstr);
+		if (is->is_login_timeout > 0 && is->is_timeout > is->is_login_timeout) {
+			ISCSI_SESSION_WARN(is, "login timed out after %d seconds; "
+			    "reconnecting", is->is_timeout);
 			reconnect_needed = true;
 		}
 		goto out;
@@ -644,11 +633,8 @@ iscsi_callout(void *context)
 	}
 
 	if (is->is_timeout >= is->is_ping_timeout) {
-		if (fast_timer && ((is->is_timeout % 1000) != 0))
-			snprintf(tmpstr, sizeof(tmpstr), ".%d",
-				(is->is_timeout % 1000) / 100);
-		ISCSI_SESSION_WARN(is, "no ping reply (NOP-In) after %d%s seconds; "
-		    "reconnecting", is->is_timeout / 1000, tmpstr);
+		ISCSI_SESSION_WARN(is, "no ping reply (NOP-In) after %d seconds; "
+		    "reconnecting", is->is_ping_timeout);
 		reconnect_needed = true;
 		goto out;
 	}
@@ -663,7 +649,7 @@ iscsi_callout(void *context)
 	 * (It's 2 - one for one second, and one for incrementing is_timeout
 	 * earlier in this routine.)
 	 */
-	if (is->is_timeout < (fast_timer ? 200 : 2000))
+	if (is->is_timeout < 2)
 		return;
 
 	request = icl_pdu_new(is->is_conn, M_NOWAIT);
@@ -1979,7 +1965,6 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
 	const struct iscsi_session *is2;
 	int error;
 	sbintime_t sbt, pr;
-	bool fast_timer;
 
 	iscsi_sanitize_session_conf(&isa->isa_conf);
 	if (iscsi_valid_session_conf(&isa->isa_conf) == false)
@@ -2063,9 +2048,7 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
 	if (is->is_login_timeout < 0)
 		is->is_login_timeout = login_timeout;
 
-	fast_timer = ((is->is_ping_timeout <= 2000) ||
-			(is->is_ping_timeout <= 2000));
-	sbt = mstosbt(fast_timer ? 95 : 995);
+	sbt = mstosbt(995);
 	pr = mstosbt(10);
 	callout_reset_sbt(&is->is_callout, sbt, pr, iscsi_callout, is, 0);
 	TAILQ_INSERT_TAIL(&sc->sc_sessions, is, is_next);
diff --git a/sys/dev/iscsi/iscsi_ioctl.h b/sys/dev/iscsi/iscsi_ioctl.h
index a8f4d5383cc6..d995dbc981a9 100644
--- a/sys/dev/iscsi/iscsi_ioctl.h
+++ b/sys/dev/iscsi/iscsi_ioctl.h
@@ -142,8 +142,6 @@ struct iscsi_daemon_handoff {
 	int				idh_max_send_data_segment_length;
 	int				idh_max_burst_length;
 	int				idh_first_burst_length;
-	int				idh_ping_timeout;
-	int				idh_login_timeout;
 };
 
 struct iscsi_daemon_fail {
diff --git a/usr.bin/iscsictl/iscsi.conf.5 b/usr.bin/iscsictl/iscsi.conf.5
index b99dc9263a8c..325d00bfabe6 100644
--- a/usr.bin/iscsictl/iscsi.conf.5
+++ b/usr.bin/iscsictl/iscsi.conf.5
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 6, 2026
+.Dd February 25, 2022
 .Dt ISCSI.CONF 5
 .Os
 .Sh NAME
@@ -170,7 +170,7 @@ configured using
 seconds) is taken by the driver.
 If present, the PingTimeout can be set to any positive value
 starting with
-.Qq Ar 0.1 .
+.Qq Ar 1 .
 .It Cm LoginTimeout
 Specify the time in seconds to wait for a login PDU to be sent or
 received after trying to establish a new session.
@@ -181,7 +181,7 @@ If this entry is not present in the conf file, the default value of
 seconds is used, as configured by
 .Qq Ar kern.iscsi.login_timeout .
 The LoginTimeout can be set to any positive value starting with
-.Qq Ar 0.1 .
+.Qq Ar 1 .
 .El
 .Sh FILES
 .Bl -tag -width indent
diff --git a/usr.bin/iscsictl/iscsictl.c b/usr.bin/iscsictl/iscsictl.c
index f78fe6ebe0f3..f78e47d226bf 100644
--- a/usr.bin/iscsictl/iscsictl.c
+++ b/usr.bin/iscsictl/iscsictl.c
@@ -448,15 +448,13 @@ kernel_list(int iscsi_fd, const struct target *targ __unused,
 				xo_emit("{L:/%-26s}{V:pcp/0x%02x}\n",
 				    "Target PCP:", conf->isc_pcp);
 			if (conf->isc_ping_timeout != -1)
-				xo_emit("{L:/%-26s}{V:PingTimeout/%d.%d}\n",
-				    "Target Ping Timeout:",
-				    conf->isc_ping_timeout / 1000,
-				    (conf->isc_ping_timeout % 1000) / 100);
+				xo_emit("{L:/%-26s}{V:PingTimeout/%d}\n",
+				    "Target PingTimeout:",
+				    conf->isc_ping_timeout);
 			if (conf->isc_login_timeout != -1)
-				xo_emit("{L:/%-26s}{V:LoginTimeout/%d.%d}\n",
-				    "Target Login Timeout:",
-				    conf->isc_login_timeout / 1000,
-				    (conf->isc_login_timeout % 1000) / 100);
+				xo_emit("{L:/%-26s}{V:LoginTimeout/%d}\n",
+				    "Target LoginTimeout:",
+				    conf->isc_login_timeout);
 			xo_close_container("target");
 
 			xo_open_container("auth");
diff --git a/usr.bin/iscsictl/parse.y b/usr.bin/iscsictl/parse.y
index abdfb2daf6aa..90e0e6320317 100644
--- a/usr.bin/iscsictl/parse.y
+++ b/usr.bin/iscsictl/parse.y
@@ -66,11 +66,9 @@ extern void	yyrestart(FILE *);
 %union
 {
 	char *str;
-	double floating;
 }
 
 %token <str> STR
-%token <floating> FLOAT
 
 %%
 
@@ -383,16 +381,7 @@ ping_timeout:	PINGTIMEOUT EQUALS STR
 			free($3);
 			return(1);
 		}
-		target->t_pingtimeout = tmp * 1000;
-	}
-	|	PINGTIMEOUT EQUALS FLOAT
-	{
-		float tmp;
-
-		if (target->t_pingtimeout != -1)
-			xo_errx(1, "duplicated PingTimeout at line %d", lineno);
-		tmp = $3;
-		target->t_pingtimeout = roundup((int)(tmp * 1000), 100);
+		target->t_pingtimeout = tmp;
 	}
 	;
 
@@ -408,17 +397,7 @@ login_timeout:	LOGINTIMEOUT EQUALS STR
 			free($3);
 			return(1);
 		}
-		target->t_logintimeout = tmp * 1000;
-	}
-	|	LOGINTIMEOUT EQUALS FLOAT
-	{
-		float tmp;
-
-		if (target->t_logintimeout != -1)
-			xo_errx(1, "duplicated LoginTimeout at line %d", lineno);
-
-		tmp = $3;
-		target->t_logintimeout = roundup((int)(tmp * 1000), 100);
+		target->t_logintimeout = tmp;
 	}
 	;
 
diff --git a/usr.bin/iscsictl/token.l b/usr.bin/iscsictl/token.l
index 08cd0f4c174f..efe075958ca1 100644
--- a/usr.bin/iscsictl/token.l
+++ b/usr.bin/iscsictl/token.l
@@ -111,7 +111,6 @@ cs6			{ return CS6;  }
 cs7			{ return CS7;  }
 \"[^"]+\"		{ yylval.str = strndup(yytext + 1,
 			    strlen(yytext) - 2); return STR; }
-[0-9]*\.[0-9]+		{ yylval.floating = atof(yytext); return FLOAT; }
 [a-zA-Z0-9\.\-_/\:\[\]]+ { yylval.str = strdup(yytext); return STR; }
 \{			{ return OPENING_BRACKET; }
 \}			{ return CLOSING_BRACKET; }
diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c
index 3cf6d370a302..7230a8bda6fe 100644
--- a/usr.sbin/iscsid/iscsid.c
+++ b/usr.sbin/iscsid/iscsid.c
@@ -357,7 +357,7 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request)
 	int keepinit = 0;
 	if (conn->conn_conf.isc_login_timeout > 0) {
 		keepinit = conn->conn_conf.isc_login_timeout;
-		log_debugx("session specific LoginTimeout at %d ms",
+		log_debugx("session specific LoginTimeout at %d sec",
 			keepinit);
 	}
 	if (conn->conn_conf.isc_login_timeout == -1) {
@@ -366,13 +366,11 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request)
 		if (sysctlbyname("kern.iscsi.login_timeout",
 		    &value, &size, NULL, 0) == 0) {
 			keepinit = value;
-			log_debugx("global login_timeout at %d ms",
+			log_debugx("global login_timeout at %d sec",
 				keepinit);
 		}
 	}
 	if (keepinit > 0) {
-		/* setsockopt only supports full seconds */
-		keepinit = roundup(keepinit, 1000);
 		if (setsockopt(conn->conn.conn_socket,
 		    IPPROTO_TCP, TCP_KEEPINIT,
 		    &keepinit, sizeof(keepinit)) == -1)
@@ -478,8 +476,6 @@ handoff(struct iscsid_connection *conn)
 	    conn->conn.conn_max_send_data_segment_length;
 	idh.idh_max_burst_length = conn->conn.conn_max_burst_length;
 	idh.idh_first_burst_length = conn->conn.conn_first_burst_length;
-	idh.idh_ping_timeout = conn->conn_conf.isc_ping_timeout;
-	idh.idh_login_timeout = conn->conn_conf.isc_login_timeout;
 
 	error = ioctl(conn->conn_iscsi_fd, ISCSIDHANDOFF, &idh);
 	if (error != 0)