]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
rds: RDS (tcp) hangs on sendto() to unresponding address
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>
Mon, 8 Oct 2018 16:17:11 +0000 (09:17 -0700)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:55:44 +0000 (19:55 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836654
[ Upstream commit 9a4890bd6d6325a1c88564a20ab310b2d56f6094 ]

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.

Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/rds/send.c

index 23f2d81e7967dacd42b8d4a98165714345b37ba0..b941dd784398147967bd1257c59efe5ad950484f 100644 (file)
@@ -975,7 +975,8 @@ static int rds_cmsg_send(struct rds_sock *rs, struct rds_message *rm,
        return ret;
 }
 
-static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn)
+static int rds_send_mprds_hash(struct rds_sock *rs,
+                              struct rds_connection *conn, int nonblock)
 {
        int hash;
 
@@ -991,10 +992,16 @@ static int rds_send_mprds_hash(struct rds_sock *rs, struct rds_connection *conn)
                 * used.  But if we are interrupted, we have to use the zero
                 * c_path in case the connection ends up being non-MP capable.
                 */
-               if (conn->c_npaths == 0)
+               if (conn->c_npaths == 0) {
+                       /* Cannot wait for the connection be made, so just use
+                        * the base c_path.
+                        */
+                       if (nonblock)
+                               return 0;
                        if (wait_event_interruptible(conn->c_hs_waitq,
                                                     conn->c_npaths != 0))
                                hash = 0;
+               }
                if (conn->c_npaths == 1)
                        hash = 0;
        }
@@ -1152,7 +1159,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
        }
 
        if (conn->c_trans->t_mp_capable)
-               cpath = &conn->c_path[rds_send_mprds_hash(rs, conn)];
+               cpath = &conn->c_path[rds_send_mprds_hash(rs, conn, nonblock)];
        else
                cpath = &conn->c_path[0];