diff options
author | Karsten Graul <kgraul@linux.ibm.com> | 2020-05-01 12:48:05 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-05-02 01:20:04 +0200 |
commit | d550066776aae3bb31e0240cab24f62e33c47fd3 (patch) | |
tree | 00ec1288640766d1124baa26c72ec2f0a16638aa /net/smc/af_smc.c | |
parent | net/smc: extend smc_llc_send_add_link() and smc_llc_send_delete_link() (diff) | |
download | linux-d550066776aae3bb31e0240cab24f62e33c47fd3.tar.xz linux-d550066776aae3bb31e0240cab24f62e33c47fd3.zip |
net/smc: mutex to protect the lgr against parallel reconfigurations
Introduce llc_conf_mutex in the link group which is used to protect the
buffers and lgr states against parallel link reconfiguration.
This ensures that new connections do not start to register buffers with
the links of a link group when link creation or termination is running.
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/af_smc.c')
-rw-r--r-- | net/smc/af_smc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 20d6d3fbb86c..6663a63be9e4 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -344,6 +344,13 @@ static int smcr_lgr_reg_rmbs(struct smc_link *link, struct smc_link_group *lgr = link->lgr; int i, rc = 0; + rc = smc_llc_flow_initiate(lgr, SMC_LLC_FLOW_RKEY); + if (rc) + return rc; + /* protect against parallel smc_llc_cli_rkey_exchange() and + * parallel smcr_link_reg_rmb() + */ + mutex_lock(&lgr->llc_conf_mutex); for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { if (lgr->lnk[i].state != SMC_LNK_ACTIVE) continue; @@ -360,6 +367,8 @@ static int smcr_lgr_reg_rmbs(struct smc_link *link, } rmb_desc->is_conf_rkey = true; out: + mutex_unlock(&lgr->llc_conf_mutex); + smc_llc_flow_stop(lgr, &lgr->llc_flow_lcl); return rc; } |