Skip to contentSkip to conversation

Squash-to: "mptcp: remove addr and subflow in PM netlink v9"

PATCH In review Geliang Tang 3 participants 9 messages Sep 15, 2020 – Sep 17, 2020

Subsystems (2)
lore
Share & tools
lore

Geliang Tang

author
#0 lore raw

v3 cover Squash-to: "mptcp: remove addr and subflow in PM netlink v9"

v3:
- use "goto next" in mptcp_nl_remove_subflow_and_signal_addr
- update mptcp_destroy_common

v2:
- add mptcp_pm_remove_anno_addr and update logic in mptcp_nl_remove_subflow_and_signal_addr
- call mptcp_pm_free_anno_list in mptcp_destroy and mptcp_sock_destruct
- add mptcp_destroy_common helper

Geliang Tang (2):
Squash-to: "mptcp: remove addr and subflow in PM netlink"
mptcp: add mptcp_destroy_common helper

 net/mptcp/pm.c         |  1 +
 net/mptcp/pm_netlink.c | 91 +++++++++++++++++++++++++++++++++++++++---
 net/mptcp/protocol.c   | 10 ++++-
 net/mptcp/protocol.h   |  3 ++
 net/mptcp/subflow.c    |  3 +-
 5 files changed, 98 insertions(+), 10 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v3 1/2 Squash-to: "mptcp: remove addr and subflow in PM netlink"

Commit message should be rewritten entirely:
'''
This patch implements the remove announced addr and subflow logic in PM netlink.

When the PM netlink removes an address, we traverse all the existing msk sockets to find the relevant sockets.

We add a new list named anno_list in mptcp_pm_data, to record all the announced addrs. In the traversing, we check if it has been recorded. If it has been, we trigger the RM_ADDR signal.

We also check if this address is in conn_list. If it is, we remove the subflow which using this local address.
'''

Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm.c         |  1 +
 net/mptcp/pm_netlink.c | 91 +++++++++++++++++++++++++++++++++++++++---
 net/mptcp/protocol.c   |  1 +
 net/mptcp/protocol.h   |  2 +
 net/mptcp/subflow.c    |  1 +
 5 files changed, 90 insertions(+), 6 deletions(-)
net/mptcp/pm.c +1 -0
index 9328f0b175a7..6ca88422e774 100644
@@ -240,6 +240,7 @@ void mptcp_pm_data_init(struct mptcp_sock *msk)
 	msk->pm.status = 0;
 
 	spin_lock_init(&msk->pm.lock);
+	INIT_LIST_HEAD(&msk->pm.anno_list);
 
 	mptcp_pm_nl_data_init(msk);
 }
net/mptcp/pm_netlink.c +85 -6

120 lines not on this page · raw message

net/mptcp/protocol.c +1 -0
index 9786db6713ac..f324e36f8e19 100644
@@ -2162,6 +2162,7 @@ static void mptcp_destroy(struct sock *sk)
 	if (msk->cached_ext)
 		__skb_ext_put(msk->cached_ext);
 
+	mptcp_pm_free_anno_list(msk);
 	sk_sockets_allocated_dec(sk);
 }
 
net/mptcp/protocol.h +2 -0
index bad751e2c8f3..df6cc94df1f7 100644
@@ -160,6 +160,7 @@ enum mptcp_pm_status {
 struct mptcp_pm_data {
 	struct mptcp_addr_info local;
 	struct mptcp_addr_info remote;
+	struct list_head anno_list;
 
 	spinlock_t	lock;		/*protects the whole PM data */
 
@@ -441,6 +442,7 @@ void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id);
 void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 				const struct mptcp_addr_info *addr);
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id);
+void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
 
 int mptcp_pm_announce_addr(struct mptcp_sock *msk,
 			   const struct mptcp_addr_info *addr,
net/mptcp/subflow.c +1 -0
index cd6cd8bac9a2..f07dddaf05ca 100644
@@ -437,6 +437,7 @@ static void mptcp_sock_destruct(struct sock *sk)
 
 	skb_rbtree_purge(&mptcp_sk(sk)->out_of_order_queue);
 	mptcp_token_destroy(mptcp_sk(sk));
+	mptcp_pm_free_anno_list(mptcp_sk(sk));
 	inet_sock_destruct(sk);
 }
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v3 2/2 mptcp: add mptcp_destroy_common helper

In reply to Geliang Tang

This patch added a new helper named mptcp_destroy_common containing the shared code between mptcp_destroy() and mptcp_sock_destruct().

Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/protocol.c | 11 ++++++++---
 net/mptcp/protocol.h |  1 +
 net/mptcp/subflow.c  |  4 +---
 3 files changed, 10 insertions(+), 6 deletions(-)
