Skip to content

Commit 906b3d6

Browse files
Wen Gukuba-moo
authored andcommitted
net/smc: Send out the remaining data in sndbuf before close
The current autocork algorithms will delay the data transmission in BH context to smc_release_cb() when sock_lock is hold by user. So there is a possibility that when connection is being actively closed (sock_lock is hold by user now), some corked data still remains in sndbuf, waiting to be sent by smc_release_cb(). This will cause: - smc_close_stream_wait(), which is called under the sock_lock, has a high probability of timeout because data transmission is delayed until sock_lock is released. - Unexpected data sends may happen after connction closed and use the rtoken which has been deleted by remote peer through LLC_DELETE_RKEY messages. So this patch will try to send out the remaining corked data in sndbuf before active close process, to ensure data integrity and avoid unexpected data transmission after close. Reported-by: Guangguan Wang <guangguan.wang@linux.alibaba.com> Fixes: 6b88af8 ("net/smc: don't send in the BH context if sock_owned_by_user") Signed-off-by: Wen Gu <guwen@linux.alibaba.com> Acked-by: Karsten Graul <kgraul@linux.ibm.com> Link: https://lore.kernel.org/r/1648447836-111521-1-git-send-email-guwen@linux.alibaba.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent f32404a commit 906b3d6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/smc/smc_close.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ static void smc_close_stream_wait(struct smc_sock *smc, long timeout)
5757
if (!smc_tx_prepared_sends(&smc->conn))
5858
return;
5959

60+
/* Send out corked data remaining in sndbuf */
61+
smc_tx_pending(&smc->conn);
62+
6063
smc->wait_close_tx_prepared = 1;
6164
add_wait_queue(sk_sleep(sk), &wait);
6265
while (!signal_pending(current) && timeout) {

0 commit comments

Comments
 (0)