linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Ihar Hrachyshka <ihrachys@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 3.18 027/121] neighbour: update neigh timestamps iff update is effective
Date: Wed, 11 Apr 2018 20:35:30 +0200	[thread overview]
Message-ID: <20180411183457.758935136@linuxfoundation.org> (raw)
In-Reply-To: <20180411183456.195010921@linuxfoundation.org>

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

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

From: Ihar Hrachyshka <ihrachys@redhat.com>


[ Upstream commit 77d7123342dcf6442341b67816321d71da8b2b16 ]

It's a common practice to send gratuitous ARPs after moving an
IP address to another device to speed up healing of a service. To
fulfill service availability constraints, the timing of network peers
updating their caches to point to a new location of an IP address can be
particularly important.

Sometimes neigh_update calls won't touch neither lladdr nor state, for
example if an update arrives in locktime interval. The neigh->updated
value is tested by the protocol specific neigh code, which in turn
will influence whether NEIGH_UPDATE_F_OVERRIDE gets set in the
call to neigh_update() or not. As a result, we may effectively ignore
the update request, bailing out of touching the neigh entry, except that
we still bump its timestamps inside neigh_update.

This may be a problem for updates arriving in quick succession. For
example, consider the following scenario:

A service is moved to another device with its IP address. The new device
sends three gratuitous ARP requests into the network with ~1 seconds
interval between them. Just before the first request arrives to one of
network peer nodes, its neigh entry for the IP address transitions from
STALE to DELAY.  This transition, among other things, updates
neigh->updated. Once the kernel receives the first gratuitous ARP, it
ignores it because its arrival time is inside the locktime interval. The
kernel still bumps neigh->updated. Then the second gratuitous ARP
request arrives, and it's also ignored because it's still in the (new)
locktime interval. Same happens for the third request. The node
eventually heals itself (after delay_first_probe_time seconds since the
initial transition to DELAY state), but it just wasted some time and
require a new ARP request/reply round trip. This unfortunate behaviour
both puts more load on the network, as well as reduces service
availability.

This patch changes neigh_update so that it bumps neigh->updated (as well
as neigh->confirmed) only once we are sure that either lladdr or entry
state will change). In the scenario described above, it means that the
second gratuitous ARP request will actually update the entry lladdr.

Ideally, we would update the neigh entry on the very first gratuitous
ARP request. The locktime mechanism is designed to ignore ARP updates in
a short timeframe after a previous ARP update was honoured by the kernel
layer. This would require tracking timestamps for state transitions
separately from timestamps when actual updates are received. This would
probably involve changes in neighbour struct. Therefore, the patch
doesn't tackle the issue of the first gratuitous APR ignored, leaving
it for a follow-up.

Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/neighbour.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1147,10 +1147,6 @@ int neigh_update(struct neighbour *neigh
 		lladdr = neigh->ha;
 	}
 
-	if (new & NUD_CONNECTED)
-		neigh->confirmed = jiffies;
-	neigh->updated = jiffies;
-
 	/* If entry was valid and address is not changed,
 	   do not change entry state, if new one is STALE.
 	 */
@@ -1174,6 +1170,16 @@ int neigh_update(struct neighbour *neigh
 		}
 	}
 
+	/* Update timestamps only once we know we will make a change to the
+	 * neighbour entry. Otherwise we risk to move the locktime window with
+	 * noop updates and ignore relevant ARP updates.
+	 */
+	if (new != old || lladdr != neigh->ha) {
+		if (new & NUD_CONNECTED)
+			neigh->confirmed = jiffies;
+		neigh->updated = jiffies;
+	}
+
 	if (new != old) {
 		neigh_del_timer(neigh);
 		if (new & NUD_IN_TIMER)

  parent reply	other threads:[~2018-04-11 18:38 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11 18:35 [PATCH 3.18 000/121] 3.18.105-stable review Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 001/121] NFSv4.1: RECLAIM_COMPLETE must handle NFS4ERR_CONN_NOT_BOUND_TO_SESSION Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 002/121] IB/srpt: Fix abort handling Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 003/121] af_key: Fix slab-out-of-bounds in pfkey_compile_policy Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 004/121] mac80211: bail out from prep_connection() if a reconfig is ongoing Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 005/121] bna: Avoid reading past end of buffer Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 006/121] qlge: " Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 007/121] net: ethernet: ti: cpsw: adjust cpsw fifos depth for fullduplex flow control Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 008/121] lockd: fix lockd shutdown race Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 009/121] pidns: disable pid allocation if pid_ns_prepare_proc() is failed in alloc_pid() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 010/121] s390: move _text symbol to address higher than zero Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 011/121] net/mlx4_en: Avoid adding steering rules with invalid ring Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 012/121] CIFS: silence lockdep splat in cifs_relock_file() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 013/121] net: qca_spi: Fix alignment issues in rx path Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 014/121] netxen_nic: set rcode to the return status from the call to netxen_issue_cmd Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 015/121] KVM: PPC: Book3S PR: Check copy_to/from_user return values Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 016/121] vmxnet3: ensure that adapter is in proper state during force_close Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 017/121] SMB2: Fix share type handling Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 018/121] PowerCap: Fix an error code in powercap_register_zone() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 019/121] staging: wlan-ng: prism2mgmt.c: fixed a double endian conversion before calling hfa384x_drvr_setconfig16, also fixes relative sparse warning Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 020/121] x86/tsc: Provide tsc=unstable boot parameter Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 021/121] ARM: dts: imx6qdl-wandboard: Fix audio channel swap Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 022/121] ipv6: avoid dad-failures for addresses with NODAD Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 023/121] async_tx: Fix DMA_PREP_FENCE usage in do_async_gen_syndrome() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 024/121] usb: dwc3: keystone: check return value Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 025/121] btrfs: fix incorrect error return ret being passed to mapping_set_error Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 026/121] ata: libahci: properly propagate return value of platform_get_irq() Greg Kroah-Hartman
