提交 01935e2a 编写于 作者: D D. Wythe 提交者: Zheng Zengkai

net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error generated by client

stable inclusion
from stable-v5.10.104
commit d7eb662625eb56615f3caec6bac7a6f400080c7a
bugzilla: https://gitee.com/openeuler/kernel/issues/I56XAC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d7eb662625eb56615f3caec6bac7a6f400080c7a

--------------------------------

commit 0537f0a2 upstream.

The main reason for this unexpected SMC_CLC_DECL_ERR_REGRMB in client
dues to following execution sequence:

Server Conn A:           Server Conn B:			Client Conn B:

smc_lgr_unregister_conn
                        smc_lgr_register_conn
                        smc_clc_send_accept     ->
                                                        smc_rtoken_add
smcr_buf_unuse
		->		Client Conn A:
				smc_rtoken_delete

smc_lgr_unregister_conn() makes current link available to assigned to new
incoming connection, while smcr_buf_unuse() has not executed yet, which
means that smc_rtoken_add may fail because of insufficient rtoken_entry,
reversing their execution order will avoid this problem.

Fixes: 3e034725 ("net/smc: common functions for RMBs and send buffers")
Signed-off-by: ND. Wythe <alibuda@linux.alibaba.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7de01f97
...@@ -662,8 +662,8 @@ void smc_conn_free(struct smc_connection *conn) ...@@ -662,8 +662,8 @@ void smc_conn_free(struct smc_connection *conn)
cancel_work_sync(&conn->abort_work); cancel_work_sync(&conn->abort_work);
} }
if (!list_empty(&lgr->list)) { if (!list_empty(&lgr->list)) {
smc_lgr_unregister_conn(conn);
smc_buf_unuse(conn, lgr); /* allow buffer reuse */ smc_buf_unuse(conn, lgr); /* allow buffer reuse */
smc_lgr_unregister_conn(conn);
} }
if (!lgr->conns_num) if (!lgr->conns_num)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册