net/mptcp/protocol.c +8 -3
index f324e36f8e19..5fe9bfc3c76f 100644
@@ -2153,16 +2153,21 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,
 	return newsk;
 }
 
+void mptcp_destroy_common(struct mptcp_sock *msk)
+{
+	skb_rbtree_purge(&msk->out_of_order_queue);
+	mptcp_token_destroy(msk);
+	mptcp_pm_free_anno_list(msk);
+}
+
 static void mptcp_destroy(struct sock *sk)
 {
 	struct mptcp_sock *msk = mptcp_sk(sk);
 
-	skb_rbtree_purge(&msk->out_of_order_queue);
-	mptcp_token_destroy(msk);
 	if (msk->cached_ext)
 		__skb_ext_put(msk->cached_ext);
 
-	mptcp_pm_free_anno_list(msk);
+	mptcp_destroy_common(msk);
 	sk_sockets_allocated_dec(sk);
 }
 
net/mptcp/protocol.h +1 -0
index df6cc94df1f7..db1e5de2fee7 100644
@@ -408,6 +408,7 @@ bool mptcp_finish_join(struct sock *sk);
 void mptcp_data_acked(struct sock *sk);
 void mptcp_subflow_eof(struct sock *sk);
 bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq);
+void mptcp_destroy_common(struct mptcp_sock *msk);
 
 void __init mptcp_token_init(void);
 static inline void mptcp_token_init_request(struct request_sock *req)
net/mptcp/subflow.c +1 -3
index f07dddaf05ca..d2544e1a0ed0 100644
@@ -435,9 +435,7 @@ static void mptcp_sock_destruct(struct sock *sk)
 		sock_orphan(sk);
 	}
 
-	skb_rbtree_purge(&mptcp_sk(sk)->out_of_order_queue);
-	mptcp_token_destroy(mptcp_sk(sk));
-	mptcp_pm_free_anno_list(mptcp_sk(sk));
+	mptcp_destroy_common(mptcp_sk(sk));
 	inet_sock_destruct(sk);
 }
 
Signature · 1 line
2.17.1
#3 lore raw
In reply to Geliang Tang
Quoted 14 lines · Geliang Tang

v3:
- use "goto next" in mptcp_nl_remove_subflow_and_signal_addr
- update mptcp_destroy_common

v2:
- add mptcp_pm_remove_anno_addr and update logic in mptcp_nl_remove_subflow_and_signal_addr
- call mptcp_pm_free_anno_list in mptcp_destroy and mptcp_sock_destruct
- add mptcp_destroy_common helper

Geliang Tang (2):
Squash-to: "mptcp: remove addr and subflow in PM netlink"
mptcp: add mptcp_destroy_common helper

Quoted 7 lines
 net/mptcp/pm.c         |  1 +
 net/mptcp/pm_netlink.c | 91 +++++++++++++++++++++++++++++++++++++++---
 net/mptcp/protocol.c   | 10 ++++-
 net/mptcp/protocol.h   |  3 ++
 net/mptcp/subflow.c    |  3 +-
 5 files changed, 98 insertions(+), 10 deletions(-)

Both patches LGTM, thanks!

Paolo

#4 lore raw

Hi Geliang, Paolo,

Quoted 23 lines · Paolo Abeni
Quoted 14 lines · Geliang Tang

v3:
- use "goto next" in mptcp_nl_remove_subflow_and_signal_addr
- update mptcp_destroy_common

v2:
- add mptcp_pm_remove_anno_addr and update logic in mptcp_nl_remove_subflow_and_signal_addr
- call mptcp_pm_free_anno_list in mptcp_destroy and mptcp_sock_destruct
- add mptcp_destroy_common helper

Geliang Tang (2):
Squash-to: "mptcp: remove addr and subflow in PM netlink"
mptcp: add mptcp_destroy_common helper

Quoted 7 lines
  net/mptcp/pm.c         |  1 +
  net/mptcp/pm_netlink.c | 91 +++++++++++++++++++++++++++++++++++++++---
  net/mptcp/protocol.c   | 10 ++++-
  net/mptcp/protocol.h   |  3 ++
  net/mptcp/subflow.c    |  3 +-
  5 files changed, 98 insertions(+), 10 deletions(-)
Quoted 1 line

Both patches LGTM, thanks!

Thank you for the patches and the review!

Just to be sure, can I squash the two of them in the same "mptcp: remove addr and subflow in PM netlink" commit? (+ update the commit message as written in 1/2 patch)

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
author
#5 lore raw

Hi Matt, Paolo,

