Commit 8d547809 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller
Browse files

mptcp: fastclose msk when cleaning unaccepted sockets



When cleaning up unaccepted mptcp socket still laying inside
the listener queue at listener close time, such sockets will
go through a regular close, waiting for a timeout before
shutting down the subflows.

There is no need to keep the kernel resources in use for
such a possibly long time: short-circuit to fast-close.

Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Reviewed-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ddb1a072
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2953,10 +2953,13 @@ bool __mptcp_close(struct sock *sk, long timeout)
		goto cleanup;
	}

	if (mptcp_check_readable(msk)) {
		/* the msk has read data, do the MPTCP equivalent of TCP reset */
	if (mptcp_check_readable(msk) || timeout < 0) {
		/* If the msk has read data, or the caller explicitly ask it,
		 * do the MPTCP equivalent of TCP reset, aka MPTCP fastclose
		 */
		inet_sk_state_store(sk, TCP_CLOSE);
		mptcp_do_fastclose(sk);
		timeout = 0;
	} else if (mptcp_close_state(sk)) {
		__mptcp_wr_shutdown(sk);
	}