net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error cause by server
authorD. Wythe <alibuda@linux.alibaba.com>
Wed, 2 Mar 2022 13:25:12 +0000 (21:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:01:57 +0000 (19:01 +0100)
commitb9cea2e600a38b191ab8b692eee5c662258c36a8
tree962d8df48e356eabf6178c50d25fc9d5ddae9635
parentacff2f561ff46081dc5ec3d9f753382867504f05
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>
net/smc/smc_core.c