From: Hangbin Liu <hangbin.liu@linux.dev>
To: ramses@well-founded.dev
Cc: Jay Vosburgh <jv@jvosburgh.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jiri Bohac <jbohac@suse.cz>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] bonding: fix initial last_rx vs ARP-monitor slack window
Date: Fri, 28 Aug 2026 10:49:59 +0800 [thread overview]
Message-ID: <apD3VyaIOmMlv6kK@fedora> (raw)
In-Reply-To: <20260827-bonding-last-rx-v2-1-7c3833822c23@well-founded.dev>
On Thu, Aug 27, 2026 at 01:44:42PM +0200, Ramses de Norre via B4 Relay wrote:
> From: Ramses de Norre <ramses@well-founded.dev>
>
> Commit f31c7937c254 ("bonding: start slaves with link down for ARP
> monitor") initialises a freshly enslaved port's last_rx to
> jiffies - (arp_interval + 1) so that it does not "immediately cause
> fake detection of 'up' state". At the time, the comparison was a plain
> <= arp_interval and the value was just stale enough.
>
> Commit da210f559019 ("bonding: add some slack to arp monitoring time
> limits"), four months later, added a +arp_interval/2 slack term to
> every comparison (now bond_time_in_interval()) but did not widen the
> init to match. Since then, bond_time_in_interval(bond, last_rx, 1) is
> true for the first ~arp_interval/2 after enslavement even though no
> packet has been received: the upper bound is last_rx + 1.5*delta and
> last_rx was set to jiffies - delta - 1.
>
> If the ARP monitor tick lands in that window, bond_ab_arp_inspect()
> proposes the slave UP. If the slave is the configured primary,
> bond_ab_arp_commit() sets do_failover and the still-armed
> force_primary in bond_choose_primary_or_current() makes it the active
> slave regardless of primary_reselect. ARP validation as the active
> slave then fails (the link has not actually received anything; on
> SFP+ ports the PHY is often still negotiating) and the bond falls back
> to the backup. With primary_reselect=failure, force_primary has now
> been spent and the bond stays on the backup until something else
> triggers a reselect.
Can we set primary_reselect to always or better to avoid this? If you prefer
to using the primary slave.
>
> Reproducer:
>
> ip link add bond0 type bond mode active-backup arp_interval 1000 \
> arp_validate all arp_ip_target 192.0.2.1 \
> primary eth0 primary_reselect failure
> # eth0: SFP+ (slow link-up), eth1: RJ45 (fast link-up)
> ip link set eth0 master bond0
> ip link set eth1 master bond0
> ip link set bond0 up
> # bond0 lands on eth0 via force_primary, ARP-fails it before the
> # SFP+ has carrier, falls to eth1, and stays there.
>
> Initialise last_rx (and the per-target array, and last_tx) to two full
> intervals in the past so it is outside the slack window from the
> start.
Is this trying to init the backup slave down by default?
Thanks
Hangbin
prev parent reply other threads:[~2026-08-28 2:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 11:44 Ramses de Norre via B4 Relay
2026-08-28 2:49 ` Hangbin Liu [this message]
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=apD3VyaIOmMlv6kK@fedora \
--to=hangbin.liu@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jbohac@suse.cz \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ramses@well-founded.dev \
/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
all inboxes | Powered by JetHome®