[PATCH mptcp-next 2/2] Squash-to: "mptcp: avoid additional __inet_stream_connect() call"

Paolo Abeni posted 2 patches 2 years, 6 months ago
Maintainers: Matthieu Baerts <matthieu.baerts@tessares.net>, Mat Martineau <martineau@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
[PATCH mptcp-next 2/2] Squash-to: "mptcp: avoid additional __inet_stream_connect() call"
Posted by Paolo Abeni 2 years, 6 months ago
In the mentioned commit I unintenionally left over a couple of
possible cleanup.

Add the following to the commit message, befere "No functional change
intended.":

"""
The sk-level connect never return -EINPROGRESS, cleanup the error
path accordingly. Additionally, the ssk status on error is always
TCP_CLOSE. Avoid unneeded access to the subflow sk state.
"""

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/protocol.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 9e48dfbd102f..067e90168a49 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3655,18 +3655,14 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	/* on successful connect, the msk state will be moved to established by
 	 * subflow_finish_connect()
 	 */
-	if (unlikely(err && err != -EINPROGRESS)) {
+	if (unlikely(err)) {
 		/* avoid leaving a dangling token in an unconnected socket */
 		mptcp_token_destroy(msk);
-		inet_sk_state_store(sk, inet_sk_state_load(ssk));
+		inet_sk_state_store(sk, TCP_CLOSE);
 		return err;
 	}
 
 	mptcp_copy_inaddrs(sk, ssk);
-
-	/* silence EINPROGRESS and let the caller inet_stream_connect
-	 * handle the connection in progress
-	 */
 	return 0;
 }
 
-- 
2.41.0