mptcp: fix stale subflow->writeable caching
Subsystems (2)
Florian Westphal
PATCH 1/1 mptcp: fix stale subflow->writeable caching
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.
--- net/mptcp/protocol.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +4 -1
@@ -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);
Signature · 1 line
2.26.2
Mat Martineau
Quoted 37 lines · Florian Westphal
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(-)net/mptcp/protocol.c +4
-1@@ -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);Signature · 1 line
2.26.2
Thanks Florian. All three patches look good to me.
--
Mat Martineau
Intel
Matthieu Baerts
Hi Florian, Mat,
Quoted 5 lines · Mat Martineau
Quoted 3 lines · Florian Westphal
Even with fixed
subflow_write_space(), we may still indicate EPOLLOUT even if no subflow is writeable.
Quoted 8 lines
Quoted 6 lines
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>Thanks Florian. All three patches look good to me.
Thank you for the patch and the review!
Applied at the end of the series.
Tests + export are in progress!
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net