Skip to content

Commit fff0c87

Browse files
Paolo Abenikuba-moo
authored andcommitted
mptcp: decouple mptcp fastclose from tcp close
With the current fastclose implementation, the mptcp_do_fastclose() helper is in charge of two distinct actions: send the fastclose reset and cleanup the subflows. Formally decouple the two steps, ensuring that mptcp explicitly closes all the subflows after the mentioned helper. This will make the upcoming fix simpler, and allows dropping the 2nd argument from mptcp_destroy_common(). The Fixes tag is then the same as in the next commit to help with the backports. Fixes: d21f834 ("mptcp: use fastclose on more edge scenarios") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Geliang Tang <geliang@kernel.org> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20251118-net-mptcp-misc-fixes-6-18-rc6-v1-5-806d3781c95f@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1bba3f2 commit fff0c87

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

net/mptcp/protocol.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2808,7 +2808,11 @@ static void mptcp_worker(struct work_struct *work)
28082808
__mptcp_close_subflow(sk);
28092809

28102810
if (mptcp_close_tout_expired(sk)) {
2811+
struct mptcp_subflow_context *subflow, *tmp;
2812+
28112813
mptcp_do_fastclose(sk);
2814+
mptcp_for_each_subflow_safe(msk, subflow, tmp)
2815+
__mptcp_close_ssk(sk, subflow->tcp_sock, subflow, 0);
28122816
mptcp_close_wake_up(sk);
28132817
}
28142818

@@ -3233,7 +3237,8 @@ static int mptcp_disconnect(struct sock *sk, int flags)
32333237
/* msk->subflow is still intact, the following will not free the first
32343238
* subflow
32353239
*/
3236-
mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE);
3240+
mptcp_do_fastclose(sk);
3241+
mptcp_destroy_common(msk);
32373242

32383243
/* The first subflow is already in TCP_CLOSE status, the following
32393244
* can't overlap with a fallback anymore
@@ -3412,7 +3417,7 @@ void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
34123417
msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT;
34133418
}
34143419

3415-
void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags)
3420+
void mptcp_destroy_common(struct mptcp_sock *msk)
34163421
{
34173422
struct mptcp_subflow_context *subflow, *tmp;
34183423
struct sock *sk = (struct sock *)msk;
@@ -3421,7 +3426,7 @@ void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags)
34213426

34223427
/* join list will be eventually flushed (with rst) at sock lock release time */
34233428
mptcp_for_each_subflow_safe(msk, subflow, tmp)
3424-
__mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, flags);
3429+
__mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, 0);
34253430

34263431
__skb_queue_purge(&sk->sk_receive_queue);
34273432
skb_rbtree_purge(&msk->out_of_order_queue);
@@ -3439,7 +3444,7 @@ static void mptcp_destroy(struct sock *sk)
34393444

34403445
/* allow the following to close even the initial subflow */
34413446
msk->free_first = 1;
3442-
mptcp_destroy_common(msk, 0);
3447+
mptcp_destroy_common(msk);
34433448
sk_sockets_allocated_dec(sk);
34443449
}
34453450

net/mptcp/protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk)
977977
local_bh_enable();
978978
}
979979

980-
void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags);
980+
void mptcp_destroy_common(struct mptcp_sock *msk);
981981

982982
#define MPTCP_TOKEN_MAX_RETRIES 4
983983

0 commit comments

Comments
 (0)