Skip to contentSkip to conversation

subflow: place outgoing connections on the join list

PATCH In review Florian Westphal 3 participants 3 messages Feb 4, 2020 – Feb 25, 2020

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author
#0 lore raw

PATCH 1/1 subflow: place outgoing connections on the join list

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 <fw(a)strlen.de>
---
 net/mptcp/subflow.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/mptcp/subflow.c +4 -1
index 547d5ffef070..154fb2b42243 100644
@@ -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);
+
 	release_sock(sk);
 	return err;
 
 failed:
-	list_del_init(&subflow->node);
 	release_sock(sk);
 	sock_release(sf);
 	return err;
Signature · 1 line
2.24.1
#1 lore raw
Quoted 40 lines · Florian Westphal

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 <fw(a)strlen.de>
---
 net/mptcp/subflow.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/mptcp/subflow.c +2 -0
index 547d5ffef070..154fb2b42243 100644
@@ -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);

net/mptcp/subflow.c int mptcp_subflow_connect(struct sock *sk, struct sockaddr *local, · line 834

Quoted 10 lines
net/mptcp/subflow.c +2 -1
+	spin_unlock_bh(&msk->join_list_lock);
+
 	release_sock(sk);
 	return err;
 
 failed:
-	list_del_init(&subflow->node);
 	release_sock(sk);
 	sock_release(sf);
 	return err;

whooops ... this one fell outside my radar for a long time.

mp_join self-tests (WIP) demonstrated the need for this one!

LGTM, thanks Florian!

/P

#2 lore raw

Hi Florian, Paolo,

Quoted 25 lines · Paolo Abeni
Quoted 24 lines · Florian Westphal

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.

[...]

Quoted 5 lines

whooops ... this one fell outside my radar for a long time.

mp_join self-tests (WIP) demonstrated the need for this one!

LGTM, thanks Florian!

Sorry for the delay, I missed that too at first and got other things scheduled after. Please insist if a patch has been reviewed but not applied! :)

- f20d350cb8d5: "squashed" in "subflow: place further subflows on new 'join_list'"
- 676a5c51ff36..8b57e57b1ba4: result

Tests + export are going to be launched soon.

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium