public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Nandita Dukkipati <nanditad@google.com>,
	Yuchung Cheng <ycheng@google.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [15/88] tcp: bug fix in proportional rate reduction.
Date: Tue, 13 Aug 2013 11:57:09 -0400	[thread overview]
Message-ID: <20130813155826.004475884@goodmis.org> (raw)
In-Reply-To: 20130813155654.069291373@goodmis.org

[-- Attachment #1: 0015-tcp-bug-fix-in-proportional-rate-reduction.patch --]
[-- Type: text/plain, Size: 5193 bytes --]

3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Nandita Dukkipati <nanditad@google.com>

[ Upstream commit 35f079ebbc860dcd1cca70890c9c8d59c1145525 ]

This patch is a fix for a bug triggering newly_acked_sacked < 0
in tcp_ack(.).

The bug is triggered by sacked_out decreasing relative to prior_sacked,
but packets_out remaining the same as pior_packets. This is because the
snapshot of prior_packets is taken after tcp_sacktag_write_queue() while
prior_sacked is captured before tcp_sacktag_write_queue(). The problem
is: tcp_sacktag_write_queue (tcp_match_skb_to_sack() -> tcp_fragment)
adjusts the pcount for packets_out and sacked_out (MSS change or other
reason). As a result, this delta in pcount is reflected in
(prior_sacked - sacked_out) but not in (prior_packets - packets_out).

This patch does the following:
1) initializes prior_packets at the start of tcp_ack() so as to
capture the delta in packets_out created by tcp_fragment.
2) introduces a new "previous_packets_out" variable that snapshots
packets_out right before tcp_clean_rtx_queue, so pkts_acked can be
correctly computed as before.
3) Computes pkts_acked using previous_packets_out, and computes
newly_acked_sacked using prior_packets.

Signed-off-by: Nandita Dukkipati <nanditad@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 net/ipv4/tcp_input.c |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index c30a56e..a5080e4 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2924,8 +2924,8 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack)
  * tcp_xmit_retransmit_queue().
  */
 static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,
-				  int prior_sacked, bool is_dupack,
-				  int flag)
+				  int prior_sacked, int prior_packets,
+				  bool is_dupack, int flag)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
 	struct tcp_sock *tp = tcp_sk(sk);
@@ -2991,7 +2991,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,
 				tcp_add_reno_sack(sk);
 		} else
 			do_lost = tcp_try_undo_partial(sk, pkts_acked);
-		newly_acked_sacked = pkts_acked + tp->sacked_out - prior_sacked;
+		newly_acked_sacked = prior_packets - tp->packets_out +
+				     tp->sacked_out - prior_sacked;
 		break;
 	case TCP_CA_Loss:
 		if (flag & FLAG_DATA_ACKED)
@@ -3013,7 +3014,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,
 			if (is_dupack)
 				tcp_add_reno_sack(sk);
 		}
-		newly_acked_sacked = pkts_acked + tp->sacked_out - prior_sacked;
+		newly_acked_sacked = prior_packets - tp->packets_out +
+				     tp->sacked_out - prior_sacked;
 
 		if (icsk->icsk_ca_state <= TCP_CA_Disorder)
 			tcp_try_undo_dsack(sk);
@@ -3632,10 +3634,11 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
 	bool is_dupack = false;
 	u32 prior_in_flight;
 	u32 prior_fackets;
-	int prior_packets;
+	int prior_packets = tp->packets_out;
 	int prior_sacked = tp->sacked_out;
 	int pkts_acked = 0;
 	bool frto_cwnd = false;
+	int previous_packets_out = 0;
 
 	/* If the ack is older than previous acks
 	 * then we can probably ignore it.
@@ -3714,14 +3717,14 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
 	sk->sk_err_soft = 0;
 	icsk->icsk_probes_out = 0;
 	tp->rcv_tstamp = tcp_time_stamp;
-	prior_packets = tp->packets_out;
 	if (!prior_packets)
 		goto no_queue;
 
 	/* See if we can take anything off of the retransmit queue. */
+	previous_packets_out = tp->packets_out;
 	flag |= tcp_clean_rtx_queue(sk, prior_fackets, prior_snd_una);
 
