anolis: net/smc: fix the issue of server fallback failure
ANBZ: #21781
A failure was found when smc server tries to send clc decline messages.
It results in connections being unexpectedly reset, rather than a fallback.
It was introduced by the commit described by 'Fixes' tag, which removes
the check for smc_listen_work, leading to smc_net_clcsock_sendmsg
consistently returning -EOPNOTSUPP.
To fix it, we restores the specific logic that ensures the clc decline
message is properly handled and sent when the server transitions to a
fallback state. Besides, there is no need to check the connect_work for
the client here, as the client first sends a decline message and then
sets use_fallback to true, which is the opposite of the service side.
Fixes: 718c9ff498
("net/smc: fix LGR and link use-after-free issue")
Co-developed-by: D.Wythe <alibuda@linux.alibaba.com>
Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
Reviewed-by: D. Wythe <alibuda@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/5442
This commit is contained in:
parent
8cbb260f55
commit
b2475c2334
|
@ -290,6 +290,9 @@ static int smc_inet_clcsock_sendmsg(struct socket *sock, struct msghdr *msg, siz
|
||||||
|
|
||||||
smc = smc_sk(sock->sk);
|
smc = smc_sk(sock->sk);
|
||||||
|
|
||||||
|
if (current_work() == &smc->smc_listen_work)
|
||||||
|
goto send;
|
||||||
|
|
||||||
/* smc_inet_clcsock_sendmsg only works for smc handshaking
|
/* smc_inet_clcsock_sendmsg only works for smc handshaking
|
||||||
* fallback sendmsg should process by smc_inet_sendmsg.
|
* fallback sendmsg should process by smc_inet_sendmsg.
|
||||||
* see more details in smc_inet_sendmsg().
|
* see more details in smc_inet_sendmsg().
|
||||||
|
@ -301,6 +304,7 @@ static int smc_inet_clcsock_sendmsg(struct socket *sock, struct msghdr *msg, siz
|
||||||
* Therefore, we rely on the implementation of conenct_work() implementation, which
|
* Therefore, we rely on the implementation of conenct_work() implementation, which
|
||||||
* is locked always.
|
* is locked always.
|
||||||
*/
|
*/
|
||||||
|
send:
|
||||||
return tcp_sendmsg_locked(sk, msg, len);
|
return tcp_sendmsg_locked(sk, msg, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue