Skip to content

Commit bbd49d1

Browse files
Paolo Abenikuba-moo
authored andcommitted
mptcp: consolidate transition to TCP_CLOSE in mptcp_do_fastclose()
The MPTCP code always set the msk state to TCP_CLOSE before calling performing the fast-close. Move such state transition in mptcp_do_fastclose() to avoid some code duplication. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 00079f1 commit bbd49d1

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

net/mptcp/protocol.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,6 +2655,7 @@ static void mptcp_do_fastclose(struct sock *sk)
26552655
struct mptcp_subflow_context *subflow, *tmp;
26562656
struct mptcp_sock *msk = mptcp_sk(sk);
26572657

2658+
inet_sk_state_store(sk, TCP_CLOSE);
26582659
mptcp_for_each_subflow_safe(msk, subflow, tmp)
26592660
__mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow),
26602661
subflow, MPTCP_CF_FASTCLOSE);
@@ -2692,10 +2693,9 @@ static void mptcp_worker(struct work_struct *work)
26922693
* even if it is orphaned and in FIN_WAIT2 state
26932694
*/
26942695
if (sock_flag(sk, SOCK_DEAD)) {
2695-
if (mptcp_should_close(sk)) {
2696-
inet_sk_state_store(sk, TCP_CLOSE);
2696+
if (mptcp_should_close(sk))
26972697
mptcp_do_fastclose(sk);
2698-
}
2698+
26992699
if (sk->sk_state == TCP_CLOSE) {
27002700
__mptcp_destroy_sock(sk);
27012701
goto unlock;
@@ -2938,7 +2938,6 @@ static void __mptcp_destroy_sock(struct sock *sk)
29382938
void __mptcp_unaccepted_force_close(struct sock *sk)
29392939
{
29402940
sock_set_flag(sk, SOCK_DEAD);
2941-
inet_sk_state_store(sk, TCP_CLOSE);
29422941
mptcp_do_fastclose(sk);
29432942
__mptcp_destroy_sock(sk);
29442943
}
@@ -2980,7 +2979,6 @@ bool __mptcp_close(struct sock *sk, long timeout)
29802979
/* If the msk has read data, or the caller explicitly ask it,
29812980
* do the MPTCP equivalent of TCP reset, aka MPTCP fastclose
29822981
*/
2983-
inet_sk_state_store(sk, TCP_CLOSE);
29842982
mptcp_do_fastclose(sk);
29852983
timeout = 0;
29862984
} else if (mptcp_close_state(sk)) {

0 commit comments

Comments
 (0)