-	pkts_acked = prior_packets - tp->packets_out;
+	pkts_acked = previous_packets_out - tp->packets_out;
 
 	if (tp->frto_counter)
 		frto_cwnd = tcp_process_frto(sk, flag);
@@ -3736,7 +3739,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
 			tcp_cong_avoid(sk, ack, prior_in_flight);
 		is_dupack = !(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP));
 		tcp_fastretrans_alert(sk, pkts_acked, prior_sacked,
-				      is_dupack, flag);
+				      prior_packets, is_dupack, flag);
 	} else {
 		if ((flag & FLAG_DATA_ACKED) && !frto_cwnd)
 			tcp_cong_avoid(sk, ack, prior_in_flight);
@@ -3753,7 +3756,7 @@ no_queue:
 	/* If data was DSACKed, see if we can undo a cwnd reduction. */
 	if (flag & FLAG_DSACKING_ACK)
 		tcp_fastretrans_alert(sk, pkts_acked, prior_sacked,
-				      is_dupack, flag);
+				      prior_packets, is_dupack, flag);
 	/* If this ack opens up a zero window, clear backoff.  It was
 	 * being used to time the probes, and is probably far higher than
 	 * it needs to be for normal retransmission.
@@ -3773,7 +3776,7 @@ old_ack:
 	if (TCP_SKB_CB(skb)->sacked) {
 		flag |= tcp_sacktag_write_queue(sk, skb, prior_snd_una);
 		tcp_fastretrans_alert(sk, pkts_acked, prior_sacked,
-				      is_dupack, flag);
+				      prior_packets, is_dupack, flag);
 	}
 
 	SOCK_DEBUG(sk, "Ack %u before %u:%u\n", ack, tp->snd_una, tp->snd_nxt);
-- 
1.7.10.4



  parent reply	other threads:[~2013-08-13 16:10 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13 15:56 [00/88] 3.6.11.7-rc1-stable review Steven Rostedt
2013-08-13 15:56 ` [01/88] ALSA: usb-audio: Fix invalid volume resolution for Logitech HD Webcam c310 Steven Rostedt
2013-08-13 15:56 ` [02/88] ALSA: usb-audio: work around Android accessory firmware bug Steven Rostedt
2013-08-13 15:56 ` [03/88] clk: remove notifier from list before freeing it Steven Rostedt
2013-08-13 15:56 ` [04/88] tilepro: work around module link error with gcc 4.7 Steven Rostedt
2013-08-13 15:56 ` [05/88] carl9170: fix frame drop and WARN due to minstrel_ht change Steven Rostedt
2013-08-13 17:15   ` Luis Henriques
2013-08-13 20:00     ` Steven Rostedt
2013-08-13 15:57 ` [06/88] KVM: x86: remove vcpus CPL check in host-invoked XCR set Steven Rostedt
2013-08-13 15:57 ` [07/88] drm/radeon: prevent crash in the ring space allocation Steven Rostedt
2013-08-13 15:57 ` [08/88] drm/radeon: update lockup tracking when scheduling in empty ring Steven Rostedt
2013-08-13 15:57 ` [09/88] x86: fix build error and kconfig for ia32_emulation and binfmt Steven Rostedt
2013-08-13 15:57 ` [10/88] tcp: fix tcp_md5_hash_skb_data() Steven Rostedt
2013-08-13 15:57 ` [11/88] gianfar: add missing iounmap() on error in gianfar_ptp_probe() Steven Rostedt
2013-08-13 15:57 ` [12/88] ipv6: fix possible crashes in ip6_cork_release() Steven Rostedt
2013-08-13 15:57 ` [13/88] netlabel: improve domain mapping validation Steven Rostedt
2013-08-13 15:57 ` [14/88] 8139cp: reset BQL when ring tx ring cleared Steven Rostedt
2013-08-13 15:57 ` Steven Rostedt [this message]
2013-08-13 15:57 ` [16/88] tcp: xps: fix reordering issues Steven Rostedt
2013-08-13 15:57 ` [17/88] ip_tunnel: fix kernel panic with icmp_dest_unreach Steven Rostedt
2013-08-13 15:57 ` [18/88] net: phy: fix a bug when verify the EEE support Steven Rostedt
2013-08-13 15:57 ` [19/88] ipv4: fix redirect handling for TCP packets Steven Rostedt
2013-08-13 15:57 ` [20/88] net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg Steven Rostedt
2013-08-13 15:57 ` [21/88] net: Unbreak compat_sys_{send,recv}msg Steven Rostedt
2013-08-13 15:57 ` [22/88] net/core/sock.c: add missing VSOCK string in af_family_*_key_strings Steven Rostedt
2013-08-13 15:57 ` [23/88] net: force a reload of first item in hlist_nulls_for_each_entry_rcu Steven Rostedt
2013-08-13 15:57 ` [24/88] ipv6: assign rt6_info to inet6_ifaddr in init_loopback Steven Rostedt
2013-08-13 15:57 ` [25/88] net: sctp: fix NULL pointer dereference in socket destruction Steven Rostedt
2013-08-13 15:57 ` [26/88] team: check return value of team_get_port_by_index_rcu() for NULL Steven Rostedt
2013-08-13 15:57 ` [27/88] team: move add to port list before port enablement Steven Rostedt
2013-08-13 15:57 ` [28/88] packet: packet_getname_spkt: make sure string is always 0-terminated Steven Rostedt
2013-08-13 15:57 ` [29/88] l2tp: Fix PPP header erasure and memory leak Steven Rostedt
2013-08-13 15:57 ` [30/88] l2tp: Fix sendmsg() return value Steven Rostedt
2013-08-13 15:57 ` [31/88] sctp: fully initialize sctp_outq in sctp_outq_init Steven Rostedt
2013-08-13 15:57 ` [32/88] net: sh_eth: fix incorrect RX length error if R8A7740 Steven Rostedt
2013-08-13 15:57 ` [33/88] Input: cyttsp - fix memcpy size param Steven Rostedt
2013-08-13 15:57 ` [34/88] USB: serial: ti_usb_3410_5052: new device id for Abbot strip port cable Steven Rostedt
2013-08-13 15:57 ` [35/88] tcm_qla2xxx: Fix residual for underrun commands that fail Steven Rostedt
2013-08-13 15:57 ` [36/88] target/iscsi: dont corrupt bh_count in iscsit_stop_time2retain_timer() Steven Rostedt
2013-08-13 15:57 ` [37/88] perf: Fix perf mmap bugs Steven Rostedt
2013-08-13 15:57 ` [38/88] perf: Fix mmap() accounting hole Steven Rostedt
2013-08-13 15:57 ` [39/88] ARM: 7755/1: handle user space mapped pages in flush_kernel_dcache_page Steven Rostedt
2013-08-13 15:57 ` [40/88] ARM: 7772/1: Fix missing flush_kernel_dcache_page() for noMMU Steven Rostedt
2013-08-13 15:57 ` [41/88] Bluetooth: Fix crash in l2cap_build_cmd() with small MTU Steven Rostedt
2013-08-13 15:57 ` [42/88] hw_breakpoint: Use cpu_possible_mask in {reserve,release}_bp_slot() Steven Rostedt
2013-08-13 15:57 ` [43/88] ath9k_htc: Handle IDLE state transition properly Steven Rostedt
2013-08-13 15:57 ` [44/88] iwlwifi: dvm: fix chain noise calibration Steven Rostedt
2013-08-13 15:57 ` [45/88] dlci: acquire rtnl_lock before calling __dev_get_by_name() Steven Rostedt
2013-08-13 15:57 ` [46/88] dlci: validate the net device in dlci_del() Steven Rostedt
2013-08-13 15:57 ` [47/88] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets Steven Rostedt
2013-08-13 15:57 ` [48/88] perf: Disable monitoring on setuid processes for regular users Steven Rostedt
2013-08-13 15:57 ` [49/88] crypto: algboss - Hold ref count on larval Steven Rostedt
2013-08-13 15:57 ` [50/88] UBIFS: prepare to fix a horrid bug Steven Rostedt
2013-08-13 15:57 ` [51/88] UBIFS: " Steven Rostedt
2013-08-13 15:57 ` [52/88] libata-acpi: add back ACPI based hotplug functionality Steven Rostedt
2013-08-13 15:57 ` [53/88] libceph: Fix NULL pointer dereference in auth client code Steven Rostedt
2013-08-13 15:57 ` [54/88] drivers/cdrom/cdrom.c: use kzalloc() for failing hardware Steven Rostedt
2013-08-13 15:57 ` [55/88] charger-manager: Ensure event is not used as format string Steven Rostedt
2013-08-13 15:57 ` [56/88] hpfs: better test for errors Steven Rostedt
2013-08-13 15:57 ` [57/88] block: do not pass disk names as format strings Steven Rostedt
2013-08-13 15:57 ` [58/88] crypto: sanitize argument for format string Steven Rostedt
2013-08-13 15:57 ` [59/88] MAINTAINERS: add stable_kernel_rules.txt to stable maintainer information Steven Rostedt
2013-08-13 15:57 ` [60/88] futex: Take hugepages into account when generating futex_key Steven Rostedt
2013-08-13 15:57 ` [61/88] nfsd4: fix decoding of compounds across page boundaries Steven Rostedt
2013-08-13 15:57 ` [62/88] sd: Fix parsing of temporary cache mode prefix Steven Rostedt
2013-08-13 15:57 ` [63/88] use sensible file nlink values if unprovided Steven Rostedt
2013-08-13 15:57 ` [64/88] rtlwifi: rtl8192cu: Fix duplicate if test Steven Rostedt
2013-08-13 15:57 ` [65/88] jbd2: move superblock checksum calculation to jbd2_write_superblock() Steven Rostedt
2013-08-13 15:58 ` [66/88] jbd2: fix theoretical race in jbd2__journal_restart Steven Rostedt
2013-08-13 15:58 ` [67/88] ext3,ext4: dont mess with dir_file->f_pos in htree_dirblock_to_tree() Steven Rostedt
2013-08-13 15:58 ` [68/88] usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed Steven Rostedt
2013-08-13 15:58 ` [69/88] xhci: check for failed dma pool allocation Steven Rostedt
2013-08-13 15:58 ` [70/88] usb: host: xhci-plat: release mem region while removing module Steven Rostedt
2013-08-13 15:58 ` [71/88] drivers: hv: switch to use mb() instead of smp_mb() Steven Rostedt
2013-08-13 15:58 ` [72/88] pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status Steven Rostedt
2013-08-13 15:58 ` [73/88] cgroup: fix umount vs cgroup_event_remove() race Steven Rostedt
2013-08-13 15:58 ` [74/88] xen/time: remove blocked time accounting from xen "clockchip" Steven Rostedt
2013-08-13 15:58 ` [75/88] genirq: Fix can_request_irq() for IRQs without an action Steven Rostedt
2013-08-13 15:58 ` [76/88] drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq Steven Rostedt
2013-08-13 15:58 ` [77/88] ACPICA: Do not use extended sleep registers unless HW-reduced bit is set Steven Rostedt
2013-08-13 15:58 ` [78/88] ocfs2: xattr: fix inlined xattr reflink Steven Rostedt
2013-08-13 15:58 ` [79/88] nbd: correct disconnect behavior Steven Rostedt
2013-08-13 15:58 ` [80/88] PCI: Fix refcount issue in pci_create_root_bus() error recovery path Steven Rostedt
2013-08-13 15:58 ` [81/88] ahci: remove pmp link online check in FBS EH Steven Rostedt
2013-08-13 15:58 ` [82/88] timer: Fix jiffies wrap behavior of round_jiffies_common() Steven Rostedt
2013-08-13 15:58 ` [83/88] ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs Steven Rostedt
2013-08-13 15:58 ` [84/88] ext4: fix overflow when counting used blocks on 32-bit architectures Steven Rostedt
2013-08-13 15:58 ` [85/88] ext4: dont allow ext4_free_blocks() to fail due to ENOMEM Steven Rostedt
2013-08-13 15:58 ` [86/88] drivers/dma/pl330.c: fix locking in pl330_free_chan_resources() Steven Rostedt
2013-08-13 15:58 ` [87/88] mm/memory-hotplug: fix lowmem count overflow when offline pages Steven Rostedt
2013-08-13 15:58 ` [88/88] Handle big endianness in NTLM (ntlmv2) authentication Steven Rostedt
2013-08-13 16:25 ` [00/88] 3.6.11.7-rc1-stable review Steven Rostedt

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=20130813155826.004475884@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nanditad@google.com \
    --cc=stable@vger.kernel.org \
    --cc=ycheng@google.com \
    /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