Skip to content

Commit 3d6e0fe

Browse files
Wengang-oracleMukesh Kacker
authored andcommitted
rds_rdma: rds_sendmsg should return EAGAIN if connection not setup
In rds_sendmsg(), in the case RDS_CMSG_RDMA_MAP is requested and rds_cmsg_send() is called, a "struct rds_mr" needs to be created. For creating the "struct rds_mr", the connection needs to be established(ready) for rds_ib_transport. Otherwise, __rds_rdma_map() would fail because it can't find the right rds_ib_device (which is associated with the ip address matching rds_sock's bound ip address). The ip address is set at the completion of the rdma connection. But actually in code, the connecting is triggered after the call of call rds_cmsg_send() so rds_cmsg_send() would fail with -NODEV. The fix is to move the trigger of connection before calling rds_cmsg_send() and return -EAGAIN in case connection is not ready yet when we are calling rds_cmsg_send(). Orabug: 21551474 Signed-off-by: Wengang Wang <[email protected]> Reviewed-by: Chien-Hua Yen <[email protected]>
1 parent 5660542 commit 3d6e0fe

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

net/rds/send.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,11 +1226,6 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
12261226

12271227
rm->m_daddr = daddr;
12281228

1229-
/* Parse any control messages the user may have included. */
1230-
ret = rds_cmsg_send(rs, rm, msg, &allocated_mr);
1231-
if (ret)
1232-
goto out;
1233-
12341229
if (rm->rdma.op_active)
12351230
total_payload_len += rm->rdma.op_bytes;
12361231

@@ -1318,6 +1313,16 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
13181313
goto out;
13191314
}
13201315

1316+
if (!rds_conn_up(conn)) {
1317+
ret = -EAGAIN;
1318+
goto out;
1319+
}
1320+
1321+
/* Parse any control messages the user may have included. */
1322+
ret = rds_cmsg_send(rs, rm, msg, &allocated_mr);
1323+
if (ret)
1324+
goto out;
1325+
13211326
while (!rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port,
13221327
dport, &queued)) {
13231328
rds_stats_inc(s_send_queue_full);

0 commit comments

Comments
 (0)