Article View: linux.kernel.netdev
Article #15584Re: [PATCH net] selftests: bonding: fix failover race in bond_options.sh prio test
From: Hangbin Liu
Date: Fri, 13 Nov 2026 05:23
Date: Fri, 13 Nov 2026 05:23
132 lines
13653 bytes
13653 bytes
Hi Pin-yen,
On Wed, Nov 11, 2026 at 05:46:18PM -0800, Pin-yen Lin wrote:
> The prio test intermittently fails in the arp_ip_target and
> ns_ip6_target variants:
>
> TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL]
> Current active slave is eth0 but not eth2
>
> The ARP/NS monitor marks a slave down when it has received nothing for
> too long. With arp_interval 100 and the default arp_missed_max, that is
> about 250ms for the active slave (eth1) and 350ms for a backup slave
> (eth0, eth2). Every 100ms, eth1 sends a probe: eth1 receives the reply,
> and eth0/eth2 receive a copy forwarded by the gateway bridge. Once eth1
> is down, its probes reach no one and no slave receives anything, so
> eth1 normally times out first and the new active slave is picked by
> prio:
>
> t=0 probe: eth1 gets the reply, eth0/eth2 get a copy
> t=10 test sets eth1 down
> t=300 monitor: eth1 idle 300ms -> down
> eth0/eth2 idle 300ms -> up, eth2 picked by prio
>
> But the test takes eth1 down right after bond_check_connection(), whose
> ping replies only arrive on eth1:
>
> t=0 probe: eth1 gets the reply, eth0/eth2 get a copy
> t=70 ping reply on eth1 only
> t=85 test sets eth1 down
> t=300 monitor: eth1 idle 230ms -> still up
> t=400 monitor: eth1 idle 330ms -> down
> eth2 idle 400ms -> down too
>
> eth2 can then no longer be picked. eth0 becomes the active slave if it
> happened to receive some other packet (e.g. an MLD report), otherwise
> whichever slave comes back first does. With primary_reselect 1 or 2,
> the bond keeps eth0 even after eth2 comes back.
>
> Before taking the active slave down, wait two monitor intervals
> (200ms), so that at least one more probe is sent after the last ping
> reply and all slaves last received that probe. The miimon variants do
> not need the wait, but the extra delay is negligible.
I'm afraid the waiting time is too strict, especially with a debug kernel
since delays can happen.
Bjoern is also fixing[1] this issue by pinging a non-existent neighbor to
keep traffic flowing. Would you like to test whether that works for you?
[1] https://lore.kernel.org/netdev/20261104142018.552135-1-doebel@amazon.de/
Thanks
Hangbin
>
> Hit in our CI on GCE VMs (4 of 51 runs); the test only uses veth. On
> the same VMs, 7 of 30 loops of the prio tests failed without this
> change, and 20 of 20 loops passed with it.
>
> Fixes: 481b56e0391e ("selftests: bonding: re-format bond option tests")
> Signed-off-by: Pin-yen Lin <treapking@google.com>
> ---
>
> .../drivers/net/bonding/bond_options.sh | 26 ++++++++++++++++---
> 1 file changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/bonding/bond_options.sh b/tools/testing/selftests/drivers/net/bonding/bond_options.sh
> index 187b478d0ddf..16c1c2d97005 100755
> --- a/tools/testing/selftests/drivers/net/bonding/bond_options.sh
> +++ b/tools/testing/selftests/drivers/net/bonding/bond_options.sh
> @@ -13,6 +13,24 @@ ALL_TESTS="
>
> lib_dir=$(dirname "$0")
> source ${lib_dir}/bond_topo_3d1c.sh
> +
> +# The ARP/NS monitor marks a slave down when it has received nothing for too
> +# long: ~250ms for the active slave and ~350ms for a backup slave with
> +# arp_interval 100. The backups only receive the copies of the active slave's
> +# probes that the gateway bridge forwards, but the active slave also gets the
> +# replies to the pings in bond_check_connection(). If the active slave goes
> +# down right after such a reply, it times out in the same monitor run as the
> +# backups, and the new active slave is then not picked by prio. Wait two
> +# monitor intervals, so that at least one more probe is sent and all slaves
> +# last received that probe.
> +bond_link_down()
> +{
> + local slave=$1
> +
> + sleep 0.2
> + ip -n ${s_ns} link set "$slave" down
> +}
> +
> c_maddr="33:33:ff:00:00:10"
> g_maddr="33:33:ff:00:02:54"
>
> @@ -97,12 +115,12 @@ prio_test()
> check_active_slave eth1
>
> # active slave should be the higher prio slave
> - ip -n ${s_ns} link set $active_slave down
> + bond_link_down $active_slave
> check_active_slave eth2
> bond_check_connection "fail over"
>
> # when only 1 slave is up
> - ip -n ${s_ns} link set $active_slave down
> + bond_link_down $active_slave
> check_active_slave eth0
> bond_check_connection "only 1 slave up"
>
> @@ -134,7 +152,7 @@ prio_test()
> ;;
> "2")
> check_active_slave "$pre_active_slave"
> - ip -n ${s_ns} link set $active_slave down
> + bond_link_down $active_slave
> bond_check_connection "pre_active slave down"
> check_active_slave "eth1"
> ;;
> @@ -153,7 +171,7 @@ prio_test()
> check_err $? "eth3 prio is not -50"
> check_active_slave "eth1"
>
> - ip -n ${s_ns} link set $active_slave down
> + bond_link_down $active_slave
> check_active_slave "eth0"
> bond_check_connection "change slave prio"
> fi
> --
> 2.56.1.703.gf848ed807c-goog
>
> base-commit: 665b4149e91b781a71bce8637c3a4d7d64dba05f
Technical Details
Message-ID:
<avaewOJD7tX1UYfE@fedora>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362427-linux-kernel-netdev=dewy.ruReferences:
<20261112014942.2946303-1-treapking@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362427-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] selftests: bonding: fix failover race in bond_options.sh prio test Date: Fri, 13 Nov 2026 13:23:40 +0800 Organization: Usenet Network Message-ID: <avaewOJD7tX1UYfE@fedora> References: <20261112014942.2946303-1-treapking@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1273247"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:6SB9FxUNAGannRNJR2olEjjpFqs= sha256:+E5e6Z8gclnYyL+hPiiN8OyCV3ucC93CT7k6rU+r+PQ= sha1:uH8rMN0D41vTfYEACe3ANS8iUpg= sha256:mI7MIur0JnXRCiPoHgVehCd1Aaq8gKU0cFDRB/TRUzM= Content-Disposition: inline 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 582F811448C; Fri, 13 Nov 2026 08:46:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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 (1024-bit key) header.d=linux.dev 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 hkdUbWTmFpTj; Fri, 13 Nov 2026 08:45:56 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-362427-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id D5BAE114464; Fri, 13 Nov 2026 08:45:48 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 874E161F5DB; Fri, 13 Nov 2026 05:24:10 +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=1794547441; b=b4Bzdgid/mYGkxy7BPEf204VoiFFkTgLYwyPs4A8hnQWmJldTsZoV13iNsM76EQCRMdC nSZ/t0oA9AwBPpFASzDS/lv4znutoaS9LkZ0GeLmb2h7ytLW9Wn8vXki9Mcq9Ib1Q+NxL +BtaWWX4Cx9DAJdtjmCUXP7tO68gqEXrWVgD4NGUv1+rfeS5sLbdPaavC0hrHbEqHD49f OVtIAijVy3YTnJX68yNMk7z+1MbQC7L0xFucT+VCeHKy2NJmad0NvqPWQ22J5fGkf4ftX AThWVj3fRnLW2DFjhC57+6cbF4Gf0kAK8AnJXGsk2YIFFSTjrZEkb7VRWgSO77Kpxlg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794547441; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=yNTGZ6HgL81sFOWpVaEuJsNuoy6BFVlh8YpAP+qxSFg=; b=2ZkbdinXSgIgT/QyHUxl/ayRr7RBtkRXFoy57HaZO2qI/WOnk09YLXJ/Q2bHRNZpcsyU +QFamzo8T1HWnNHidlyiAygGdHXK07nObimEDmqYtu6P3fHv3QBtXilEXwgFj6ba1C2gB xuCYmtGF+y6p2QIztfv3UoZ8n9FGwoHpQGnFLsQ49OAmi4FyFnaeYpeevZBjUd05Wdi6n DM/8dFxWcUV8P5eprD8h75vE7ngt/SH7fGQzeWTU+aJjQjWkWFR++LwTU9Yd0ua6ymjnZ lBR+TzQcuKqNF6ih8Spexz1k5PUaM2aQC00h16qct1pXCLTRbT0bch8jrQegbxA1ckA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=WSU2j+Xi; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 3AB5F606A32D; Fri, 13 Nov 2026 05:24:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=WSU2j+Xi X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.60 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794547435; b=Q2Mo5YI+Nckg0hdpdNn5IcjxmH7XkUYl1Q86NihWqOwomciPwOmzKlc9a0NoSbxAlrJb +RAq29BNuYfywqhy2gFdZ7la8WMd+8GEQnY+Eea2s8/JqlAksceBaG6gHKf2sfmvrzk9e eIGceQbz2FzRC8XP8h6mvR228VPTSS09fh0eY/A5oW29JHRZQgvOKJWlIU4UUqxXE+xRs 5TVtKO1tbwSGXb99AvtnyssGo9gzAECqUoAPicdBJlHnPpAZElLNxIA04Ntb0oNNfD94p NTzrLl6UIcrAWcXw9a/7dh1xnFy0gPof/TjE0Qy00tYU5R8R1izZP6Jb/llBIQbpaNg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794547435; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=yNTGZ6HgL81sFOWpVaEuJsNuoy6BFVlh8YpAP+qxSFg=; b=ZUfwU9HzZzsMy5U7bp+SiXYjuc1+vE8q7zXtJ2XgqSwDI4G75zwKq2EdBSdGCh8swFWF cBS2n6qYD7qy8drc2wwc22zK9h3rW/5yIy5rxhUNjqRFjj3q1c5jSmpMAOvUReN2eZJAq fZRvg8lNFaWFbVribkJ9PTzqdHLgr4ftCnr74bN+hOgz1CM2EBSVdhRI8/31QzSZdNYVy cvPrDQZG6gN6jBEuFdHIH9FISfVreGM0Vq9MdwOGWFRphgpHhc5nJUIEYQsEkhBKWwpfc /sPUtSGTP+pBei9+G3phEXN7jacPRYut5gJaPS1nFZH4OH8EoPRGBPC468epW1wrlww== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=WSU2j+Xi; arc=none smtp.remote-ip=95.215.58.60 X-Received: from mta1.migadu.com (out-60.mta1.migadu.com [95.215.58.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 205D0606A327 for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 05:23:53 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 205D0606A327 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=nETvmS/sv7eeoqiH4Fl5bLT2YjeMLjjRzngwbfcsPpQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1794547432; v=1; x=1795152232; b=WSU2j+XiebmLYrNp9W9Shr5UPkdngXfFdyHjKmniofOAAt9fjXRSY/iLichbVRWTGtxXt4sX JjF8L2FBD87afjzdgjU2hpsIt5msQMEFDF3XYfxRr3xsBch1EXFD4KrFVOt28WP9y+gU1GWuzpL hmqlSe7b3YL16n2sSPstAkf4= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta12.migadu.com with ESMTPS id 4c369a421a5cba68; Fri, 13 Nov 2026 05:23:51 +0000 X-Mizu-Trace-ID: 4c369a421a5cba68 X-Migadu-Flow: FLOW_OUT X-Cc: Jay Vosburgh <jv@jvosburgh.net>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Bjoern Doebel <doebel@amazon.de>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>, netdev@vger.kernel.org, Matthieu Baerts <matttbe@kernel.org>, linux-kernel@vger.kernel.org, Jonathan Toppins <jon.toppins+linux@gmail.com>, linux-kselftest@vger.kernel.org, Hangbin Liu <liuhangbin@gmail.com> 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-In-Reply-To: <20261112014942.2946303-1-treapking@google.com>