netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	mptcp@lists.01.org, Florian Westphal <fw@strlen.de>
Subject: [PATCH net 4/4] mptcp: do not wakeup listener for MPJ subflows
Date: Fri, 19 Feb 2021 18:35:40 +0100	[thread overview]
Message-ID: <039d97d7c7d90a52e55aa90760585eea7cb0d027.1613755058.git.pabeni@redhat.com> (raw)
In-Reply-To: <cover.1613755058.git.pabeni@redhat.com>

MPJ subflows are not exposed as fds to user spaces. As such,
incoming MPJ subflows are removed from the accept queue by
tcp_check_req()/tcp_get_cookie_sock().

Later tcp_child_process() invokes subflow_data_ready() on the
parent socket regardless of the subflow kind, leading to poll
wakeups even if the later accept will block.

Address the issue by double-checking the queue state before
waking the user-space.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/164
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Fixes: f296234c98a8 ("mptcp: Add handling of incoming MP_JOIN requests")
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/subflow.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 8b2338dfdc80..59f992fe6728 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -1018,6 +1018,12 @@ static void subflow_data_ready(struct sock *sk)
 
 	msk = mptcp_sk(parent);
 	if (state & TCPF_LISTEN) {
+		/* MPJ subflow are removed from accept queue before reaching here,
+		 * avoid stray wakeups
+		 */
+		if (reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue))
+			return;
+
 		set_bit(MPTCP_DATA_READY, &msk->flags);
 		parent->sk_data_ready(parent);
 		return;
-- 
2.26.2


  parent reply	other threads:[~2021-02-19 17:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 17:35 [PATCH net 0/4] mptcp: a bunch of fixes Paolo Abeni
2021-02-19 17:35 ` [PATCH net 1/4] mptcp: fix DATA_FIN processing for orphaned sockets Paolo Abeni
2021-02-19 17:35 ` [PATCH net 2/4] mptcp: fix DATA_FIN generation on early shutdown Paolo Abeni
2021-02-19 17:35 ` [PATCH net 3/4] mptcp: provide subflow aware release function Paolo Abeni
2021-02-19 17:35 ` Paolo Abeni [this message]
2021-02-23  3:10 ` [PATCH net 0/4] mptcp: a bunch of fixes patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=039d97d7c7d90a52e55aa90760585eea7cb0d027.1613755058.git.pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=kuba@kernel.org \
    --cc=mptcp@lists.01.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).