All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH mptcp-next 2/7] mptcp: make sure timer is inited/started once data is pending for transmission
@ 2020-05-06 13:02 Florian Westphal
  0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2020-05-06 13:02 UTC (permalink / raw)
  To: mptcp

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

The mptcp_connect self-tests with additional '-m mmap' argument triggers a
(harmless) WARN_ON_ONCE splat in mptcp_reset_timer() as the mptcp timer
is not initialized yet.

This is because the timer is only set up after the transmit loop, but
consecutive iterations can trigger the splat.

Make sure the timer is set as soon as we pass the first chunk of data.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/3
Signed-off-by: Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/protocol.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 25427797753b..ab6599dfda59 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -785,6 +785,11 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 		}
 
 		copied += ret;
+		mptcp_set_timeout(sk, ssk);
+		/* start the timer, if it's not pending */
+		if (!mptcp_timer_pending(sk))
+			mptcp_reset_timer(sk);
+
 		tx_ok = msg_data_left(msg);
 		if (!tx_ok)
 			break;
@@ -796,12 +801,10 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 		}
 	}
 
-	mptcp_set_timeout(sk, ssk);
 	if (copied) {
 		ret = copied;
 		tcp_push(ssk, msg->msg_flags, mss_now, tcp_sk(ssk)->nonagle,
 			 size_goal);
-
 		/* start the timer, if it's not pending */
 		if (!mptcp_timer_pending(sk))
 			mptcp_reset_timer(sk);
-- 
2.26.2

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

only message in thread, other threads:[~2020-05-06 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 13:02 [MPTCP] [PATCH mptcp-next 2/7] mptcp: make sure timer is inited/started once data is pending for transmission 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.