Skip to content

Commit 9f85df8

Browse files
kcp-gitjfvogel
authored andcommitted
rds: RDS (tcp) hangs on sendto() to unresponding address
In rds_send_mprds_hash(), if the calculated hash value is non-zero and the MPRDS connections are not yet up, it will wait. But it should not wait if the send is non-blocking. In this case, it should just use the base c_path for sending the message. Orabug: 28720880 Signed-off-by: Ka-Cheong Poon <[email protected]> Reviewed-by: Sowmini Varadhan <[email protected]> Reviewed-by: Santosh Shilimkar <[email protected]>
1 parent 4ca6db7 commit 9f85df8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

net/rds/send.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,8 @@ static inline int rds_rdma_bytes(struct msghdr *msg, size_t *rdma_bytes)
11821182
return 0;
11831183
}
11841184

1185-
static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn)
1185+
static int rds_send_mprds_hash(struct rds_sock *rs,
1186+
struct rds_connection *conn, int nonblock)
11861187
{
11871188
int hash;
11881189

@@ -1198,10 +1199,16 @@ static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn)
11981199
* used. But if we are interrupted, we have to use the zero
11991200
* c_path in case the connection ends up being non-MP capable.
12001201
*/
1201-
if (conn->c_npaths == 0)
1202+
if (conn->c_npaths == 0) {
1203+
/* Cannot wait for the connection be made, so just use
1204+
* the base c_path.
1205+
*/
1206+
if (nonblock)
1207+
return 0;
12021208
if (wait_event_interruptible(conn->c_hs_waitq,
12031209
conn->c_npaths != 0))
12041210
hash = 0;
1211+
}
12051212
if (conn->c_npaths == 1)
12061213
hash = 0;
12071214
}
@@ -1433,7 +1440,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
14331440
}
14341441

14351442
if (conn->c_trans->t_mp_capable)
1436-
cpath = &conn->c_path[rds_send_mprds_hash(rs, conn)];
1443+
cpath = &conn->c_path[rds_send_mprds_hash(rs, conn, nonblock)];
14371444
else
14381445
cpath = &conn->c_path[0];
14391446

0 commit comments

Comments
 (0)