Return-Path: Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:1966 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751751AbdKVWYJ (ORCPT ); Wed, 22 Nov 2017 17:24:09 -0500 From: alexander.levin@verizon.com Cc: Santosh Shilimkar , alexander.levin@verizon.com To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 03/56] RDS: RDMA: return appropriate error on rdma map failures Date: Wed, 22 Nov 2017 22:23:25 +0000 Message-ID: <20171122222246.19618-6-alexander.levin@verizon.com> References: <20171122222246.19618-1-alexander.levin@verizon.com> In-Reply-To: <20171122222246.19618-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Santosh Shilimkar [ 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 Signed-off-by: Sasha Levin --- net/rds/send.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/rds/send.c b/net/rds/send.c index 310d57928405..ad247dc71ebb 100644 --- a/net/rds/send.c +++ b/net/rds/send.c @@ -946,6 +946,11 @@ static int rds_cmsg_send(struct rds_sock *rs, struct r= ds_message *rm, ret =3D rds_cmsg_rdma_map(rs, rm, cmsg); if (!ret) *allocated_mr =3D 1; + else if (ret =3D=3D -ENODEV) + /* Accommodate the get_mr() case which can fail + * if connection isn't established yet. + */ + ret =3D -EAGAIN; break; case RDS_CMSG_ATOMIC_CSWP: case RDS_CMSG_ATOMIC_FADD: @@ -1114,8 +1119,12 @@ int rds_sendmsg(struct socket *sock, struct msghdr *= msg, size_t payload_len) =20 /* Parse any control messages the user may have included. */ ret =3D rds_cmsg_send(rs, rm, msg, &allocated_mr); - if (ret) + if (ret) { + /* Trigger connection so that its ready for the next retry */ + if (ret =3D=3D -EAGAIN) + rds_conn_connect_if_down(conn); goto out; + } =20 if (rm->rdma.op_active && !conn->c_trans->xmit_rdma) { printk_ratelimited(KERN_NOTICE "rdma_op %p conn xmit_rdma %p\n", --=20 2.11.0