Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2478065imd; Fri, 2 Nov 2018 12:06:24 -0700 (PDT) X-Google-Smtp-Source: AJdET5eWnrM5LhUHoDnfovk0VgrBvWSD5lpWfc0yh4yuYemBXcXgeemxIiY/Cz3N3WjoKhcQbaZD X-Received: by 2002:a17:902:7b8e:: with SMTP id w14-v6mr12516250pll.289.1541185584055; Fri, 02 Nov 2018 12:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541185584; cv=none; d=google.com; s=arc-20160816; b=vos7unzDGj6CTXje5AvqI5K2Iu+oWpwkLen633+hyGhvp5leE0mvY0X+Hn81aJK647 WceNHQeIYQlrLt+nlKuKbIkxIUL4qDyhRZ5OwEaGRgQo40gZrPmxAVRBF+2b3bzL/zbM 6upOM0Ee+uoag9XJfjLAuxNAnGRVKyAvX2zVrXfz3cDkdcE919P9ajzQyRTUvHqK5Sud 6Jja0YskaUslPZU+Mxo7/8FaUy5zxRPoTUF4AhhpL6dxpo7sL8OT0LYbs+cw3DEyqRMh dboxltJedc2mpEkwi5wUUfDUFU4999hfXaveZ8qKI2qNRiawmEjm80kGH0Hl/A914zUS YGQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pcbDptFyzgWilHt7GAd4j8zV1YT5fhF2yKxrXsPlSIw=; b=paBhkuuSdTE8ibo9qCDwpvYweGa55oI+FnKV7XAn/QpKV3PLL9uRfZoLZjgB11EV/3 TdkjHMiXcy2/1qomVVe2BMRt20gVf+tFFcI2GfJNZ1WP6dnD6cUzQD7iu7pXhkvx8pIf z6fRxomAds0JGNMrYwUOaxbAwmPfxNsuB1wXCqiV1s401++SG8gaC73PzRKEsi+dji48 jtFIaHiA5QmpjGYm4v+M/Mzraop2h25/k9Z0kCqhdBfzAUJSOWM/Zj4Woou3dhmgGvi9 6nIfbBL5qP8RVjlYi7kX7+glNuriKnWY4NeKGAfh8vEbPonbsuYPGnysjMf5Kzm5DFeF oB1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lmE+NQOQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8-v6si13448110pgk.424.2018.11.02.12.06.09; Fri, 02 Nov 2018 12:06:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lmE+NQOQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729783AbeKCDui (ORCPT + 99 others); Fri, 2 Nov 2018 23:50:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:45684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728033AbeKCDuh (ORCPT ); Fri, 2 Nov 2018 23:50:37 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 91F132084A; Fri, 2 Nov 2018 18:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184145; bh=9x1Tq2k+wKfP/VnhYqv7+K37ERtkRKem4BJA+8e6/e4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lmE+NQOQtC3+WMVLMubPkz4NjIbgGyAJ9lcuwMUCKnEQbc6ZmS4yqn6M3eFAiPtTf JdRq2GudYpg6K1AX8ielPjit3ULUWHTBYBgIhLaEGbpx0IkGf0g/c3A+qwzAdjwW6p HGEGU9QmjYNV8F1qfilMruR1X/VWBqTZybE5gLWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ka-Cheong Poon , Santosh Shilimkar , "David S. Miller" , Sasha Levin Subject: [PATCH 4.18 093/150] rds: RDS (tcp) hangs on sendto() to unresponding address Date: Fri, 2 Nov 2018 19:34:15 +0100 Message-Id: <20181102182909.932793629@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 Acked-by: Santosh Shilimkar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/rds/send.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/net/rds/send.c b/net/rds/send.c index 59f17a2335f4..0e54ca0f4e9e 100644 --- a/net/rds/send.c +++ b/net/rds/send.c @@ -1006,7 +1006,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; @@ -1022,10 +1023,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; } @@ -1170,7 +1177,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]; -- 2.17.1