All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH mptcp-next 1/1] mptcp: fix stale subflow->writeable caching
@ 2020-08-21 15:38 Florian Westphal
  0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2020-08-21 15:38 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]

Even with fixed subflow_write_space(), we may still indicate EPOLLOUT
even if no subflow is writeable.

We need to re-check the last ssk that was used after the final tcp_push().
tcp_push() can allocate new skbs that get charged to the subflow sk
which may bring it above the wmem limit.

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

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index ad91f4588216..4dd5d35a8f39 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1239,7 +1239,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 		msk->snd_burst -= ret;
 		copied += ret;
 
-		if (!sk_stream_memory_free(ssk))
+		if (!sk_stream_is_writeable(ssk))
 			WRITE_ONCE(subflow->writable, false);
 
 		tx_ok = msg_data_left(msg);
@@ -1294,6 +1294,9 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 		/* start the timer, if it's not pending */
 		if (!mptcp_timer_pending(sk))
 			mptcp_reset_timer(sk);
+
+		if (!sk_stream_is_writeable(ssk))
+			WRITE_ONCE(mptcp_subflow_ctx(ssk)->writable, false);
 	}
 
 	release_sock(ssk);
-- 
2.26.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-21 15:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 15:38 [MPTCP] [PATCH mptcp-next 1/1] mptcp: fix stale subflow->writeable caching Florian Westphal

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.