--- /dev/null
+From 2f6c498e4f15d27852c04ed46d804a39137ba364 Mon Sep 17 00:00:00 2001
+From: Neal Cardwell <ncardwell@google.com>
+Date: Thu, 7 Dec 2017 12:43:31 -0500
+Subject: tcp_bbr: reset full pipe detection on loss recovery undo
+
+From: Neal Cardwell <ncardwell@google.com>
+
+commit 2f6c498e4f15d27852c04ed46d804a39137ba364 upstream.
+
+Fix BBR so that upon notification of a loss recovery undo BBR resets
+the full pipe detection (STARTUP exit) state machine.
+
+Under high reordering, reordering events can be interpreted as loss.
+If the reordering and spurious loss estimates are high enough, this
+could previously cause BBR to spuriously estimate that the pipe is
+full.
+
+Since spurious loss recovery means that our overall sending will have
+slowed down spuriously, this commit gives a flow more time to probe
+robustly for bandwidth and decide the pipe is really full.
+
+Signed-off-by: Neal Cardwell <ncardwell@google.com>
+Reviewed-by: Yuchung Cheng <ycheng@google.com>
+Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/ipv4/tcp_bbr.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/net/ipv4/tcp_bbr.c
++++ b/net/ipv4/tcp_bbr.c
+@@ -843,6 +843,10 @@ static u32 bbr_sndbuf_expand(struct sock
+ */
+ static u32 bbr_undo_cwnd(struct sock *sk)
+ {
++ struct bbr *bbr = inet_csk_ca(sk);
++
++ bbr->full_bw = 0; /* spurious slow-down; reset full pipe detection */
++ bbr->full_bw_cnt = 0;
+ return tcp_sk(sk)->snd_cwnd;
+ }
+
--- /dev/null
+From 600647d467c6d04b3954b41a6ee1795b5ae00550 Mon Sep 17 00:00:00 2001
+From: Neal Cardwell <ncardwell@google.com>
+Date: Thu, 7 Dec 2017 12:43:32 -0500
+Subject: tcp_bbr: reset long-term bandwidth sampling on loss recovery undo
+
+From: Neal Cardwell <ncardwell@google.com>
+
+commit 600647d467c6d04b3954b41a6ee1795b5ae00550 upstream.
+
+Fix BBR so that upon notification of a loss recovery undo BBR resets
+long-term bandwidth sampling.
+
+Under high reordering, reordering events can be interpreted as loss.
+If the reordering and spurious loss estimates are high enough, this
+can cause BBR to spuriously estimate that we are seeing loss rates
+high enough to trigger long-term bandwidth estimation. To avoid that
+problem, this commit resets long-term bandwidth sampling on loss
+recovery undo events.
+
+Signed-off-by: Neal Cardwell <ncardwell@google.com>
+Reviewed-by: Yuchung Cheng <ycheng@google.com>
+Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/ipv4/tcp_bbr.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/net/ipv4/tcp_bbr.c
++++ b/net/ipv4/tcp_bbr.c
+@@ -847,6 +847,7 @@ static u32 bbr_undo_cwnd(struct sock *sk
+
+ bbr->full_bw = 0; /* spurious slow-down; reset full pipe detection */
+ bbr->full_bw_cnt = 0;
++ bbr_reset_lt_bw_sampling(sk);
+ return tcp_sk(sk)->snd_cwnd;
+ }
+