Skip to content

Commit c221e09

Browse files
gerd-rauschvijay-suman
authored andcommitted
net/rds: Connect TCP backends deterministically
Multiple RDS/TCP backend connections need to be brought up deterministically (i.e. first #0, then #1, ... then #7), in order to not shuffle per-path connection state that's preserved across reconnects (e.g. "cp_next_rx_seq") Orabug: 32422417 Signed-off-by: Gerd Rausch <[email protected]> Reviewed-by: Sharath Srinivasan <[email protected]>
1 parent 17c3451 commit c221e09

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

net/rds/tcp_connect.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp)
9393
char *reason = NULL;
9494
int addrlen;
9595
bool isv6;
96-
int ret;
96+
int ret, i;
9797
struct rds_connection *conn = cp->cp_conn;
9898
struct rds_tcp_connection *tc = cp->cp_transport_data;
9999

@@ -106,6 +106,18 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp)
106106
goto out_nolock;
107107
}
108108

109+
/* Multiple backend connections need to be brought up
110+
* deterministically (i.e. first #0, then #1, ... then #7),
111+
* in order to not shuffle per-path connection state
112+
* that's preserved across reconnects (e.g. "cp_next_rx_seq")
113+
*/
114+
for (i = 0; i < cp->cp_index; i++) {
115+
if (!rds_conn_path_up(conn->c_path + i)) {
116+
ret = -EAGAIN;
117+
goto out_nolock;
118+
}
119+
}
120+
109121
mutex_lock(&tc->t_conn_path_lock);
110122

111123
if (rds_conn_path_up(cp)) {

net/rds/tcp_listen.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ rds_tcp_accept_one_path(struct rds_connection *conn)
8080
RDS_CONN_CONNECTING, DR_DEFAULT)) {
8181
return cp->cp_transport_data;
8282
}
83+
84+
/* only proceed to the next path if all prior paths are up */
85+
if (!rds_conn_path_up(cp))
86+
break;
8387
}
88+
8489
return NULL;
8590
}
8691

0 commit comments

Comments
 (0)