From: Karsten Graul <kgraul@linux.ibm.com>
Subject: net/smc: cleanup listen worker mutex unlocking
Patch-mainline: v5.0-rc1
Git-commit: 587e41dcea357a1ac15e3b31d800900e1c585d7e
References: FATE#325698, LTC#167867, bsc#1113481
Description: net/smc: bugfix and compatibility patches
Symptom: Random hangs in smc processing:
user space application hangs in socket send() or recv() call or
does never get a notification from a select() call.
Missing compatibility to other platforms:
confirm rkey and delete rkey processing is required by the
design, but delete rkey processing is missing. This leads to
protocol failures when communicating with other platforms like
zOS. The SMC-D shutdown signal support is missing, so there is
no detection if the remote peer closed the link group.
Broken administration of available WR send payload buffers due to
a use-after-free condition.
Problem: Misbehaviour regarding the user space api can lead to hang
situations. SMC is not fully compatible to some other platforms
due to missing rkey processing and SMC-D shutdown signal support.
Solution: Fixed protocoll deficiencies by implementing the required rkey
processing. For SMC-D, the cursors are now handled atomically to
handle parallel modifications. The SMC-D shutdown signal is now
processed when received and sent to the remote peer if needed.
Prereq patches are included.
Reproduction: Run SMC on a loaded system against zOS as peer system.
Upstream-Description:
net/smc: cleanup listen worker mutex unlocking
For easier reading move the unlock of mutex smc_create_lgr_pending into
smc_listen_work(), i.e. into the function the mutex has been locked.
No functional change.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
net/smc/af_smc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1185,7 +1185,6 @@ static int smc_listen_rdma_finish(struct
return 0;
decline:
- mutex_unlock(&smc_create_lgr_pending);
smc_listen_decline(new_smc, reason_code, local_contact);
return reason_code;
}
@@ -1285,8 +1284,10 @@ static void smc_listen_work(struct work_
/* finish worker */
if (!ism_supported) {
- if (smc_listen_rdma_finish(new_smc, &cclc, local_contact))
+ if (smc_listen_rdma_finish(new_smc, &cclc, local_contact)) {
+ mutex_unlock(&smc_create_lgr_pending);
return;
+ }
}
smc_conn_save_peer_info(new_smc, &cclc);
mutex_unlock(&smc_create_lgr_pending);