Message ID | 20211110070234.60527-1-dust.li@linux.alibaba.com (mailing list archive) |
---|---|
State | Accepted |
Commit | e5d5aadcf3cd59949316df49c27cb21788d7efe4 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] net/smc: fix sk_refcnt underflow on linkdown and fallback | expand |
On 10/11/2021 08:02, Dust Li wrote: > We got the following WARNING when running ab/nginx > test with RDMA link flapping (up-down-up). > The reason is when smc_sock fallback and at linkdown > happens simultaneously, we may got the following situation: > <snip> Acked-by: Karsten Graul <kgraul@linux.ibm.com>
Hello: This patch was applied to netdev/net.git (master) by David S. Miller <davem@davemloft.net>: On Wed, 10 Nov 2021 15:02:34 +0800 you wrote: > We got the following WARNING when running ab/nginx > test with RDMA link flapping (up-down-up). > The reason is when smc_sock fallback and at linkdown > happens simultaneously, we may got the following situation: > > __smc_lgr_terminate() > --> smc_conn_kill() > --> smc_close_active_abort() > smc_sock->sk_state = SMC_CLOSED > sock_put(smc_sock) > > [...] Here is the summary with links: - [net] net/smc: fix sk_refcnt underflow on linkdown and fallback https://git.kernel.org/netdev/net/c/e5d5aadcf3cd You are awesome, thank you!
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 0cf7ed2f5d41..59284da9116d 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -149,14 +149,18 @@ static int __smc_release(struct smc_sock *smc) sock_set_flag(sk, SOCK_DEAD); sk->sk_shutdown |= SHUTDOWN_MASK; } else { - if (sk->sk_state != SMC_LISTEN && sk->sk_state != SMC_INIT) - sock_put(sk); /* passive closing */ - if (sk->sk_state == SMC_LISTEN) { - /* wake up clcsock accept */ - rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR); + if (sk->sk_state != SMC_CLOSED) { + if (sk->sk_state != SMC_LISTEN && + sk->sk_state != SMC_INIT) + sock_put(sk); /* passive closing */ + if (sk->sk_state == SMC_LISTEN) { + /* wake up clcsock accept */ + rc = kernel_sock_shutdown(smc->clcsock, + SHUT_RDWR); + } + sk->sk_state = SMC_CLOSED; + sk->sk_state_change(sk); } - sk->sk_state = SMC_CLOSED; - sk->sk_state_change(sk); smc_restore_fallback_changes(smc); }