Commit 62c7139f authored by Hans Wippel's avatar Hans Wippel Committed by David S. Miller

net/smc: unlock LGR pending lock earlier for SMC-D

If SMC client and server connections are both established at the same
time, smc_connect_ism() cannot send a CLC confirm message while
smc_listen_work() is waiting for one due to lock contention. This can
result in timeouts in smc_clc_wait_msg() and failed SMC connections.

In case of SMC-D, the LGR pending lock is not needed while
smc_listen_work() is waiting for the CLC confirm message. So, this patch
releases the lock earlier for SMC-D to avoid the locking issue.
Signed-off-by: default avatarHans Wippel <hwippel@linux.ibm.com>
Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a225d2cd
...@@ -1287,10 +1287,15 @@ static void smc_listen_work(struct work_struct *work) ...@@ -1287,10 +1287,15 @@ static void smc_listen_work(struct work_struct *work)
return; return;
} }
/* SMC-D does not need this lock any more */
if (ism_supported)
mutex_unlock(&smc_create_lgr_pending);
/* receive SMC Confirm CLC message */ /* receive SMC Confirm CLC message */
reason_code = smc_clc_wait_msg(new_smc, &cclc, sizeof(cclc), reason_code = smc_clc_wait_msg(new_smc, &cclc, sizeof(cclc),
SMC_CLC_CONFIRM, CLC_WAIT_TIME); SMC_CLC_CONFIRM, CLC_WAIT_TIME);
if (reason_code) { if (reason_code) {
if (!ism_supported)
mutex_unlock(&smc_create_lgr_pending); mutex_unlock(&smc_create_lgr_pending);
smc_listen_decline(new_smc, reason_code, local_contact); smc_listen_decline(new_smc, reason_code, local_contact);
return; return;
...@@ -1298,13 +1303,12 @@ static void smc_listen_work(struct work_struct *work) ...@@ -1298,13 +1303,12 @@ static void smc_listen_work(struct work_struct *work)
/* finish worker */ /* finish worker */
if (!ism_supported) { if (!ism_supported) {
if (smc_listen_rdma_finish(new_smc, &cclc, local_contact)) { rc = smc_listen_rdma_finish(new_smc, &cclc, local_contact);
mutex_unlock(&smc_create_lgr_pending); mutex_unlock(&smc_create_lgr_pending);
if (rc)
return; return;
} }
}
smc_conn_save_peer_info(new_smc, &cclc); smc_conn_save_peer_info(new_smc, &cclc);
mutex_unlock(&smc_create_lgr_pending);
smc_listen_out_connected(new_smc); smc_listen_out_connected(new_smc);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment