From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A612B346E4B for ; Wed, 22 Oct 2025 19:17:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761160638; cv=none; b=ocwIu2G0pdv/wLMuJ7I8tQghmrpK24s0WhZ5XSormkZQJi1mabby7IRAls6X23x4VuNSgC0wu36V3mdyARxZqvrtImfb4P93W3pCUAh9Q5MG3M1FhztP48n743VagkXpCPx8gVzQGdbcIxN1CTO0Vc9v7txjjEUPAYSRw05mgRQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761160638; c=relaxed/simple; bh=PTxMk/RonRdKb56ndUriFdze8vNsgm9+IAYAPigEVfM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mvVIZlUCJTW6UaEfH8k2uTWQ+EmLrf/3jkZg4eSyHHpyyKP5PjdVWovjFxMd2cR7cg1MnZMnjAp5fL1KKe5cadQbupzBGJX3z8nOlVvLake66TifwMH3Ph+fgdRNc2QiXwPLV6YraNjXO5jhQDTs35zSl9o4CRnYlwMbhgQail8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZIvgB633; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZIvgB633" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 253C5C4CEE7 for ; Wed, 22 Oct 2025 19:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761160638; bh=PTxMk/RonRdKb56ndUriFdze8vNsgm9+IAYAPigEVfM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZIvgB633lezQ6aYnPxBLF88zRKMQ0Xeau1Pesa17P/syLXnjQodr5m54nHpu6TTHK i4/FuAH5tLlxQS8hF73fyDxO5nae+oTPHbgv0tqFhOgoP3vZ7fa//PG/I70/X330zt sdJ/ZPkyng2BzPUY1FcOq5duNwhOCgfnFhC/DCSt3GtOcDKJHQyAdZWYj9VFTynvRF Kia4YbVj4GHAgD4T+eUz6jj3BV90UWKCAjh2JTbpoJW1s5eLMCP1SqPlvyzPGKbAf0 vL9bGHxDf5oGsOML8jGkLHruvE0i9ymcmaCoqUa1J2IUPaz2ZMh6EIWLV1CZnGYaGL FiTWBxDAkLvXg== From: Allison Henderson To: netdev@vger.kernel.org Subject: [RFC 04/15] net/rds: No shortcut out of RDS_CONN_ERROR Date: Wed, 22 Oct 2025 12:17:04 -0700 Message-ID: <20251022191715.157755-5-achender@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022191715.157755-1-achender@kernel.org> References: <20251022191715.157755-1-achender@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Gerd Rausch RDS connections carry a state "rds_conn_path::cp_state" and transitions from one state to another and are conditional upon an expected state: "rds_conn_path_transition." There is one exception to this conditionality, which is "RDS_CONN_ERROR" that can be enforced by "rds_conn_path_drop" regardless of what state the condition is currently in. But as soon as a connection enters state "RDS_CONN_ERROR", the connection handling code expects it to go through the shutdown-path. The RDS/TCP multipath changes added a shortcut out of "RDS_CONN_ERROR" straight back to "RDS_CONN_CONNECTING" via "rds_tcp_accept_one_path" (e.g. after "rds_tcp_state_change"). A subsequent "rds_tcp_reset_callbacks" can then transition the state to "RDS_CONN_RESETTING" with a shutdown-worker queued. That'll trip up "rds_conn_init_shutdown", which was never adjusted to handle "RDS_CONN_RESETTING" and subsequently drops the connection with the dreaded "DR_INV_CONN_STATE", which leaves "RDS_SHUTDOWN_WORK_QUEUED" on forever. So we do two things here: a) Don't shortcut "RDS_CONN_ERROR", but take the longer path through the shutdown code. b) Add "RDS_CONN_RESETTING" to the expected states in "rds_conn_init_shutdown" so that we won't error out and get stuck, if we ever hit weird state transitions like this again." Fixes: 9c79440e2c5e ("RDS: TCP: fix race windows in send-path quiescence by rds_tcp_accept_one()") Signed-off-by: Gerd Rausch Signed-off-by: Allison Henderson --- net/rds/connection.c | 2 ++ net/rds/tcp_listen.c | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/net/rds/connection.c b/net/rds/connection.c index ac555f02c045..556e5488c495 100644 --- a/net/rds/connection.c +++ b/net/rds/connection.c @@ -390,6 +390,8 @@ void rds_conn_shutdown(struct rds_conn_path *cp) if (!rds_conn_path_transition(cp, RDS_CONN_UP, RDS_CONN_DISCONNECTING) && !rds_conn_path_transition(cp, RDS_CONN_ERROR, + RDS_CONN_DISCONNECTING) && + !rds_conn_path_transition(cp, RDS_CONN_RESETTING, RDS_CONN_DISCONNECTING)) { rds_conn_path_error(cp, "shutdown called in state %d\n", diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 91e34af3fe5d..65c5425a02de 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c @@ -59,9 +59,6 @@ void rds_tcp_keepalive(struct socket *sock) * socket and force a reconneect from smaller -> larger ip addr. The reason * we special case cp_index 0 is to allow the rds probe ping itself to itself * get through efficiently. - * Since reconnects are only initiated from the node with the numerically - * smaller ip address, we recycle conns in RDS_CONN_ERROR on the passive side - * by moving them to CONNECTING in this function. */ static struct rds_tcp_connection *rds_tcp_accept_one_path(struct rds_connection *conn) @@ -86,8 +83,6 @@ struct rds_tcp_connection *rds_tcp_accept_one_path(struct rds_connection *conn) struct rds_conn_path *cp = &conn->c_path[i]; if (rds_conn_path_transition(cp, RDS_CONN_DOWN, - RDS_CONN_CONNECTING) || - rds_conn_path_transition(cp, RDS_CONN_ERROR, RDS_CONN_CONNECTING)) { return cp->cp_transport_data; } -- 2.43.0