Message ID | 1636788815-29902-1-git-send-email-guwen@linux.alibaba.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 2153bd1e3d3dbf6a3403572084ef6ed31c53c5f0 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,v2] net/smc: Transfer remaining wait queue entries during fallback | expand |
Hello: This patch was applied to netdev/net.git (master) by David S. Miller <davem@davemloft.net>: On Sat, 13 Nov 2021 15:33:35 +0800 you wrote: > The SMC fallback is incomplete currently. There may be some > wait queue entries remaining in smc socket->wq, which should > be removed to clcsocket->wq during the fallback. > > For example, in nginx/wrk benchmark, this issue causes an > all-zeros test result: > > [...] Here is the summary with links: - [net,v2] net/smc: Transfer remaining wait queue entries during fallback https://git.kernel.org/netdev/net/c/2153bd1e3d3d You are awesome, thank you!
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 0cf7ed2..f32f822 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -562,6 +562,10 @@ static void smc_stat_fallback(struct smc_sock *smc) static void smc_switch_to_fallback(struct smc_sock *smc, int reason_code) { + wait_queue_head_t *smc_wait = sk_sleep(&smc->sk); + wait_queue_head_t *clc_wait = sk_sleep(smc->clcsock->sk); + unsigned long flags; + smc->use_fallback = true; smc->fallback_rsn = reason_code; smc_stat_fallback(smc); @@ -571,6 +575,16 @@ static void smc_switch_to_fallback(struct smc_sock *smc, int reason_code) smc->clcsock->file->private_data = smc->clcsock; smc->clcsock->wq.fasync_list = smc->sk.sk_socket->wq.fasync_list; + + /* There may be some entries remaining in + * smc socket->wq, which should be removed + * to clcsocket->wq during the fallback. + */ + spin_lock_irqsave(&smc_wait->lock, flags); + spin_lock(&clc_wait->lock); + list_splice_init(&smc_wait->head, &clc_wait->head); + spin_unlock(&clc_wait->lock); + spin_unlock_irqrestore(&smc_wait->lock, flags); } }