* [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition
@ 2023-08-23 8:28 Paolo Abeni
2023-08-23 8:28 ` [PATCH v2 mptcp-net 1/2] mptcp: move __mptcp_error_report in protocol.c Paolo Abeni
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Paolo Abeni @ 2023-08-23 8:28 UTC (permalink / raw)
To: mptcp
This is an attempt to address the 2nd issue reported in:
https://github.com/multipath-tcp/mptcp_net-next/issues/427
See the individual patch changelog for the details. The cover letter
is here mainly to trigger the CI.
v1 -> v2:
- fix compile warning reported by the CI
Paolo Abeni (2):
mptcp: move __mptcp_error_report in protocol.c
mptcp: process pending subflow error on close
net/mptcp/protocol.c | 41 +++++++++++++++++++++++++++++++++++++++++
net/mptcp/subflow.c | 36 ------------------------------------
2 files changed, 41 insertions(+), 36 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 mptcp-net 1/2] mptcp: move __mptcp_error_report in protocol.c
2023-08-23 8:28 [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition Paolo Abeni
@ 2023-08-23 8:28 ` Paolo Abeni
2023-08-23 8:28 ` [PATCH v2 mptcp-net 2/2] mptcp: process pending subflow error on close Paolo Abeni
2023-08-23 16:59 ` [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition Mat Martineau
2 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2023-08-23 8:28 UTC (permalink / raw)
To: mptcp
This will simplify the next patch. No functional change intended.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
net/mptcp/protocol.c | 36 ++++++++++++++++++++++++++++++++++++
net/mptcp/subflow.c | 36 ------------------------------------
2 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index ab3aaf6cacc5..12d3b575ceba 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -764,6 +764,42 @@ static bool __mptcp_ofo_queue(struct mptcp_sock *msk)
return moved;
}
+void __mptcp_error_report(struct sock *sk)
+{
+ struct mptcp_subflow_context *subflow;
+ struct mptcp_sock *msk = mptcp_sk(sk);
+
+ mptcp_for_each_subflow(msk, subflow) {
+ struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+ int err = sock_error(ssk);
+ int ssk_state;
+
+ if (!err)
+ continue;
+
+ /* only propagate errors on fallen-back sockets or
+ * on MPC connect
+ */
+ if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(msk))
+ continue;
+
+ /* We need to propagate only transition to CLOSE state.
+ * Orphaned socket will see such state change via
+ * subflow_sched_work_if_closed() and that path will properly
+ * destroy the msk as needed.
+ */
+ ssk_state = inet_sk_state_load(ssk);
+ if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD))
+ inet_sk_state_store(sk, ssk_state);
+ WRITE_ONCE(sk->sk_err, -err);
+
+ /* This barrier is coupled with smp_rmb() in mptcp_poll() */
+ smp_wmb();
+ sk_error_report(sk);
+ break;
+ }
+}
+
/* In most cases we will be able to lock the mptcp socket. If its already
* owned, we need to defer to the work queue to avoid ABBA deadlock.
*/
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 9bf3c7bc1762..2f40c23fdb0d 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -1362,42 +1362,6 @@ void mptcp_space(const struct sock *ssk, int *space, int *full_space)
*full_space = mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf));
}
-void __mptcp_error_report(struct sock *sk)
-{
- struct mptcp_subflow_context *subflow;
- struct mptcp_sock *msk = mptcp_sk(sk);
-
- mptcp_for_each_subflow(msk, subflow) {
- struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
- int err = sock_error(ssk);
- int ssk_state;
-
- if (!err)
- continue;
-
- /* only propagate errors on fallen-back sockets or
- * on MPC connect
- */
- if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(msk))
- continue;
-
- /* We need to propagate only transition to CLOSE state.
- * Orphaned socket will see such state change via
- * subflow_sched_work_if_closed() and that path will properly
- * destroy the msk as needed.
- */
- ssk_state = inet_sk_state_load(ssk);
- if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD))
- inet_sk_state_store(sk, ssk_state);
- WRITE_ONCE(sk->sk_err, -err);
-
- /* This barrier is coupled with smp_rmb() in mptcp_poll() */
- smp_wmb();
- sk_error_report(sk);
- break;
- }
-}
-
static void subflow_error_report(struct sock *ssk)
{
struct sock *sk = mptcp_subflow_ctx(ssk)->conn;
--
2.41.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 mptcp-net 2/2] mptcp: process pending subflow error on close
2023-08-23 8:28 [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition Paolo Abeni
2023-08-23 8:28 ` [PATCH v2 mptcp-net 1/2] mptcp: move __mptcp_error_report in protocol.c Paolo Abeni
@ 2023-08-23 8:28 ` Paolo Abeni
2023-08-23 10:06 ` mptcp: process pending subflow error on close: Tests Results MPTCP CI
2023-08-23 18:29 ` MPTCP CI
2023-08-23 16:59 ` [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition Mat Martineau
2 siblings, 2 replies; 6+ messages in thread
From: Paolo Abeni @ 2023-08-23 8:28 UTC (permalink / raw)
To: mptcp
On incoming TCP reset, subflow closing could happen before error
propagation. That in turn could cause the socket error being ignored,
and a missing socket state transition, as reported by Daire-Byrne.
Address the issues explicitly checking for subflow socket error at
close time. To avoid code duplication, factor-out of __mptcp_error_report()
a new helper implementing the relevant bits.
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/429
Fixes: 15cc10453398 ("mptcp: deliver ssk errors to msk")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
v1 -> v2:
- fix compile warning
---
net/mptcp/protocol.c | 63 ++++++++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 29 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 12d3b575ceba..357030f40cef 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -764,40 +764,44 @@ static bool __mptcp_ofo_queue(struct mptcp_sock *msk)
return moved;
}
-void __mptcp_error_report(struct sock *sk)
+static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk)
{
- struct mptcp_subflow_context *subflow;
- struct mptcp_sock *msk = mptcp_sk(sk);
+ int err = sock_error(ssk);
+ int ssk_state;
- mptcp_for_each_subflow(msk, subflow) {
- struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
- int err = sock_error(ssk);
- int ssk_state;
+ if (!err)
+ return false;
- if (!err)
- continue;
+ /* only propagate errors on fallen-back sockets or
+ * on MPC connect
+ */
+ if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(mptcp_sk(sk)))
+ return false;
- /* only propagate errors on fallen-back sockets or
- * on MPC connect
- */
- if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(msk))
- continue;
+ /* We need to propagate only transition to CLOSE state.
+ * Orphaned socket will see such state change via
+ * subflow_sched_work_if_closed() and that path will properly
+ * destroy the msk as needed.
+ */
+ ssk_state = inet_sk_state_load(ssk);
+ if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD))
+ inet_sk_state_store(sk, ssk_state);
+ WRITE_ONCE(sk->sk_err, -err);
- /* We need to propagate only transition to CLOSE state.
- * Orphaned socket will see such state change via
- * subflow_sched_work_if_closed() and that path will properly
- * destroy the msk as needed.
- */
- ssk_state = inet_sk_state_load(ssk);
- if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD))
- inet_sk_state_store(sk, ssk_state);
- WRITE_ONCE(sk->sk_err, -err);
-
- /* This barrier is coupled with smp_rmb() in mptcp_poll() */
- smp_wmb();
- sk_error_report(sk);
- break;
- }
+ /* This barrier is coupled with smp_rmb() in mptcp_poll() */
+ smp_wmb();
+ sk_error_report(sk);
+ return true;
+}
+
+void __mptcp_error_report(struct sock *sk)
+{
+ struct mptcp_subflow_context *subflow;
+ struct mptcp_sock *msk = mptcp_sk(sk);
+
+ mptcp_for_each_subflow(msk, subflow)
+ if (__mptcp_subflow_error_report(sk, mptcp_subflow_tcp_sock(subflow)))
+ break;
}
/* In most cases we will be able to lock the mptcp socket. If its already
@@ -2422,6 +2426,7 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
}
out_release:
+ __mptcp_subflow_error_report(sk, ssk);
release_sock(ssk);
sock_put(ssk);
--
2.41.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: mptcp: process pending subflow error on close: Tests Results
2023-08-23 8:28 ` [PATCH v2 mptcp-net 2/2] mptcp: process pending subflow error on close Paolo Abeni
@ 2023-08-23 10:06 ` MPTCP CI
2023-08-23 18:29 ` MPTCP CI
1 sibling, 0 replies; 6+ messages in thread
From: MPTCP CI @ 2023-08-23 10:06 UTC (permalink / raw)
To: Paolo Abeni; +Cc: mptcp
Hi Paolo,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5564860235251712
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5564860235251712/summary/summary.txt
- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4544513444675584
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4544513444675584/summary/summary.txt
- KVM Validation: debug (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5670413351518208
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5670413351518208/summary/summary.txt
- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6690760142094336
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6690760142094336/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/e64f9b400ebc
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-debug
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition
2023-08-23 8:28 [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition Paolo Abeni
2023-08-23 8:28 ` [PATCH v2 mptcp-net 1/2] mptcp: move __mptcp_error_report in protocol.c Paolo Abeni
2023-08-23 8:28 ` [PATCH v2 mptcp-net 2/2] mptcp: process pending subflow error on close Paolo Abeni
@ 2023-08-23 16:59 ` Mat Martineau
2 siblings, 0 replies; 6+ messages in thread
From: Mat Martineau @ 2023-08-23 16:59 UTC (permalink / raw)
To: Paolo Abeni; +Cc: mptcp
On Wed, 23 Aug 2023, Paolo Abeni wrote:
> This is an attempt to address the 2nd issue reported in:
>
> https://github.com/multipath-tcp/mptcp_net-next/issues/427
>
> See the individual patch changelog for the details. The cover letter
> is here mainly to trigger the CI.
>
> v1 -> v2:
> - fix compile warning reported by the CI
>
> Paolo Abeni (2):
> mptcp: move __mptcp_error_report in protocol.c
> mptcp: process pending subflow error on close
>
> net/mptcp/protocol.c | 41 +++++++++++++++++++++++++++++++++++++++++
> net/mptcp/subflow.c | 36 ------------------------------------
> 2 files changed, 41 insertions(+), 36 deletions(-)
Thanks for the v2, series looks good:
Reviewed-by: Mat Martineau <martineau@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mptcp: process pending subflow error on close: Tests Results
2023-08-23 8:28 ` [PATCH v2 mptcp-net 2/2] mptcp: process pending subflow error on close Paolo Abeni
2023-08-23 10:06 ` mptcp: process pending subflow error on close: Tests Results MPTCP CI
@ 2023-08-23 18:29 ` MPTCP CI
1 sibling, 0 replies; 6+ messages in thread
From: MPTCP CI @ 2023-08-23 18:29 UTC (permalink / raw)
To: Paolo Abeni; +Cc: mptcp
Hi Paolo,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6687372218204160
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6687372218204160/summary/summary.txt
- KVM Validation: debug (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5104075474206720
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5104075474206720/summary/summary.txt
- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5667025427628032
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5667025427628032/summary/summary.txt
- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4541125520785408
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4541125520785408/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/fe4acd2e87af
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-debug
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-08-23 18:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-23 8:28 [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition Paolo Abeni
2023-08-23 8:28 ` [PATCH v2 mptcp-net 1/2] mptcp: move __mptcp_error_report in protocol.c Paolo Abeni
2023-08-23 8:28 ` [PATCH v2 mptcp-net 2/2] mptcp: process pending subflow error on close Paolo Abeni
2023-08-23 10:06 ` mptcp: process pending subflow error on close: Tests Results MPTCP CI
2023-08-23 18:29 ` MPTCP CI
2023-08-23 16:59 ` [PATCH v2 mptcp-net 0/2] mptcp: fix missing close transition Mat Martineau
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.