Re: [PATCH net] selftests: bonding: fix failover race in bond_options.sh prio test
From: Pin-yen Lin
Date: Thu Nov 19 2026 - 01:59:48 EST
Hi Hangbin,
On Wed, Nov 18, 2026 at 12:27 AM Hangbin Liu <hangbin.liu@xxxxxxxxx> wrote:
>
> Hi Pin-yen,
> On Tue, Nov 17, 2026 at 06:32:52PM -0800, Pin-yen Lin wrote:
> > Hi Hangbin,
> >
> > On Mon, Nov 16, 2026 at 11:26 PM Hangbin Liu <hangbin.liu@xxxxxxxxx> wrote:
> > >
> > > Hi Pin-yen,
> > > On Mon, Nov 16, 2026 at 05:30:28PM -0800, Pin-yen Lin wrote:
> > > > Thanks for the pointer, but I believe Bjoern's patch addresses a
> > > > different problem.
> > >
> > > I think they are the same issue, as you comment also said
> > >
> > > The ARP/NS monitor marks a slave down when it has received nothing for
> > > too long.
> >
> > This is the existing behavior of the bonding driver, and the prio test
> > uses it to check which backup slave takes over. Slaves being marked
> > down is not the root cause of the test failure. Instead, the root
> > cause is the ping replies described below.
>
> If the backup slaves are not mark down, we can active the correct slave
> based on the priority, right? I think that's the root cause. The ping testing
> is just for checking connectivity.
Yes, I get your point now. If we keep backup slaves up all the time,
the ping reply packets won't affect the test result.
>
> >
> > >
> > > >
> > > > Bjoern's patch keeps the traffic flowing so that idle slaves are kept
> > > > alive between the test steps. This patch fixes the case where the ping
> > > > replies from bond_check_connection() only arrive on the active slave
> > > > right before it is set down. The active slave's failure is then
> > > > detected one monitor interval late, when the backups have also timed
> > > > out.
> > >
> > > The reason is we set arp interval to 100ms, and slowwait also check every
> > > 100ms. If the backup slave down at the same check point, e.g.
> > >
> > > t=300 monitor: eth1 idle 230ms -> still up
> > > t=400 monitor: eth1 idle 330ms -> down
> > > eth2 idle 400ms -> down too
> > >
> > > The test failed.
> >
> > I don't think the slowwait interval makes a difference here.
> >
> > The ARP monitor decides which slave becomes active, and slowwait only
> > reads the result afterwards. The test expects the active slave and the
> > backups to time out in different monitor runs, so that a backup can
> > take over. In the example above, eth2 is already down when the bond
> > picks the new active slave, no matter when slowwait polls.
>
>
> My idea is, by extending the arp interval, there is a larger gap. e.g.
>
> t=300 monitor: eth1 still up
> ^^ slowwait check, incorrect active slave
> t=400 monitor: eth1 down
> eth2 still up, should become active slave
> t=500 monitor: eth1 down
> eth2 still up, active slave
> ^^ slowwait check, correct active
Shouldn't eth2 become the active slave at t=400? In the failing case,
eth2 is also down at t=400 so it can't be picked.
>
> > >
> > > >
> > > > The ARP requests triggered by Bjoern's ping are sent only about once
> > > > per second, which isn't frequent enough for this failure. I tested
> > > > Bjoern's patch and confirmed that it didn't fix the issue in our
> > > > testing environment. We also can't simply use arping instead because
> > > > iputils arping doesn't support sub-second intervals.
> > > >
> > > > If you're worried that the 200ms sleep is too short, would increasing
> > > > it to 0.5s or 1s work for you?
> > >
> > > It's not about the sleep time before setting active slave down. I'm afraid
> > > about the slowwait checking time. Even we sleep 1s, with arp interval 100,
> > > we still only have 100ms checking window. Before the window, the active slave
> > > is up, after the window, the backup slave also down. With a debug kernel, this
> > > time is a little tight.
> > >
> > > So, either we have some background arp traffic, or let's extend the arp
> > > interval to a larger one.
> > >
> > > What do you think?
> >
> > I agree that a 100ms ARP interval could be too short in environments
> > like a debug kernel.
> >
> > Background ARP traffic doesn't widen that window, though: it is sent
> > through the active slave, so once the active slave is set down,
> > nothing reaches the backups. It could only help with the ping reply
> > race if it were very frequent; Bjoern's patch triggers about one ARP
> > request per second and didn't fix the failures in our testing.
>
> For background traffic, I mean let the client send the arp requests,
> not from active slave of server. With arp_validate 0, the backup slaves
> will update last_rx and won't be down with idle.
I see. If the ARP requests are sent from the client, the backup slaves
can receive them and will stay up during the test.
>
> >
> > Increasing the ARP interval alone won't address the ping reply race,
> > but it should help in environments like a debug kernel. I'd prefer to
> > keep this patch focused on the ping reply race and send the ARP
> > interval change as a follow-up, but I can fold it into v2 if you
> > prefer.
>
> Doesn't extending the arp_interval (e.g. to 500) resolve your issue?
> Are you still able to reproduce the problem?
Yes, I can still reproduce this. Simply extending the arp_interval to
500 does not fix our issue. I still saw failures in 9 of 20 runs.
However, with arp_interval=500 and a background arping from the
client, the issue no longer reproduces. Both of them are needed:
arping only sends one request per second, which is enough for the
~1.75s backup timeout at arp_interval=500 but not for the ~350ms one
at arp_interval=100.
Bjoern's v1 patch sends the ARP requests from the server, so it
doesn't fix our issue. I can prepare a v2 to remove the sleep,
increase the arp_interval to 500, and add a background arping from the
client, unless Bjoern prefers to include the client-side arping in his
v2. How would you like to proceed?
>
> Thanks
> Hangbin
Regards,
Pin-yen