subflow: place outgoing connections on the join list
diff mbox series

Message ID
State Needs Review / ACK
Headers show
  • subflow: place outgoing connections on the join list
Related show

Commit Message

Florian Westphal Feb. 4, 2020, 3:35 p.m. UTC
squashto: subflow: place further subflows on new 'join_list'

in case the subflow can't be established (timeout, reset) the subflow
socket is leaked.

Add it to the join list for now.  This isn't nice because the socket
will be added while its known to not be established, and its not removed
at any time even if its not useable.

The list_del_init() call can be removed because the subflow context
->node is still unused / not on a list in all cases.

On a different note:

I think it makes sense to remove the 'splice join to conn list' approach
and instead have the worker check the join and conn lists:

1. subflows are added from join to conn list once they are established.
2. subflows on join list that are still in SYN_SENT are ignored
3. subflows on join and/or conn list that are closed already are removed
and free'd.

Alternatively, we could probably extend the sk_state_change callback
to do this and keep checking outside of send/receive code paths.

Signed-off-by: Florian Westphal <>
 net/mptcp/subflow.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 547d5ffef070..154fb2b42243 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -821,11 +821,14 @@  int mptcp_subflow_connect(struct sock *sk, struct sockaddr *local,
 	if (err && err != -EINPROGRESS)
 		goto failed;
+	spin_lock_bh(&msk->join_list_lock);
+	list_add_tail(&subflow->node, &msk->join_list);
+	spin_unlock_bh(&msk->join_list_lock);
 	return err;
-	list_del_init(&subflow->node);
 	return err;