net/smc: delete rkey first before switching to unused

Once RMBs are flagged as unused they are candidates for reuse.
Thus the LLC DELETE RKEY operaton should be made before flagging
the RMB as unused.

Fixes: c7674c001b ("net/smc: unregister rkeys of unused buffer")
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ursula Braun 2019-02-04 13:44:46 +01:00 committed by David S. Miller
parent b8649efad8
commit a5e04318c8

View File

@ -302,13 +302,13 @@ static void smc_buf_unuse(struct smc_connection *conn,
conn->sndbuf_desc->used = 0; conn->sndbuf_desc->used = 0;
if (conn->rmb_desc) { if (conn->rmb_desc) {
if (!conn->rmb_desc->regerr) { if (!conn->rmb_desc->regerr) {
conn->rmb_desc->used = 0;
if (!lgr->is_smcd) { if (!lgr->is_smcd) {
/* unregister rmb with peer */ /* unregister rmb with peer */
smc_llc_do_delete_rkey( smc_llc_do_delete_rkey(
&lgr->lnk[SMC_SINGLE_LINK], &lgr->lnk[SMC_SINGLE_LINK],
conn->rmb_desc); conn->rmb_desc);
} }
conn->rmb_desc->used = 0;
} else { } else {
/* buf registration failed, reuse not possible */ /* buf registration failed, reuse not possible */
write_lock_bh(&lgr->rmbs_lock); write_lock_bh(&lgr->rmbs_lock);