🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23307

Re: [PATCH net 2/3] bonding: update slave array on link change for broadcast mode

#23307
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 03:15
154 lines
14330 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

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] The commit message says the patch makes the broadcast
  usable_slaves snapshot 'follow link transitions the same way balance-…
- [Medium] Because broadcast now publishes usable_slaves (the revert,
  which this patch relies on), switching a broadcast bond to balance-rr…
- [Low] The series ordering is not bisect-safe, and the dependency
  between the two patches is not recorded in tags.

--

bonding: update slave array on link change for broadcast mode

This adds a BOND_MODE_BROADCAST case to bond_miimon_link_change(), so the
usable_slaves snapshot is rebuilt on miimon link transitions. That keeps
the ignore_updelay decision in bond_miimon_inspect() in line with the
current slave link states. It depends on a revert of 45fc134bcfad so that
bond_set_slave_arr() publishes the array for broadcast.

> Add the broadcast case so the snapshot follows link transitions the
> same way balance-xor does. This needs the revert of 45fc134bcfad as
> a prerequisite: with 45fc134bcfad applied, bond_set_slave_arr()
> discards the refreshed array for broadcast.
>
> Fixes: e0caeb24f538 ("net: bonding: update the slave array for broadcast mode")

[Severity: Low]
Is the series order bisect-safe? The revert of 45fc134bcfad is applied
before this patch. On its own, it makes bond_set_slave_arr() publish
usable_slaves for broadcast again, but nothing rebuilds the array on
miimon link changes yet.

At that intermediate commit, a batch enslave with updelay leaves the new
slaves in BOND_LINK_BACK. The snapshot taken at enslave time then has
count == 0 and is never refreshed, so bond_miimon_inspect() ignores
updelay permanently. That is the bug 45fc134bcfad fixed.

If this patch went first, it would be a no-op under 45fc134bcfad, and
every commit in the series would be correct.

Also, this patch carries Fixes: e0caeb24f538, but the revert it depends on
has no Fixes: tag and no dependency annotation. 45fc134bcfad is likely
already in stable trees.

Would a tag-driven backport of only this patch leave the stale snapshot
behaviour unchanged there?

> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index d6675e87d06b6..b1efbdf597ec4 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -2780,6 +2780,7 @@ static void bond_miimon_link_change(struct bonding *bond,
>  		bond_alb_handle_link_change(bond, slave, link);
>  		break;
>  	case BOND_MODE_XOR:
> +	case BOND_MODE_BROADCAST:
>  		bond_update_slave_arr(bond, NULL);
>  		break;
>  	}

[Severity: Medium]
The commit message says the snapshot follows link transitions "the same
way balance-xor does". Does that hold outside the MII monitor?

balance-xor also rebuilds the array when the ARP load-balance monitor
changes a slave's link state. Broadcast is still left out there:

drivers/net/bonding/bond_main.c:bond_loadbalance_arp_mon() {
    ...
		if (slave_state_changed) {
			bond_slave_state_change(bond);
			if (BOND_MODE(bond) == BOND_MODE_XOR)
				bond_update_slave_arr(bond, NULL);
		}
    ...
}

Broadcast can use ARP monitoring, because bond_mode_uses_arp() only
excludes BOND_MODE_8023AD, BOND_MODE_TLB and BOND_MODE_ALB.
bond_slave_netdev_event() also skips broadcast, since
bond_mode_can_use_xmit_hash() is false for it. So under ARP monitoring,
the broadcast snapshot keeps the state from the last enslave or release.

bond_option_miimon_set() can switch the bond from ARP monitoring to
miimon at runtime. It zeroes arp_interval, cancels arp_work and queues
mii_work, but it does not rebuild the slave array. params.updelay
survives the switch.

For example, slaves enslaved with carrier under ARP monitoring are marked
BOND_LINK_UP and counted in usable_slaves. Later the ARP monitor marks
them BOND_LINK_DOWN, but the snapshot is not refreshed. Once miimon is
enabled, bond_miimon_inspect() sees usable_slaves->count != 0:

	if (usable_slaves && usable_slaves->count == 0)
		ignore_updelay = true;

Recovering slaves then wait out updelay even though the bond has no usable
link.

