🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7442

Re: [PATCH net] bonding: fix missing down path on speed/duplex failure after FAIL->UP

#7442
From: netdev-bot+sashiko
Date: Mon, 26 Oct 2026 11:01
117 lines
12193 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

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

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] In 802.3ad mode, the new `link_prev_state == BOND_LINK_FAIL`
  branch in bond_miimon_commit()…

--

bonding: fix missing down path on speed/duplex failure after FAIL->UP

This patch adds a link_prev_state field that holds the slave link state
from just before the miimon commit. If bond_update_speed_duplex() fails
while committing a BOND_LINK_UP proposal for a slave that was in
BOND_LINK_FAIL, the slave now goes through the full down path, including
failover. That down path is moved into a new bond_miimon_slave_down()
helper.

> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 09aa45d71fabb..602ad697a9c2b 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c

[ ... ]

> @@ -2807,10 +2828,21 @@ static void bond_miimon_commit(struct bonding *bond)
>  			err = bond_update_speed_duplex(slave);
>  			netdev_unlock_ops(slave->dev);
>  			if (err && bond_needs_speed_duplex(bond)) {
> -				slave->link = BOND_LINK_DOWN;
>  				if (net_ratelimit())
>  					slave_warn(bond->dev, slave->dev,
>  						   "failed to get link speed/duplex\n");
> +				/* Coming from FAIL, the slave is still in
> +				 * use and may be curr_active_slave, so take
> +				 * it through the full down path. Coming from
> +				 * DOWN/BACK, it was never brought up, so just
> +				 * revert it to DOWN.
> +				 */
> +				if (slave->link_prev_state == BOND_LINK_FAIL) {
> +					if (bond_miimon_slave_down(bond, slave))
> +						do_failover = true;
> +					continue;
> +				}

[Severity: Medium]
In 802.3ad mode, does BOND_LINK_FAIL always mean the slave is still in use?

bond_slave_netdev_event() also sets BOND_LINK_FAIL on NETDEV_UP and
NETDEV_CHANGE, and that has nothing to do with downdelay:

drivers/net/bonding/bond_main.c:bond_slave_netdev_event() {
    ...
		if (bond_update_speed_duplex(slave) &&
		    BOND_MODE(bond) == BOND_MODE_8023AD) {
			if (slave->last_link_up)
				slave->link = BOND_LINK_FAIL;
			else
				slave->link = BOND_LINK_DOWN;
		}
    ...
}

The last_link_up check passes for any slave that has ever been up. That
includes a slave that is currently BOND_LINK_DOWN and not in use.

Take an 802.3ad slave in BOND_LINK_DOWN with a non-zero last_link_up. Its
carrier comes back, but the driver still reports unknown speed or duplex,
for example during slow autoneg:

bond_slave_netdev_event(NETDEV_CHANGE)
    slave->link = BOND_LINK_FAIL
bond_mii_monitor()
    bond_miimon_inspect()
        case BOND_LINK_FAIL, link_state up -> propose BOND_LINK_UP
    slave->link_prev_state = slave->link    /* BOND_LINK_FAIL */
    bond_commit_link_state()                /* link = BOND_LINK_UP */
    bond_miimon_commit()
        bond_update_speed_duplex() fails again
        bond_miimon_slave_down()

Before this patch, this path only set slave->link back to BOND_LINK_DOWN.

With this patch, a slave that was already down now gets:

- link_failure_count incremented again
- BOND_SLAVE_NOTIFY_NOW link-state events
- a "link status definitely down, disabling slave" message, with no rate
  limiting
- a call to bond_3ad_handle_link_change(slave, BOND_LINK_DOWN), which
  reruns aggregator selection and rebuilds the slave array

This can happen again on every NETDEV_CHANGE that arrives while the slave
is down. Could "Link Failure Count" in /proc/net/bonding keep rising for a
port that never actually came back up?

The new comment ("Coming from FAIL, the slave is still in use") and the
commit message only cover the downdelay case. Should this branch also
check that the slave was really in use, instead of relying only on
link_prev_state?

>  				slave->link = BOND_LINK_DOWN;
>  				continue;
>  			}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261022103821.89552-1-timur.stukan.linux%40gmail.com
Technical Details
Message-ID: <179301247732.3134.17655450292431284280@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351838-linux-kernel-netdev=dewy.ru
References: <20261022103821.89552-1-timur.stukan.linux@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351838-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] bonding: fix missing down path on speed/duplex
 failure after FAIL->UP