2018-04-11 18:35 ` Greg Kroah-Hartman [this message]
2018-04-11 18:35 ` [PATCH 3.18 028/121] usb: chipidea: properly handle host or gadget initialization failure Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 029/121] USB: ene_usb6250: fix first command execution Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 030/121] net: x25: fix one potential use-after-free issue Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 031/121] USB: ene_usb6250: fix SCSI residue overwriting Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 032/121] sh_eth: Use platform device for printing before register_netdev() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 033/121] ath5k: fix memory leak on buf on failed eeprom read Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 034/121] selftests/powerpc: Fix TM resched DSCR test with some compilers Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 035/121] xfrm: fix state migration copy replay sequence numbers Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 036/121] ARM: davinci: da8xx: Create DSP device only when assigned memory Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 037/121] ray_cs: Avoid reading past end of buffer Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 038/121] leds: pca955x: Correct I2C Functionality Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 039/121] block: fix an error code in add_partition() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 040/121] libceph: NULL deref on crush_decode() error path Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 041/121] netfilter: ctnetlink: fix incorrect nf_ct_put during hash resize Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 042/121] scsi: bnx2fc: fix race condition in bnx2fc_get_host_stats() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 043/121] fix race in drivers/char/random.c:get_reg() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 044/121] ext4: fix off-by-one on max nr_pages in ext4_find_unwritten_pgoff() Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 045/121] net: move somaxconn init from sysctl code Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 046/121] bonding: Dont update slave->link until ready to commit Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 047/121] KVM: nVMX: Fix handling of lmsw instruction Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 048/121] net: llc: add lock_sock in llc_ui_bind to avoid a race condition Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 049/121] l2tp: fix missing print session offset info Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 050/121] scsi: libiscsi: Allow sd_shutdown on bad transport Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 051/121] vfb: fix video mode and line_length being set when loaded Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 052/121] wl1251: check return from call to wl1251_acx_arp_ip_filter Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 053/121] hdlcdrv: Fix divide by zero in hdlcdrv_ioctl Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 054/121] ovl: filter trusted xattr for non-admin Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 055/121] powerpc/[booke|4xx]: Dont clobber TCR[WP] when setting TCR[DIE] Greg Kroah-Hartman
2018-04-11 18:35 ` [PATCH 3.18 056/121] arm64: futex: Fix undefined behaviour with FUTEX_OP_OPARG_SHIFT usage Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 057/121] rtc: interface: Validate alarm-time before handling rollover Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 058/121] net: freescale: fix potential null pointer dereference Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 059/121] KVM: SVM: do not zero out segment attributes if segment is unusable or not present Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 060/121] powerpc/spufs: Fix coredump of SPU contexts Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 061/121] perf trace: Add mmap alias for s390 Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 062/121] qlcnic: Fix a sleep-in-atomic bug in qlcnic_82xx_hw_write_wx_2M and qlcnic_82xx_hw_read_wx_2M Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 063/121] mISDN: Fix a sleep-in-atomic bug Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 064/121] drm/omap: fix tiled buffer stride calculations Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 065/121] Fix serial console on SNI RM400 machines Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 066/121] bio-integrity: Do not allocate integrity context for bio w/o data Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 067/121] skbuff: return -EMSGSIZE in skb_to_sgvec to prevent overflow Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 068/121] net/mlx4: Fix the check in attaching steering rules Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 069/121] perf report: Ensure the perf DSO mapping matches what libdw sees Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 070/121] tags: honor COMPILED_SOURCE with apart output directory Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 071/121] e1000e: fix race condition around skb_tstamp_tx() Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 072/121] [media] cx25840: fix unchecked return values Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 073/121] [media] mceusb: sporadic RX truncation corruption fix Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 074/121] net: phy: avoid genphy_aneg_done() for PHYs without clause 22 support Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 075/121] e1000e: Undo e1000e_pm_freeze if __e1000_shutdown fails Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 076/121] perf/core: Correct event creation with PERF_FORMAT_GROUP Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 077/121] MIPS: mm: fixed mappings: correct initialisation Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 078/121] MIPS: kprobes: flush_insn_slot should flush only if probe initialised Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 079/121] net: emac: fix reset timeout with AR8035 phy Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 080/121] perf tests: Decompress kernel module before objdump Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 081/121] xen: avoid type warning in xchg_xen_ulong Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 082/121] bnx2x: Allow vfs to disable txvlan offload Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 083/121] sctp: fix recursive locking warning in sctp_do_peeloff Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 084/121] sparc64: ldc abort during vds iso boot Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 085/121] iio: magnetometer: st_magn_spi: fix spi_device_id table Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 086/121] Bluetooth: Send HCI Set Event Mask Page 2 command only when needed Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 087/121] ACPICA: Events: Add runtime stub support for event APIs Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 088/121] ACPICA: Disassembler: Abort on an invalid/unknown AML opcode Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 089/121] vxlan: dont migrate permanent fdb entries during learn Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 090/121] bcache: stop writeback thread after detaching Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 091/121] bcache: segregate flash only volume write streams Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 092/121] scsi: libsas: fix memory leak in sas_smp_get_phy_events() Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 093/121] scsi: libsas: fix error when getting phy events Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 094/121] scsi: libsas: initialize sas_phy status according to response of DISCOVER Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 095/121] tty: n_gsm: Allow ADM response in addition to UA for control dlci Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 096/121] EDAC, mv64x60: Fix an error handling path Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 097/121] ipsec: check return value of skb_to_sgvec always Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 098/121] rxrpc: " Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 099/121] virtio_net: " Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 100/121] virtio_net: check return value of skb_to_sgvec in one more location Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 101/121] random: use lockless method of accessing and updating f->reg_idx Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 102/121] futex: Remove requirement for lock_page() in get_futex_key() Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 103/121] net: fix possible out-of-bound read in skb_network_protocol() Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 104/121] netlink: make sure nladdr has correct size in netlink_connect() Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 105/121] pptp: remove a buggy dst release in pptp_connect() Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 106/121] sctp: do not leak kernel memory to user space Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 107/121] sctp: sctp_sockaddr_af must check minimal addr length for AF_INET6 Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 108/121] sky2: Increase D3 delay to sky2 stops working after suspend Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 109/121] vhost: correctly remove wait queue during poll failure Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 110/121] bonding: fix the err path for dev hwaddr sync in bond_enslave Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 111/121] bonding: move dev_mc_sync after master_upper_dev_link " Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 112/121] bonding: process the err returned by dev_set_allmulti properly " Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 113/121] net: fool proof dev_valid_name() Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 114/121] ip_tunnel: better validate user provided tunnel names Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 115/121] ipv6: sit: " Greg Kroah-Hartman
2018-04-11 18:36 ` [PATCH 3.18 116/121] ip6_gre: " Greg Kroah-Hartman
2018-04-11 18:37 ` [PATCH 3.18 117/121] vti6: " Greg Kroah-Hartman
2018-04-11 18:37 ` [PATCH 3.18 118/121] ip6_tunnel: " Greg Kroah-Hartman
2018-04-11 18:37 ` [PATCH 3.18 119/121] r8169: fix setting driver_data after register_netdev Greg Kroah-Hartman
2018-04-11 18:37 ` [PATCH 3.18 120/121] net sched actions: fix dumping which requires several messages to user space Greg Kroah-Hartman
2018-04-11 18:37 ` [PATCH 3.18 121/121] ipv6: the entire IPv6 header chain must fit the first fragment Greg Kroah-Hartman
2018-04-11 22:51 ` [PATCH 3.18 000/121] 3.18.105-stable review Shuah Khan
2018-04-11 23:02 ` kernelci.org bot
2018-04-12  5:11 ` Harsh Shandilya
2018-04-12 12:33   ` Greg Kroah-Hartman
2018-04-12 13:15 ` Guenter Roeck
2018-04-12 16:54   ` Greg Kroah-Hartman

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=20180411183457.758935136@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@microsoft.com \
    --cc=davem@davemloft.net \
    --cc=ihrachys@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).