The reverse case also happens. If slaves are enslaved without carrier,
count == 0 and updelay is wrongly ignored. Either state lasts until the
first miimon commit reaches bond_miimon_link_change().

Should BOND_MODE_BROADCAST also be added to the condition in
bond_loadbalance_arp_mon()?

[Severity: Medium]
Now that broadcast publishes usable_slaves, does a switch from broadcast
to balance-rr leave a stale snapshot behind?

Releasing the last broadcast slave goes through __bond_release_one():

	if (bond_mode_can_use_xmit_hash(bond) ||
	    BOND_MODE(bond) == BOND_MODE_BROADCAST)
		bond_update_slave_arr(bond, slave);

This runs after bond_upper_dev_unlink(), so the slave list is already
empty. The result is a non-NULL usable_slaves with count == 0, and after
the revert that array is kept for broadcast.

Neither bond_option_mode_set() nor bond_close() resets the arrays.

In balance-rr, nothing rebuilds the array afterwards:

  - bond_enslave() and __bond_release_one() only rebuild for xmit-hash
    modes or broadcast
  - bond_open() and bond_slave_netdev_event() only rebuild when
    bond_mode_can_use_xmit_hash() is true
  - bond_miimon_link_change() has no BOND_MODE_ROUNDROBIN case

So in balance-rr, bond_miimon_inspect() would see count == 0 on every
pass. It would set ignore_updelay = true and force slave->delay to 0 for
every recovering slave.

Documentation/networking/bonding.rst section 13.1 says updelay is ignored
only when the bond has no active links.

In the baseline tree with 45fc134bcfad, broadcast never published
usable_slaves, so a switch from broadcast to balance-rr left it NULL. The
same missing reset on mode change already existed for a switch from
balance-xor to balance-rr.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-bond_broadcast_updelay-v1-0-188e5538d6ca%40kylinos.cn
Technical Details
Message-ID: <179574935712.3135.18271637068349106750@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372427-linux-kernel-netdev=dewy.ru
References: <20261126-bond_broadcast_updelay-v1-2-188e5538d6ca@kylinos.cn>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372427-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 2/3] bonding: update slave array on link change for
 broadcast mode
