diff mbox series

[net-next] Squash-to: "mptcp: refactor shutdown and close"

Message ID f20c5df58852b95e9df9bbf63b5b796e4b701a0f.1602772180.git.dcaratti@redhat.com
State Accepted, archived
Commit 323d37ef423ce716fbe74c48236bc185dab48975
Delegated to: Matthieu Baerts
Headers show
Series [net-next] Squash-to: "mptcp: refactor shutdown and close" | expand

Commit Message

Davide Caratti Oct. 15, 2020, 2:30 p.m. UTC
when the data-fin is acked on all subflows, the socket goes in
FIN_WAIT_2 state. Call __mptcp_destroy_sock() to transmit a TCP FIN.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/98
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
 net/mptcp/protocol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paolo Abeni Oct. 15, 2020, 2:51 p.m. UTC | #1
On Thu, 2020-10-15 at 16:30 +0200, Davide Caratti wrote:
> when the data-fin is acked on all subflows, the socket goes in
> FIN_WAIT_2 state. Call __mptcp_destroy_sock() to transmit a TCP FIN.

Note for the reviewers: the above happens only for orphaned msk, and
follows quite closely what plain TCP does.
> 
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/98
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> ---
>  net/mptcp/protocol.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 5b32741f2af3..95566f120e72 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1859,7 +1859,8 @@ static void mptcp_worker(struct work_struct *work)
>  	 */
>  	if (sock_flag(sk, SOCK_DEAD) &&
>  	    (mptcp_check_close_timeout(sk) ||
> -	    (state != sk->sk_state && sk->sk_state == TCP_CLOSE))) {
> +	    (state != sk->sk_state &&
> +	    ((1 << inet_sk_state_load(sk)) & (TCPF_CLOSE | TCPF_FIN_WAIT2))))) {
>  		inet_sk_state_store(sk, TCP_CLOSE);
>  		__mptcp_destroy_sock(sk, 0);
>  		goto unlock;

LGTM! Thanks Davide!

/P
Matthieu Baerts Oct. 17, 2020, 7:56 a.m. UTC | #2
Hi Davide, Paolo,

On 15/10/2020 16:51, Paolo Abeni wrote:
> On Thu, 2020-10-15 at 16:30 +0200, Davide Caratti wrote:
>> when the data-fin is acked on all subflows, the socket goes in
>> FIN_WAIT_2 state. Call __mptcp_destroy_sock() to transmit a TCP FIN.
> 
> Note for the reviewers: the above happens only for orphaned msk, and
> follows quite closely what plain TCP does.

Thank you for having destroyed orphans!

>>
>> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/98
>> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
>> ---
>>   net/mptcp/protocol.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
>> index 5b32741f2af3..95566f120e72 100644
>> --- a/net/mptcp/protocol.c
>> +++ b/net/mptcp/protocol.c
>> @@ -1859,7 +1859,8 @@ static void mptcp_worker(struct work_struct *work)
>>   	 */
>>   	if (sock_flag(sk, SOCK_DEAD) &&
>>   	    (mptcp_check_close_timeout(sk) ||
>> -	    (state != sk->sk_state && sk->sk_state == TCP_CLOSE))) {
>> +	    (state != sk->sk_state &&
>> +	    ((1 << inet_sk_state_load(sk)) & (TCPF_CLOSE | TCPF_FIN_WAIT2))))) {
>>   		inet_sk_state_store(sk, TCP_CLOSE);
>>   		__mptcp_destroy_sock(sk, 0);
>>   		goto unlock;
> 
> LGTM! Thanks Davide!

Thank you for the patch and the review!

- 323d37ef423c: "squashed" in "mptcp: refactor shutdown and close"
- Results: e41dc6548e3b..b160e00bdf28

Tests + export are going to be started soon!

Cheers,
Matt
diff mbox series

Patch

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 5b32741f2af3..95566f120e72 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1859,7 +1859,8 @@  static void mptcp_worker(struct work_struct *work)
 	 */
 	if (sock_flag(sk, SOCK_DEAD) &&
 	    (mptcp_check_close_timeout(sk) ||
-	    (state != sk->sk_state && sk->sk_state == TCP_CLOSE))) {
+	    (state != sk->sk_state &&
+	    ((1 << inet_sk_state_load(sk)) & (TCPF_CLOSE | TCPF_FIN_WAIT2))))) {
 		inet_sk_state_store(sk, TCP_CLOSE);
 		__mptcp_destroy_sock(sk, 0);
 		goto unlock;