summaryrefslogtreecommitdiffstats
path: root/net/smc
diff options
context:
space:
mode:
authorKarsten Graul <kgraul@linux.ibm.com>2019-01-30 18:51:05 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-17 20:35:33 +0100
commit82060d9311250f2fe9893b89ae13ba0cb6a9d43f (patch)
tree305eade1441899727b8bc9dea57954cde4967c57 /net/smc
parent146f563f9761e070e6ef45e073bdc046035f39a0 (diff)
downloadlinux-stable-82060d9311250f2fe9893b89ae13ba0cb6a9d43f.tar.gz
linux-stable-82060d9311250f2fe9893b89ae13ba0cb6a9d43f.tar.bz2
linux-stable-82060d9311250f2fe9893b89ae13ba0cb6a9d43f.zip
net/smc: do not wait under send_lock
[ Upstream commit 33f3fcc290671590821ff3c0c9396db1ec9b7d4c ] smc_cdc_get_free_slot() might wait for free transfer buffers when using SMC-R. This wait should not be done under the send_lock, which is a spin_lock. This fixes a cpu loop in parallel threads waiting for the send_lock. Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/smc')
-rw-r--r--net/smc/smc_tx.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
index 0ecbbdc337b8..62885a2781c9 100644
--- a/net/smc/smc_tx.c
+++ b/net/smc/smc_tx.c
@@ -486,25 +486,23 @@ static int smcr_tx_sndbuf_nonempty(struct smc_connection *conn)
struct smc_wr_buf *wr_buf;
int rc;
- spin_lock_bh(&conn->send_lock);
rc = smc_cdc_get_free_slot(conn, &wr_buf, &pend);
if (rc < 0) {
if (rc == -EBUSY) {
struct smc_sock *smc =
container_of(conn, struct smc_sock, conn);
- if (smc->sk.sk_err == ECONNABORTED) {
- rc = sock_error(&smc->sk);
- goto out_unlock;
- }
+ if (smc->sk.sk_err == ECONNABORTED)
+ return sock_error(&smc->sk);
rc = 0;
if (conn->alert_token_local) /* connection healthy */
mod_delayed_work(system_wq, &conn->tx_work,
SMC_TX_WORK_DELAY);
}
- goto out_unlock;
+ return rc;
}
+ spin_lock_bh(&conn->send_lock);
if (!conn->local_tx_ctrl.prod_flags.urg_data_present) {
rc = smc_tx_rdma_writes(conn);
if (rc) {