Skip to content

Commit 4940a1f

Browse files
D. Wythedavem330
authored andcommitted
net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error cause by server
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: cd6851f ("smc: remote memory buffers (RMBs)") Signed-off-by: D. Wythe <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0537f0a commit 4940a1f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/smc/smc_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,8 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
18641864
(ini->smcd_version == SMC_V2 ||
18651865
lgr->vlan_id == ini->vlan_id) &&
18661866
(role == SMC_CLNT || ini->is_smcd ||
1867-
lgr->conns_num < SMC_RMBS_PER_LGR_MAX)) {
1867+
(lgr->conns_num < SMC_RMBS_PER_LGR_MAX &&
1868+
!bitmap_full(lgr->rtokens_used_mask, SMC_RMBS_PER_LGR_MAX)))) {
18681869
/* link group found */
18691870
ini->first_contact_local = 0;
18701871
conn->lgr = lgr;

0 commit comments

Comments
 (0)