Date: Mon, 26 Oct 2026 11:01:17 +0000
Organization: Usenet Network
Message-ID: <179301247732.3134.17655450292431284280@kernel.org>
References: <20261022103821.89552-1-timur.stukan.linux@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1289520"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:o8dFxdLNo5Kyvdhxh3SL/CoyqOA= sha256:V/+BiFvNTgFnETdWonoYeJL+nGp89uVCebtL3xBkEZg=
	sha1:iy4yBPH8uX2/7vyaf1cVNdCVewE= sha256:ePPEPLuCuZ73WMJ52PhvGnqtlpt+TODue4GRFnRJatY=
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 2A321125B99; Mon, 26 Oct 2026 14:04:15 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.738
X-Spam-Status: No, score=-3.738 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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 VQMrGgp_PW6m;
	Mon, 26 Oct 2026 14:04:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-351838-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 36CEB125B98; Mon, 26 Oct 2026 14:04:03 +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 5C87326EC1; Mon, 26 Oct 2026 11:01:26 +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=1793012485;
	b=lCcwv3Im3ZziyB1mJ2NU773uRf46IlEV9lCwDTPGJXIuQSjDuDZFEn8qQCF3DjZeO2F0
	 Z2wlylTzZos5qG8LJoZsoTR7GB6wtVPEPMMEsJgMN4rC55S6Y9y/LwY5Swrtw5p0MO2qm
	 CnlMdbMVUTEtUU2v2QfVbMYtb3H+Nxon45mWSQhogMhvM4pdKl5R1m9uZcNFaDRwZNWwO
	 2MU/MEOhsH3z7MmqgDVNxHzka/kodR9HYc0+7Q8SNWz6DxaRfK6PPxlv2jjtiG8yOaU/y
	 Wi+j5bXeTpN/dEToumUidl512CodPtt14WDeL4ZIzxoDo1uadvuD4eUWMzW0yb/3Oyg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793012485;
	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=uOCQRgnNFMnRtqKzyVZEFxukrVshewCOyvp/mheAzcM=;
	b=gjwvyhGr0J8QO6MxNvGpp2DdPlxxMur69j4fDB+861xx3qY43qrfIrS4T2FNbzm3cwLY
	 2MTMgJlXtpbqoSWmwzZ3rdyR+XgBPOhyyjAPzuTNTVfVROyCSRRQ3E8X93nkXoKRWnH+X
	 WMzBDjZEndlZjCexf40/zqEJpnvj4vUh8sjUC1OUosVunaBtSd9FzKgoiU2fN7FKjj3yT
	 JIj/QVXPV47kc5mglh3OYTaeaCpAgixGiTfBRFyq+npUH8SmVdfa682/71oNGDsKEwmec
	 E1vVqhmytz1svctXVjrTOnKmqTQgqQ3B4ut4d0IODOngYum3iPUF8vXlRHeqyGbIA0w==
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=L860xw4h;
	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 F0DCD606A323;
	Mon, 26 Oct 2026 11:01:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L860xw4h
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=1793012479;
	b=D6M+2kDezUHra+VrurepP3bi+mfl6YT8Am7TSpSwyLyW7gGKr5C7PELliq0tnm3sAIJK
	 RRCABVDDyA3A+4pFMtaK0KyWDEtMJ94T5sxDKf1TBa5twxiQaykndbueoUA1vvzeCDGeL
	 0gCN9ytnDsD0kndiyUxrePH9AFm2K9/no6LIVoaaWDxHeabQdNkfj6uhyQ0zvxzRv9dhd
	 6Fxu7UILXgB+bIvt8UpVG2XfA4iW3Aq1XAttttdGe5DB9GhRmDCWNtxzEK0KYo5NSeS7C
	 f2rfaPDLtGj6k9eV8ProXYn9b5ZzbUxL8s2cg77kDVOppTAlz6IyA2pv19vimqSQvPw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793012479;
	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=uOCQRgnNFMnRtqKzyVZEFxukrVshewCOyvp/mheAzcM=;
	b=geuIWUTMAevpDJEOrh8Xnue8aOLaydqCQ1QVquTcZ/HIZdMKOMZS2Ytu9qHrGKAaVwf/
	 JUBv8waSiNW6I/cQaZ5pCSH0joma9hyBMvRHfH7PVEp+i1ZijIX6f4R52Buuo99dQ5uKN
	 m9qxCI8+vS1ZAeNQ3Nyor05/D02tNWRQOEUDag08Rt0Ww8PfMkmkVQSzOPg5jexDms89/
	 HdZRkHl7PAZFu2YQyFm6QM3k6hYL7kuQp8Lj2xwmSnKxRZx4GUVpO2aO85XZYHOqbdoGe
	 aIYhM8GtkAgiecxUmT1Iu0JwYlL0UhQ0CwHf5bAOesnbuZbRhb/tHMP1wZyd1ItCRZg==
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=L860xw4h;
	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 C7084606A31A;
	Mon, 26 Oct 2026 11:01:18 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C62C91F01825;
	Mon, 26 Oct 2026 11:01:17 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793012478;
	bh=uOCQRgnNFMnRtqKzyVZEFxukrVshewCOyvp/mheAzcM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=L860xw4h7CqAIueEtJC8dBtyeVLOrv5gGO2MJIvzXjzFvu03xHZu6P/i2SNsyA139
	 LjDeFq4soz5aiLpmxz728hpXECdD1PH4phHPaBrNmwJDjAEbLhQvBK8VpGueUp/XoQ
	 qYfDB11utqD8ys/7VEaU0QwiNciA3n7xXxpg+ndr/3gEMDnO9zSouOgHI4/N55gZOv
	 hJ75tgExIez/zSB+9AzoUgRgV5ZRHzCtKYo4ZcGERhnQMf06MAKGpXb7X6UYrekaPD
	 UmE4254yc9AvH+Bj8nAsey01jC11wHAAYJXQ6heXUm50c1TTfApci43R/UEMM++VhC
	 Zzhl1qg7SvLJA==
X-Cc: netdev@vger.kernel.org, liuhangbin@gmail.com, fmancera@suse.de,
 jv@jvosburgh.net, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261022103821.89552-1-timur.stukan.linux@gmail.com>
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