Article View: linux.kernel.netdev
Article #27016Re: [PATCH net-next v2 1/2] bonding: reseed the ARP monitor when it starts
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 16:19
Date: Fri, 04 Dec 2026 16:19
257 lines
18256 bytes
18256 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] bonding: bond_arp_reseed_slaves() reseeds administratively
down slaves
- [Low] The commit fixes a user-visible failover bug but has no Fixes:
tag, and it does not say that it is meant for net-next only.
- [Low] Two places describe the aged seed jiffies - (2*delta + 1) as
being outside "the up window": the comment on bond_arp_down_seed() and…
- [Low] In its UP branch, bond_arp_seed_slave() does a plain store
`slave->last_link_up = jiffies` and then WRITE_ONCE(slave->last_rx,…
--
bonding: reseed the ARP monitor when it starts
This patch reseeds the per-slave ARP timestamps when the ARP monitor goes
from off to on, either in bond_open() or when arp_interval changes from 0
to non-zero. A slave that is UP and has carrier gets a fresh last_link_up
and a full arp_missed_max window. The timestamps of all other slaves are
only moved back, to the down seed.
Link: https://lore.kernel.org/netdev/20261030-bonding-last-rx-v5-0-0b9b653f2f94@well-founded.dev/
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 754048ef4835d..bc66b130b765e 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1888,6 +1888,72 @@ void bond_xdp_set_features(struct net_device *bond_dev)
> xdp_set_features_flag(bond_dev, val);
> }
>
> +/* A timestamp outside the up window, see bond_time_in_interval(). */
> +static unsigned long bond_arp_down_seed(struct bonding *bond)
> +{
> + return jiffies - (2 * msecs_to_jiffies(bond->params.arp_interval) + 1);
> +}
> +
> +/* Seed a slave that is not UP outside the up window. Give a slave that is
> + * UP a full arp_missed_max window.
> + */
> +static void bond_arp_seed_slave(struct bonding *bond, struct slave *slave)
> +{
> + unsigned long seed;
> + int i;
> +
> + if (slave->link == BOND_LINK_UP) {
> + slave->last_link_up = jiffies;
> + seed = slave->last_link_up;
> + } else {
> + seed = bond_arp_down_seed(bond);
> + }
> +
> + WRITE_ONCE(slave->last_rx, seed);
> + for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
> + WRITE_ONCE(slave->target_last_arp_rx[i], seed);
> + WRITE_ONCE(slave->last_tx, seed);
> +}
[Severity: Low]
Can a concurrent bond_arp_rcv() see the new last_rx together with the old
last_link_up here?
Before this patch, this pair was only written from bond_enslave(), before
netdev_rx_handler_register() published the slave. Through
bond_arp_reseed_slaves() it now also runs on live slaves.
In bond_option_arp_interval_set() with start == true, recv_probe can still
be bond_rcv_validate. Setting arp_interval=0 only clears it when
arp_validate was set, and the comment above bond_arp_reseed_slaves() notes
that recv_probe can still be set. For example:
arp_interval=X, arp_validate=0
arp_interval=0 (recv_probe stays bond_rcv_validate)
arp_validate=all
arp_interval=X (start, bond_arp_reseed_slaves())
At the same time, on a backup slave in softirq:
bond_arp_rcv()
else if (curr_active_slave &&
time_after(slave_last_rx(bond, curr_active_slave),
curr_active_slave->last_link_up))
bond_validate_arp(bond, slave, tip, sip);
last_link_up is written with a plain store here. bond_arp_rcv() and
bond_na_rcv() read it with a plain load. There is no barrier between that
store and the WRITE_ONCE() of last_rx.
On a weakly ordered CPU, or if the compiler moves the plain store later,
could the reader see the fresh last_rx with the stale last_link_up? It
would then trust an ARP/NA on a backup slave before the active slave got
any reply.
The practical effect looks small. Still, would it make sense to annotate
last_link_up with WRITE_ONCE()/READ_ONCE() and order the two stores, with a
matching barrier on the read side? KCSAN would also report the plain
last_link_up access as a data race.
> +
> +static void bond_arp_age(unsigned long *ts, unsigned long seed)
[ ... ]
> +/* Reseed the slaves when the ARP monitor starts. A slave that is UP and has
> + * carrier gets a full arp_missed_max window from now. The timestamps of the
> + * other slaves are only moved back, out of the up window. Moving them
> + * forward could make an active slave that is not UP look like it got a
> + * reply, see bond_arp_rcv().
[ ... ]
> +void bond_arp_reseed_slaves(struct bonding *bond)
> +{
> + unsigned long seed = bond_arp_down_seed(bond);
> + struct list_head *iter;
> + struct slave *slave;
> + int i;
> +
> + ASSERT_RTNL();
> +
> + bond_for_each_slave(bond, slave, iter) {
> + if (slave->link == BOND_LINK_UP &&
> + netif_carrier_ok(slave->dev)) {
> + bond_arp_seed_slave(bond, slave);
> + continue;
> + }
> +
> + bond_arp_age(&slave->last_rx, seed);
> + for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
> + bond_arp_age(&slave->target_last_arp_rx[i], seed);
> + bond_arp_age(&slave->last_tx, seed);
> + }
> +}
[Severity: Medium]
Should this test use bond_slave_is_up() instead of only
netif_carrier_ok()?
In bond_enslave() the seed comes right after dev_open() on the slave,
so the slave is known to be running there. bond_arp_reseed_slaves()
runs later, from bond_open() or bond_option_arp_interval_set(), and the
slave may have been brought administratively down in the meantime.
__dev_close_many() clears __LINK_STATE_START but leaves carrier alone
unless the driver's ndo_stop calls netif_carrier_off(), which dummy and
some other virtual or stacked devices don't do. The NETDEV_DOWN case in
bond_slave_netdev_event() doesn't change slave->link, no monitor runs
while the bond is down, and bond_open() doesn't reopen slaves. For
example, in active-backup mode with arp_interval set:
ip link set bond0 down
ip link set eth0 down (carrier stays on, slave->link stays UP)
ip link set bond0 up (bond_arp_reseed_slaves())
eth0 then passes this check and gets last_link_up = jiffies plus fresh
last_rx and last_tx. If it is the active slave, the grace check on
last_link_up in bond_ab_arp_inspect() keeps it UP for about
2.5 * arp_interval, and bond_loadbalance_arp_mon() keeps such a slave
for about missed_max intervals in the other modes. Meanwhile traffic
keeps going to a stopped device. bond_loadbalance_arp_mon() itself
won't send probes on such a slave, since it tests bond_slave_is_up().
bond_slave_is_up() checks netif_running() as well as
netif_carrier_ok(), and it's what bond_slave_can_tx() and the ARP
monitors already use. The commit message says requiring carrier keeps
a slave that went away while the bond was down from getting a grace
period; that doesn't hold for a stopped slave whose driver leaves
carrier on. Would bond_slave_is_up() be the right test here, or is
there a reason to give a stopped slave the UP seed?
[Severity: Low]
Is "out of the up window" accurate for every slave that takes the aging
path?
bond_time_in_interval() accepts:
return time_in_range(jiffies,
last_act - delta_in_ticks,
last_act + mod * delta_in_ticks + delta_in_ticks/2);
So a timestamp of jiffies - (2 * delta + 1) is outside only the mod=1
window. That is the test that brings a slave up.
Slaves with link == BOND_LINK_UP but no carrier also take the aging path.
For them, the stay-up tests use larger windows:
bond_ab_arp_inspect(), active slave: missed_max
bond_ab_arp_inspect(), backup slave: missed_max + 1
bond_loadbalance_arp_mon(): missed_max
The active-slave check in bond_ab_arp_inspect() is:
if (bond_is_active_slave(slave) &&
(!bond_time_in_interval(bond, last_tx, bond->params.missed_max) ||
!bond_time_in_interval(bond, last_rx, bond->params.missed_max))) {
With the default missed_max=2 and delta >= 2 ticks, the upper bound is
jiffies + delta/2 - 1. Suppose the monitor restarts soon after the last
rx/tx, from a quick bond down/up or arp_interval 0->X. A carrier-less
active slave whose timestamps were newer than the seed then survives the
first monitor run and goes down one interval later. A backup survives two
runs.
The commit message also says:
Requiring carrier keeps a slave that lost its link while the bond was
down from getting a grace period.
Such a slave still keeps up to (missed_max - 2) * delta + delta/2 of
window.
This isn't a regression compared with the old behaviour, which kept the
original, newer timestamps. Could the comment here, the one on
bond_arp_down_seed(), and the commit message say that the seed is only
outside the mod=1 up window?
[ ... ]
> @@ -4415,6 +4462,7 @@ static int bond_open(struct net_device *bond_dev)
> queue_delayed_work(bond->wq, &bond->mii_work, 0);
>
> if (bond->params.arp_interval) { /* arp interval, in milliseconds. */
> + bond_arp_reseed_slaves(bond);
> queue_delayed_work(bond->wq, &bond->arp_work, 0);
> WRITE_ONCE(bond->recv_probe, bond_rcv_validate);
> }
[Severity: Low]
This isn't a bug in the code, but should this patch have a Fixes: tag, or a
note that it is meant for net-next only?
The stale enslave-time seed is long-standing. When the monitor starts late,
the first bond_ab_arp_inspect() run gets past the grace check:
if (bond_time_in_interval(bond, slave->last_link_up, 2))
continue;
It then marks healthy UP slaves down before any probe goes out.
The earlier commit 9231c2b6f180 ("bonding: give a slave that starts UP a
full arp_missed_max window") explicitly left the late-start case out. It
went to net-next without a Fixes: tag, so leaving the tag off here may be
on purpose. Without a tag or a note, though, stable maintainers can't tell
which kernels are affected or whether to backport.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-bonding-arp-reseed-v2-0-de49c2a3bb1e%40well-founded.dev
Technical Details
Message-ID:
<179640115000.3146.17224906099933916576@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377479-linux-kernel-netdev=dewy.ruReferences:
<20261203-bonding-arp-reseed-v2-1-de49c2a3bb1e@well-founded.dev>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377479-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 1/2] bonding: reseed the ARP monitor when it starts Date: Fri, 04 Dec 2026 16:19:10 +0000 Organization: Usenet Network Message-ID: <179640115000.3146.17224906099933916576@kernel.org> References: <20261203-bonding-arp-reseed-v2-1-de49c2a3bb1e@well-founded.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2804517"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:109IRvfMNAt6xiEbjCdXnGl16rk= sha256:rKjqxuJycwBPksA6tioSeF5lyTRQbrTgFBlcbfZetS4= sha1:22tL07WRlusd6OYhIfu0HGoBJ/8= sha256:2Ua5VUorNxqF6Hk7TgsaIWBt8dWg5DgH3Q4EyIV7Q58= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 91B3A117C5E; Fri, 4 Dec 2026 19:19:33 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.641 X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4qwxB5yXH12f; Fri, 4 Dec 2026 19:19:29 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377479-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 416A2117C5D; Fri, 4 Dec 2026 19:19:18 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 3FE8F2A1E3; Fri, 4 Dec 2026 16:19:15 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796401152; b=lDWmSaOtYAuT2/yPc5nZDbc4i50G6Xqz8o1xOuAxt7IbYw1zRyPsKBsnnGahQLurcEOS CKK8OkgsgJor4FWLE7D9mlL/Zons2RN7KYkx690t8sJYBri8ksdLcnyo5M5R+N2DRz8bP 5v4IC7RcEf0ermLgqOFN6RsyyD2gncm+rT8RPoh7sCATwKHe8BAOcf9ji021JVVvUWJEW X2zlrRnyrPeJutA8pWkod/pjw9nz8y51MoYZKY4Eit2iMQ248KX7GjeTxgxzDPHdYW6i8 VknQVK5/mAfjKuEkGIg7ehfe0W8uZhcF4U8u+bWS0ll3pOZXy8Jvcen59R6SnXvutuQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796401152; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=Tb2HiX7jSaFIiyM/3o/x0z0gxD9Owh2ZKSPB7El3a9A=; b=oIrQQ2xfv18Jc6d9MGmvj7fxk6LxeKgXY/V9d6h/MmVBA71jSrEvGL6h3GbBh/f+4RC3 J9MzdbzCRyTfzmD4NUyp6SpmyDn3+pNBn9os9rElnJogUv887l2TCqebz2sz13kO2/1YP HPXfEgj8Ti5h83b4ZiA4c2VEFwh7ZigCL8W7qUtYCGydgGXkntfO8hRW8tWg9yPETHJz+ PiMlKqPdXaP0/Bnn9v39AijBlYniNQeEoy6u4+4Sen8nla2UZjwY3RMtKzQI+XAtRX88I NbVGJzl6nitq3C9qF/st3KrQ1LBpbJ8TkhAtr/Oz6jJokJlTcANVT//ry1hzoSpSvFQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DPMrfsDq; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97940606A335; Fri, 4 Dec 2026 16:19:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DPMrfsDq X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796401151; b=vFd6v5mC7JWC9Yu7H8cz8YvEyIuNZ5RnFS9JHCKINwFZH5LRu25pIs2avs8kW3ta59hQ Qe5dUqDVddMuWC9hb7PRgbO6bNRVLUypeYcwmQ9xTkzAiEDtZukp6odL/LBsjAPpdAUVi 6mc0i5EgoeEJTeVwBwpr1kbx9cPBbwEdaKlFov8iF4VDU/ib/btxBeS5KPEc/lOVPFfZR 9ryiUbjFv3Yj2i29ZS2CSnUEZQdVl2N5tG5vFqJt81ovS2hzBNMqVIRvR+/iQlkacfZUs tJPtdiyuRjklnqrk5G/7FzAdciGcdPKkYPM/lHK7JOnAFektroVsVp++aZu+K5sEGxA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796401151; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Tb2HiX7jSaFIiyM/3o/x0z0gxD9Owh2ZKSPB7El3a9A=; b=XKbd4TapvocpRNF3pEKI1yce2KNTnTjEf54Cm63ZDmvmVJSBx06o/Oetrrlm3CvEqEdM chfBD+VpM2Hk78iQboEwH/p85Sb82Ha+yPWfc6WnfHCV4AfwhUY2HxPrpgGACJcSIyZfo VsvOqQor3CsJRCALBEgddQSWouiTY3Uei4kuUdyhAWI15zxQgToRK7pxmLZN1xO1fIlL2 CnsKzgNoTW6MbDpju+lNOng/2IIn8ZqoZvZdJBU8+gOHNEGL9HcUjzmWueZU/FNvaAo2I oBswWY0d/1vnuIg6XkwgHl2OmB38fQtIRRbS2B8KtFExTNvs5N7ZUKHenXGjERgiQbA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DPMrfsDq; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B48E1606A322; Fri, 4 Dec 2026 16:19:11 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 795A91F000C2; Fri, 4 Dec 2026 16:19:10 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796401151; bh=Tb2HiX7jSaFIiyM/3o/x0z0gxD9Owh2ZKSPB7El3a9A=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=DPMrfsDqmepw/jIGiGtRgNPjjGL3k06d/Jfb/RT8mMGpZUmAATodvG3esWvTNxqWJ L7X582hxsPTT8dY4uU3k89qdGKYjq7WoBNjF0flhp7lhARc1nh0kDRY9QsuReTQ7iF CFm2DDBslW+iFN0ftCV+edcz9dTMdXiV0G4PEzvABbt6j5tVBP0ujuZHVH9hF5uTff K/ugCZjF/iDc1kDHRO9qOnhqYTaoaFe4tmmX+v3/zM5eEsQtI9q7ZbKXZ73hba6/n7 YlLPbjhuBOa06mzRY2a779P5SZQn+n1DTyyMYY/3sFZosadoEB5/iqGb/6uTFj6mia 4cag+NcjVASGA== X-Cc: jv@jvosburgh.net, andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, jbohac@suse.cz, edumazet@kernel.org, willemb@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, razor@blackwall.org, hangbin.liu@linux.dev, shuah@kernel.org X-In-Reply-To: <20261203-bonding-arp-reseed-v2-1-de49c2a3bb1e@well-founded.dev> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Received-Bytes: 18017