]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/rds: No shortcut out of RDS_CONN_ERROR
authorGerd Rausch <gerd.rausch@oracle.com>
Thu, 22 Jan 2026 05:52:12 +0000 (22:52 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 23 Jan 2026 19:51:31 +0000 (11:51 -0800)
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."

Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Link: https://patch.msgid.link/20260122055213.83608-2-achender@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/rds/connection.c
net/rds/tcp_listen.c

index e920c685e4f29bd5d2298a82a5eb4f80b537d512..4a9d80d56f56e58f531319563810fe8acfe0c83a 100644 (file)
@@ -395,6 +395,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",
index 820d3e20de1952033317747da0b9718d94abf23a..27b6107ddc28d28762bc04c4f0b69667894e0ca8 100644 (file)
@@ -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;
                }