summaryrefslogtreecommitdiffstats
path: root/net/smc
diff options
context:
space:
mode:
authorD. Wythe <alibuda@linux.alibaba.com>2022-03-02 21:25:12 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-03-08 19:04:08 +0100
commit9b64b0928207be2aabc5e6c71be86d469ebd3256 (patch)
treeae21631fcfa522aaec267611aef0192589a304ff /net/smc
parente84b216e55ac570f7a137e3bc78c80fc44f6aa2e (diff)
downloadlinux-stable-9b64b0928207be2aabc5e6c71be86d469ebd3256.tar.gz
linux-stable-9b64b0928207be2aabc5e6c71be86d469ebd3256.tar.bz2
linux-stable-9b64b0928207be2aabc5e6c71be86d469ebd3256.zip
net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error cause by server
commit 4940a1fdf31c39f0806ac831cde333134862030b upstream. The problem of SMC_CLC_DECL_ERR_REGRMB on the server is very clear. Based on the fact that whether a new SMC connection can be accepted or not depends on not only the limit of conn nums, but also the available entries of rtoken. Since the rtoken release is trigger by peer, while the conn nums is decrease by local, tons of thing can happen in this time difference. This only thing that needs to be mentioned is that now all connection creations are completely protected by smc_server_lgr_pending lock, it's enough to check only the available entries in rtokens_used_mask. Fixes: cd6851f30386 ("smc: remote memory buffers (RMBs)") Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/smc')
-rw-r--r--net/smc/smc_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 59baa53201c5..6add3094ea9e 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -609,7 +609,8 @@ int smc_conn_create(struct smc_sock *smc, bool is_smcd, int srv_first_contact,
!lgr->sync_err &&
lgr->vlan_id == vlan_id &&
(role == SMC_CLNT ||
- lgr->conns_num < SMC_RMBS_PER_LGR_MAX)) {
+ (lgr->conns_num < SMC_RMBS_PER_LGR_MAX &&
+ !bitmap_full(lgr->rtokens_used_mask, SMC_RMBS_PER_LGR_MAX)))) {
/* link group found */
local_contact = SMC_REUSE_CONTACT;
conn->lgr = lgr;