Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4562439pja; Thu, 21 Nov 2019 21:55:27 -0800 (PST) X-Google-Smtp-Source: APXvYqy78rkU8LXEoTfnGS5Gg4RFd96YX26VfrOtsU4bbtgP7iMq5cByDibuc12eAtqwO0ocPXrt X-Received: by 2002:a17:906:4dda:: with SMTP id f26mr19761243ejw.89.1574402126787; Thu, 21 Nov 2019 21:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574402126; cv=none; d=google.com; s=arc-20160816; b=Oi55O/DcC9lO6uZWx9XybGCMkW08NDuDEYyifRZzVQiJ8BC2a4hDgZeekPx3zPeRaU Akt4E2bkkXQbOqHsqWTwEz8rfdwItJ5fnG6NfNutF5ncgEC/87GkwvR4FePm7Z/wPEm/ l0XLrTTAwZptrTfH9aSfkorTtb/+tWtcDExF1X4M2x9s3n5DHvthT0mHdJVx8lTpI+pz ZBpu2lfvyHrd46cG9G4XrVeudjWWPgmcNlbP3RajVB402KzdekAcqquhC99K3jCEUrTn hjkX4ZRyT6sc51H84M5j9E+X/ydxwvRoy0XdpfmiGKMXh8L4C7ecPIcwvE26qD+1+0f0 Hp9A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U/Ax9o9PWP6T6m4pA5cKRFeobXRmgpRFOoMY0etEsSY=; b=hiq3M5fMb4tjgLNVee1Fc9ZUjU9CptLJe1jWiRLHkKH8CzVMl2haL8+ZP4IW3YDiNM qfN34JYpPcivNNoJ/nQNXc0+Va2hTfwlxOtjGap5Oqq//yhtGdB0BjciCND8gmRlQska KhpgFNE4vsG9381ptAti+YYGYdT1gTUeuPPK8qAuzJ1qxLKifDFqjQZ6cRFdcw7q457S +TginYtz1EsOJYqtfeeEx4iOKEnVr4Cp2f+v4LyeEIv56l+TIwovOejjFZADPrhWK+7W O+JyJXC3MBLrtmckBUfr7vK02JitziKkoeVAaMTybSU7q40o8W+XUsJ2CKxhrrpRhXHf kr7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=e1qlgeqm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19si3339719ejr.411.2019.11.21.21.55.02; Thu, 21 Nov 2019 21:55:26 -0800 (PST) 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=e1qlgeqm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728689AbfKVFwt (ORCPT + 99 others); Fri, 22 Nov 2019 00:52:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:58480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728635AbfKVFwk (ORCPT ); Fri, 22 Nov 2019 00:52:40 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 950532075E; Fri, 22 Nov 2019 05:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574401959; bh=WDj1lebzsJppGjn2JeS5Fu1Vx3UyS1VisVUioDpEbow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e1qlgeqmv0Rxd6Q+CTU+kgk9pXiIno0m29bWn3pW5pl+QWt4OV6DaSF0nlanZPUOW DVe85HMsEYRtBHHgDzdJTumjK6t00soRIi3gHxhQz1OVZeakcoELILdjfoZcgsCKxN x+CifEMqFpCx7e7XHQwSY3aI4Cvw0LDhU+OaZe+g= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Karsten Graul , Ursula Braun , "David S . Miller" , Sasha Levin , linux-s390@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 181/219] net/smc: don't wait for send buffer space when data was already sent Date: Fri, 22 Nov 2019 00:48:33 -0500 Message-Id: <20191122054911.1750-174-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122054911.1750-1-sashal@kernel.org> References: <20191122054911.1750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Karsten Graul [ Upstream commit 6889b36da78a21a312d8b462c1fa25a03c2ff192 ] When there is no more send buffer space and at least 1 byte was already sent then return to user space. The wait is only done when no data was sent by the sendmsg() call. This fixes smc_tx_sendmsg() which tried to always send all user data and started to wait for free send buffer space when needed. During this wait the user space program was blocked in the sendmsg() call and hence not able to receive incoming data. When both sides were in such a situation then the connection stalled forever. Signed-off-by: Karsten Graul Signed-off-by: Ursula Braun Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/smc/smc_tx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c index 28361aef99825..f1f621675db01 100644 --- a/net/smc/smc_tx.c +++ b/net/smc/smc_tx.c @@ -163,12 +163,11 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len) conn->local_tx_ctrl.prod_flags.urg_data_pending = 1; if (!atomic_read(&conn->sndbuf_space) || conn->urg_tx_pend) { + if (send_done) + return send_done; rc = smc_tx_wait(smc, msg->msg_flags); - if (rc) { - if (send_done) - return send_done; + if (rc) goto out_err; - } continue; } -- 2.20.1