Skip to content

Commit 584a827

Browse files
RDS: RDMA: return appropriate error on rdma map failures
The first message to a remote node should prompt a new connection even if it is RDMA operation. For RDMA operation the MR mapping can fail because connections is not yet up. Since the connection establishment is asynchronous, we make sure the map failure because of unavailable connection reach to the user by appropriate error code. Before returning to the user, lets trigger the connection so that its ready for the next retry. Signed-off-by: Santosh Shilimkar <[email protected]>
1 parent 8d5d8a5 commit 584a827

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

net/rds/send.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,11 @@ static int rds_cmsg_send(struct rds_sock *rs, struct rds_message *rm,
945945
ret = rds_cmsg_rdma_map(rs, rm, cmsg);
946946
if (!ret)
947947
*allocated_mr = 1;
948+
else if (ret == -ENODEV)
949+
/* Accommodate the get_mr() case which can fail
950+
* if connection isn't established yet.
951+
*/
952+
ret = -EAGAIN;
948953
break;
949954
case RDS_CMSG_ATOMIC_CSWP:
950955
case RDS_CMSG_ATOMIC_FADD:
@@ -1082,8 +1087,12 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
10821087

10831088
/* Parse any control messages the user may have included. */
10841089
ret = rds_cmsg_send(rs, rm, msg, &allocated_mr);
1085-
if (ret)
1090+
if (ret) {
1091+
/* Trigger connection so that its ready for the next retry */
1092+
if (ret == -EAGAIN)
1093+
rds_conn_connect_if_down(conn);
10861094
goto out;
1095+
}
10871096

10881097
if (rm->rdma.op_active && !conn->c_trans->xmit_rdma) {
10891098
printk_ratelimited(KERN_NOTICE "rdma_op %p conn xmit_rdma %p\n",

0 commit comments

Comments
 (0)