Quoted 27 lines · Matthieu Baerts <matthieu.baerts(a)tessares.net> 于2020年9月16日周三 上午4:26写道:

Hi Geliang, Paolo,

Quoted 23 lines · Paolo Abeni
Quoted 21 lines · Geliang Tang

v3:
- use "goto next" in mptcp_nl_remove_subflow_and_signal_addr
- update mptcp_destroy_common

v2:
- add mptcp_pm_remove_anno_addr and update logic in mptcp_nl_remove_subflow_and_signal_addr
- call mptcp_pm_free_anno_list in mptcp_destroy and mptcp_sock_destruct
- add mptcp_destroy_common helper

Geliang Tang (2):
Squash-to: "mptcp: remove addr and subflow in PM netlink"
mptcp: add mptcp_destroy_common helper

  net/mptcp/pm.c         |  1 +
  net/mptcp/pm_netlink.c | 91 +++++++++++++++++++++++++++++++++++++++---
  net/mptcp/protocol.c   | 10 ++++-
  net/mptcp/protocol.h   |  3 ++
  net/mptcp/subflow.c    |  3 +-
  5 files changed, 98 insertions(+), 10 deletions(-)
Quoted 7 lines
Quoted 1 line

Both patches LGTM, thanks!

Thank you for the patches and the review!

Just to be sure, can I squash the two of them in the same "mptcp: remove addr and subflow in PM netlink" commit? (+ update the commit message as written in 1/2 patch)

Please only squash 1/2 patch to "mptcp: remove addr and subflow in PM netlink" commit. And apply patch 2/2 (mptcp: add mptcp_destroy_common helper) as a new commit.

Thanks.
-Geliang

Quoted 6 lines

Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

#6 lore raw

Hi Geliang,

Quoted 34 lines · Geliang Tang

Hi Matt, Paolo,

Quoted 31 lines · Matthieu Baerts <matthieu.baerts(a)tessares.net> 于2020年9月16日周三 上午4:26写道:

Hi Geliang, Paolo,

Quoted 23 lines · Paolo Abeni
Quoted 14 lines · Geliang Tang

v3:
- use "goto next" in mptcp_nl_remove_subflow_and_signal_addr
- update mptcp_destroy_common

v2:
- add mptcp_pm_remove_anno_addr and update logic in mptcp_nl_remove_subflow_and_signal_addr
- call mptcp_pm_free_anno_list in mptcp_destroy and mptcp_sock_destruct
- add mptcp_destroy_common helper

Geliang Tang (2):
Squash-to: "mptcp: remove addr and subflow in PM netlink"
mptcp: add mptcp_destroy_common helper

Quoted 7 lines
   net/mptcp/pm.c         |  1 +
   net/mptcp/pm_netlink.c | 91 +++++++++++++++++++++++++++++++++++++++---
   net/mptcp/protocol.c   | 10 ++++-
   net/mptcp/protocol.h   |  3 ++
   net/mptcp/subflow.c    |  3 +-
   5 files changed, 98 insertions(+), 10 deletions(-)
Quoted 1 line

Both patches LGTM, thanks!

Thank you for the patches and the review!

Quoted 7 lines
Quoted 3 lines

Just to be sure, can I squash the two of them in the same "mptcp: remove addr and subflow in PM netlink" commit? (+ update the commit message as written in 1/2 patch)

Please only squash 1/2 patch to "mptcp: remove addr and subflow in PM netlink" commit. And apply patch 2/2 (mptcp: add mptcp_destroy_common helper) as a new commit.

Thank you for the clarification.

- 96141df51494: "squashed" patch 1/2 in "mptcp: remove addr and subflow in PM netlink"
- 4c292fe817d5..79a312a49fee: result

The second patch has been added before your two commits modifying the selftests.
- 6d043d6c3dc2: mptcp: add mptcp_destroy_common helper
- c3f59bbd90df..653f02bb3161: result

Tests + export are in progress.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#7 lore raw

Hi Geliang,

Quoted 55 lines · Matthieu Baerts

Hi Geliang,

Quoted 37 lines · Geliang Tang

Hi Matt, Paolo,

Matthieu Baerts <matthieu.baerts(a)tessares.net> 于2020年9月16日周三 上

Quoted 33 lines · 午4:26写道:

Hi Geliang, Paolo,

Quoted 25 lines · Paolo Abeni
Quoted 15 lines · Geliang Tang

v3:
   - use "goto next" in mptcp_nl_remove_subflow_and_signal_addr
   - update mptcp_destroy_common

v2:
   - add mptcp_pm_remove_anno_addr and update logic in mptcp_nl_remove_subflow_and_signal_addr
   - call mptcp_pm_free_anno_list in mptcp_destroy and mptcp_sock_destruct
   - add mptcp_destroy_common helper