Date: Fri, 27 Nov 2026 03:15:57 +0000
Organization: Usenet Network
Message-ID: <179574935712.3135.18271637068349106750@kernel.org>
References: <20261126-bond_broadcast_updelay-v1-2-188e5538d6ca@kylinos.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="626049"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:CAwSBMaayg5Qk0araGtAoBxJfJg= sha256:5jsbYi3rWdDSCfzToohXEv7e+3kKrKRq9BnCHZ2TVK4=
	sha1:/uToz+GikQ+uxfU2DR/8qW3dhXE= sha256:mt2QOZAmVfkeDpEWqqUIp+FRbT+R2+JU6ezQYFqQdkw=
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 DFEE3125F10; Fri, 27 Nov 2026 06:16:18 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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] 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 x-_2ZNG7vNf4;
	Fri, 27 Nov 2026 06:16:14 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-372427-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 7697D125F0E; Fri, 27 Nov 2026 06:16:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id BC23E27451; Fri, 27 Nov 2026 03:16:01 +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=1795749359;
	b=kS5sJch8MByMO4kqL4S20H/QcTrPbUlWxSIBGcThcJTZO+8hszIbNUAgoUAS/sTVhdZ3
	 u89Fi34SGAS20VY4XUGLDrfgrIyj4ImpjVyH+f328cwE6IEVU8qdlLYeUlfULBwWCqRV6
	 E1joC/YawV4Pl6NJR7Itm5eskyThQjDAN/nWPPJ1oXnzT59CPcaYh7r0O0ATsA0VEziH3
	 1+w58IW74cAAtqGC/aqeO6g+S+7H1bbdJLarQtKuDeYp74O1NkogUJa4/mKYNB1/6A66o
	 Cr5F3cH0QTZZ4j17EvbFbeM6FKuuT7nQM97bf4LxLLFAYt+AQvivW3h3cGjHC6djZ0A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795749359;
	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=NexVNqunXuB86kwix8gWk/1ouKqyr5xdOMHE2DlkftI=;
	b=YGzNdxq7vPt86xjUVL+PYQDR5/JQB8mEjgPh/WUipdvUvD2o4ggYZRSgnhZcQC9WZlO7
	 twuzTvIT5Qa9h2n7er4M9bZ+yuPH5g1sLln6tsH4N8u7GkgbvwTRLLCFsJ/zbrb2VWBQl
	 vGWqhxaZz2Hs6pD3nnafUGDiIx0uNbcMsz1/eBZCxYz99sWVeUfR+V7BQyBcA2uIs5Fsd
	 Dj2nFBi5gHp5IgClPAastFWQ8XHUiU68bOr6XkoqeDGPOWxlv8uPNLQq75f03o0/kLAjp
	 YcMTnRS44pn+V8F+LYgoLN8+KhrDZsotKlTY2trI5FYinzj6sbCg36A90upQgt7fE3A==
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=iiZB8FMA;
	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 8225C606A339;
	Fri, 27 Nov 2026 03:15:59 +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=iiZB8FMA
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=1795749358;
	b=dlPP2FGiaL694cHVh6P0NWZ5/s+9B25JdXgrfqzUqmRBs4Msal9rQVP8CkqfIyGP7Epv
	 yyJJsRo8FsK8v+0ijJLjAOaaCfI+7EGR/jQRjr/aqwNS3LCv3Nf8/9kRl+rHucPKBZKDI
	 HGt0dz+TMjUDHXhSjB8iP1mfSLuPBwtSfnr6bTR+ytoru8UpHeY26KUFZXzFkPSIZMDtV
	 O5xqWe+uU9cpYmumqZw4d6ZLMcmbP+6v4kKyAxQqwo0q5H5j8ivECKESf8iEXafHLwM4N
	 mrPqjHFrS4tBCOgen2HWYgbtDIOSOAC+eh5/QVxTXq/NLPLTihYxJ5xKC+aDQ7vP6hg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795749358;
	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=NexVNqunXuB86kwix8gWk/1ouKqyr5xdOMHE2DlkftI=;
	b=ZrXV4J313aob1N4K5BHzC1sTvaQdKvSPO/UFiGXU9ZmbFSwe5txRaumqhMWZKXCWvyWf
	 u2pulZil/RP/+zWpB5OulXjLZYO/42I/JzrB119Bt5uf12jwbFs1Fziq6kqbIwE1fHLt7
	 bv602DifFgoYhgPvphWnOwNqAM8kXKOv7ngmnp1nVp1HO570S+QsIGm/wl8sYv0yoDFlK
	 KIr45FZcxLWX1dhXKUzS/uiqqGORZHMYPbzi0U7aNCbkKY6lMlR6yE+JbD0ITrcUYn9w5
	 L9oSD5/mtzWws2CbpelB/ICuuU9Fu6XEcK8sXg+MIQUL8Vr29c5qx9ctwiZGCHRk98Q==
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=iiZB8FMA;
	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 A13DE606A31C;
	Fri, 27 Nov 2026 03:15:58 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8554C1F000C1;
	Fri, 27 Nov 2026 03:15:57 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795749358;
	bh=NexVNqunXuB86kwix8gWk/1ouKqyr5xdOMHE2DlkftI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=iiZB8FMA2CQdQhDUAzXYjRX0rP1wEJj59/QpYimn4FkiMvOwgLy6uTUQoBi4A2VSA
	 Zf+cPc+JzQFngyusHuY98jcWQ4G6011HTQ9p6C/qiNjV+nEs1I3N6YARDjv8EML/Vn
	 O0McEyv4wY2vdo/4A/3++AAVJTHr53q0tmzzHVexEwrfMEeuS9Bd65w3tM7AmRkbWF
	 cW0kuTH8Lh3QUDIwVCEa2NoZPGdLYBAh1goi9FFoDlVidnrk6vtLyKWzjACNO1c4s4
	 CvBg2fTnsfjmUILqogEny97lQL8jKajxH7RAGQeRLvxZ8QkR8WVBrDxIAqV7l6+7pP
	 gJdgBg10jLanQ==
X-Cc: jv@jvosburgh.net, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 tonghao@bamaicloud.com, razor@blackwall.org, shuah@kernel.org,
 jiangjiehua1@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 linux-kselftest@vger.kernel.org
X-In-Reply-To: <20261126-bond_broadcast_updelay-v1-2-188e5538d6ca@kylinos.cn>
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