Skip to content

Commit 57d2ce1

Browse files
SantoshShilimkargregkh
authored andcommitted
RDS: RDMA: return appropriate error on rdma map failures
[ Upstream commit 584a8279a44a800dea5a5c1e9d53a002e03016b4 ] 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 <santosh.shilimkar@oracle.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bbb1fc7 commit 57d2ce1

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

net/rds/send.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,11 @@ static int rds_cmsg_send(struct rds_sock *rs, struct rds_message *rm,
959959
ret = rds_cmsg_rdma_map(rs, rm, cmsg);
960960
if (!ret)
961961
*allocated_mr = 1;
962+
else if (ret == -ENODEV)
963+
/* Accommodate the get_mr() case which can fail
964+
* if connection isn't established yet.
965+
*/
966+
ret = -EAGAIN;
962967
break;
963968
case RDS_CMSG_ATOMIC_CSWP:
964969
case RDS_CMSG_ATOMIC_FADD:
@@ -1072,8 +1077,12 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
10721077

10731078
/* Parse any control messages the user may have included. */
10741079
ret = rds_cmsg_send(rs, rm, msg, &allocated_mr);
1075-
if (ret)
1080+
if (ret) {
1081+
/* Trigger connection so that its ready for the next retry */
1082+
if (ret == -EAGAIN)
1083+
rds_conn_connect_if_down(conn);
10761084
goto out;
1085+
}
10771086

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

0 commit comments

Comments
 (0)