Geliang Tang (2):
    Squash-to: "mptcp: remove addr and subflow in PM netlink"
    mptcp: add mptcp_destroy_common helper

Quoted 8 lines

   net/mptcp/pm.c         |  1 +
   net/mptcp/pm_netlink.c | 91
+++++++++++++++++++++++++++++++++++++++---
   net/mptcp/protocol.c   | 10 ++++-
   net/mptcp/protocol.h   |  3 ++
   net/mptcp/subflow.c    |  3 +-

   5 files changed, 98 insertions(+), 10 deletions(-)
Quoted 1 line

Both patches LGTM, thanks!

Thank you for the patches and the review!

Quoted 8 lines
Quoted 3 lines

Just to be sure, can I squash the two of them in the same "mptcp: remove addr and subflow in PM netlink" commit? (+ update the commit message as written in 1/2 patch)

Please only squash 1/2 patch to "mptcp: remove addr and subflow in PM netlink"
commit. And apply patch 2/2 (mptcp: add mptcp_destroy_common helper) as a new commit.

Thank you for the clarification.

- 96141df51494: "squashed" patch 1/2 in "mptcp: remove addr and subflow in PM netlink"
- 4c292fe817d5..79a312a49fee: result

Quoted 6 lines

The second patch has been added before your two commits modifying the selftests.
- 6d043d6c3dc2: mptcp: add mptcp_destroy_common helper
- c3f59bbd90df..653f02bb3161: result

Tests + export are in progress.

It looks like these two patches are causing a crash:

https://github.com/multipath-tcp/mptcp_net-next/issues/90

Sadly I always see that when I have to leave, I didn't investigate more so far nor removing the two patches.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
author
#8 lore raw

Hi Matt,

Quoted 64 lines · Matthieu Baerts <matthieu.baerts(a)tessares.net> 于2020年9月17日周四 上午12:10写道:

Hi Geliang,

Quoted 60 lines · Matthieu Baerts

Hi Geliang,

Quoted 37 lines · Geliang Tang

Hi Matt, Paolo,

Matthieu Baerts <matthieu.baerts(a)tessares.net> 于2020年9月16日周三 上

Quoted 33 lines · 午4:26写道:

Hi Geliang, Paolo,

Quoted 25 lines · Paolo Abeni
Quoted 15 lines · Geliang Tang

v3:
- use "goto next" in mptcp_nl_remove_subflow_and_signal_addr
- update mptcp_destroy_common

v2:
- add mptcp_pm_remove_anno_addr and update logic in mptcp_nl_remove_subflow_and_signal_addr
- call mptcp_pm_free_anno_list in mptcp_destroy and
mptcp_sock_destruct
- add mptcp_destroy_common helper

Geliang Tang (2):
Squash-to: "mptcp: remove addr and subflow in PM netlink"
mptcp: add mptcp_destroy_common helper

Quoted 8 lines
   net/mptcp/pm.c         |  1 +
   net/mptcp/pm_netlink.c | 91
+++++++++++++++++++++++++++++++++++++++---
   net/mptcp/protocol.c   | 10 ++++-
   net/mptcp/protocol.h   |  3 ++
   net/mptcp/subflow.c    |  3 +-
   5 files changed, 98 insertions(+), 10 deletions(-)
Quoted 1 line

Both patches LGTM, thanks!

Thank you for the patches and the review!

Quoted 8 lines
Quoted 3 lines

Just to be sure, can I squash the two of them in the same "mptcp: remove addr and subflow in PM netlink" commit? (+ update the commit message as written in 1/2 patch)

Please only squash 1/2 patch to "mptcp: remove addr and subflow in PM netlink"
commit. And apply patch 2/2 (mptcp: add mptcp_destroy_common helper) as a new commit.

Thank you for the clarification.

- 96141df51494: "squashed" patch 1/2 in "mptcp: remove addr and subflow in PM netlink"
- 4c292fe817d5..79a312a49fee: result

The second patch has been added before your two commits modifying the selftests.
- 6d043d6c3dc2: mptcp: add mptcp_destroy_common helper
- c3f59bbd90df..653f02bb3161: result

Quoted 8 lines
Quoted 1 line

Tests + export are in progress.

It looks like these two patches are causing a crash:

https://github.com/multipath-tcp/mptcp_net-next/issues/90

Sadly I always see that when I have to leave, I didn't investigate more so far nor removing the two patches.

Sorry. I have just sent out a patch named (Squash-to: "mptcp: remove addr and subflow in PM netlink v9" Part 2) to fix this bug.

Thanks.

-Geliang

Quoted 6 lines

Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net