Article View: linux.kernel.netdev
Article #17925Re: [PATCH net-next 4/6] bonding: factor out slave publication
From: netdev-bot+sashiko
Date: Tue, 17 Nov 2026 14:40
Date: Tue, 17 Nov 2026 14:40
158 lines
13909 bytes
13909 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The new comment on bond_publish_slave() in
drivers/net/bonding/bond_main.c says the helper will "Make the fully…
- [Low] The commit message calls bond_publish_slave() the "infallible
'commit point'", and the new comment says "All fallible steps of…
- [Low] The commit author is 'Hangbin Liu <hangbin.liu@linux.dev>', but
the only Signed-off-by is 'Hangbin Liu <liuhangbin@kylinos.cn>'.
--
bonding: factor out slave publication
This commit moves the final block of bond_enslave() into a new helper,
bond_publish_slave(). That block bumps slave_cnt, recomputes upper
features and carrier, adds NS maddrs, selects the active slave and
rebuilds the xmit slave arrays. The commit message calls this the
infallible commit point of the function and says there is no functional
change.
> Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
[Severity: Low]
This isn't a bug, but the Author address (hangbin.liu@linux.dev) does not
match the only Signed-off-by (liuhangbin@kylinos.cn). checkpatch reports
this as "From:/Signed-off-by: email address mismatch".
The same mismatch shows up on all six patches in the series, from
"bonding: check XDP support before enslaving changes state" through
"bonding: factor out bond_enslave_validate".
Could the addresses be made to match, or a From: line or Signed-off-by
be added for the author address?
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index f696a0d150346..bb37526834562 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1884,6 +1884,34 @@ void bond_xdp_set_features(struct net_device *bond_dev)
> xdp_set_features_flag(bond_dev, val);
> }
>
> +/* Make the fully prepared slave visible to the rest of the bonding
> + * code. All fallible steps of bond_enslave() must have completed
> + * before this runs: error paths never undo the publication.
> + */
[Severity: Low]
Is "visible to the rest of the bonding code" accurate here? By the time
bond_publish_slave() runs, bond_enslave() has already made the slave
reachable:
res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
new_slave);
...
res = bond_master_upper_dev_link(bond, new_slave, extack);
...
res = bond_sysfs_slave_add(new_slave);
bond_for_each_slave() is netdev_for_each_lower_private(). So once
bond_master_upper_dev_link() returns, every bond_for_each_slave() walker
sees the new slave. bond_xdp_set_features(), called just before this
helper, already iterates over it.
In the default (trunk) mode, the switch in bond_enslave() also publishes
the slave as curr_active_slave. That happens before several steps that
can still fail (netpoll, rx_handler, upper link, sysfs, promisc/allmulti,
XDP):
if (!rcu_access_pointer(bond->curr_active_slave) &&
new_slave->link == BOND_LINK_UP)
rcu_assign_pointer(bond->curr_active_slave, new_slave);
The err_detach path then undoes that:
if (rcu_access_pointer(bond->curr_active_slave) == new_slave) {
block_netpoll_tx();
bond_change_active_slave(bond, NULL);
bond_select_active_slave(bond);
unblock_netpoll_tx();
}
So "error paths never undo the publication" does not seem to hold either.
The helper actually commits slave_cnt and rebuilds derived state: upper
features, carrier, NS maddrs, active slave selection and the xmit slave
arrays. Between bond_master_upper_dev_link() and bond_publish_slave(),
list walkers see N+1 slaves while slave_cnt is still N.
Could the comment say that instead? Otherwise a later change might assume
the slave cannot be reached before this point.
> +static void bond_publish_slave(struct bonding *bond, struct slave *slave)
> +{
[ ... ]
> + /* broadcast mode uses the all_slaves to loop through slaves. */
> + if (bond_mode_can_use_xmit_hash(bond) ||
> + BOND_MODE(bond) == BOND_MODE_BROADCAST)
> + bond_update_slave_arr(bond, NULL);
> +}
[Severity: Low]
The commit message calls this the infallible "commit point", and the
comment above says all fallible steps must be done before this runs. Can
bond_update_slave_arr() still fail here?
drivers/net/bonding/bond_main.c:bond_update_slave_arr() {
...
usable_slaves = kzalloc_flex(*usable_slaves, arr, bond->slave_cnt);
all_slaves = kzalloc_flex(*all_slaves, arr, bond->slave_cnt);
if (!usable_slaves || !all_slaves) {
ret = -ENOMEM;
goto out;
}
...
}
On that path bond_set_slave_arr() is never called. Since skipslave is
NULL, nothing else makes up for it.
bond_publish_slave() returns void, so the error is dropped and the
slave_arr work is not re-armed. bond_slave_arr_handler() does re-arm it
when the same call fails:
ret = bond_update_slave_arr(bond, NULL);
rtnl_unlock();
if (ret) {
pr_warn_ratelimited("Failed to update slave array from WT\n");
goto err;
}
return;
err:
bond_slave_arr_work_rearm(bond, 1);
If the allocation fails, bond_enslave() still returns 0 and slave_cnt
has already been incremented. all_slaves and usable_slaves still hold
the old slave set. bond_xmit_broadcast() skips the new slave, and
XOR/3ad/TLB hashing never picks it, until some unrelated event rebuilds
the arrays.
The unchecked call was already inline in bond_enslave() before this
patch. What is new is the void helper and the comment that call it
infallible.
Should the comment and commit message be corrected? Or should the helper
call bond_slave_arr_work_rearm(bond, 1) when bond_update_slave_arr()
fails?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-bond_enslave_restruct-v1-0-364c549e78db%40kylinos.cn
Technical Details
Message-ID:
<179492641202.3136.3136612053973913945@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365351-linux-kernel-netdev=dewy.ruReferences:
<20261113-bond_enslave_restruct-v1-4-364c549e78db@kylinos.cn>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365351-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 4/6] bonding: factor out slave publication Date: Tue, 17 Nov 2026 14:40:12 +0000 Organization: Usenet Network Message-ID: <179492641202.3136.3136612053973913945@kernel.org> References: <20261113-bond_enslave_restruct-v1-4-364c549e78db@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2354786"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:YD+4sdQSkiDAbslARt6f/Jw1E6s= sha256:ncqJF0YHRmVacdPdG7ccoLCqztG/3DThFOzldN5tgBo= sha1:N3rE2T7DlQmYuvoONFS83oRN/Zc= sha256:/swU4Lf4LowO7xYNmtRRRHjtJIjReh3HmbV07V+/krE= 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 51722114FA8; Tue, 17 Nov 2026 17:41:24 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, 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 F5Y-whYL3Vda; Tue, 17 Nov 2026 17:41:19 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365351-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 65612114E55; Tue, 17 Nov 2026 17:41:07 +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 70C9B350A7; Tue, 17 Nov 2026 14:40:42 +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=1794926419; b=042FyaGJuVG27N+o0Ms1HibsLeH8vBlvqmHHux5B/47tCgCWUNI11hjRSm/S9gK7Iwvo BoUyp3A2BpiHmMuZT88bbBSODMSIxzjM7KzvNI68y1mp28blAtEu+IauMoYiOzjVWGiEh CIlzMPvvX8iCTU1ifxq6fEYeZSVCunt5GJgKfWtvAK2xLrlwdnTz7sjOD5KORNQp66wiT Pffu85OMyeJR5MO4ofMWraVtkWTdyF1ipgMKRU4MPfBseIu91P903G/gZpas6bsNK0tN+ e9du5Qu9S8DV2eAHSRWOKVxhQV14OZY8OSXcYpE0q+Y4Z92inG8Lv7qSVhGHjM7tiqA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794926419; 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=nHWPW4VdSrJJatZiB9Q4c/ci+6thEbpBkkx8hkoBRWU=; b=VpOdaN9+89HdgOTwNs4bZ57/gq1sptvbYGmLzJ/NSZg7tpc/Z9jwGbph2XTIqboXOPls Af257YCMrN39x2bNuWg2P6121HinTBCfg7nz/nRiaMIlw9O1ZwLIgjwGKu8LdR4aiVUd/ CdnvHYpzEhzrjFp3iDUCas7Yh3nAF8fF+9YkDt70625q84u2N1ZqweYlD+G+EebkRWls/ BRo+oWwaXhRkXFzvuA3Mev1lZZ/TBAgNQeuqkAFJ/lLNCincWXL1Cpj0P/kbi+B0qmF4c j6LH38wEZfBt0/tfNlx/U6JTLmRKVyTKp8GSl8ew5z6TobThdac7pEBgubrWsY+q47A== 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=TQo4pYXH; 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 46BED606A8A6; Tue, 17 Nov 2026 14:40:19 +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=TQo4pYXH 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=1794926413; b=ZkE2+/GA8dbq+en89B9l9bsWUENPVerOjOeiorzX5tioAD9s+oZy3tqmABmvxf1NN7yr sWBxrnr/CUNOtRVPQeesAyB2UhR7fhJ6n+PnIZ12VQQgNWZFau63nZZ+Lk2RN+80hLQuv 725eqRD25Od36kLzJ5puVzoaD/kheE8yUgWBfCAENuBp5/ni06fI4ctbChxagrGE81VCH uQ4sWqpT26GBXZ6tFjidXCldsJEh7GWdLk7DjJ9PB48kLu6PkJdewEEt2MzDU5mk+1wRV cVc82OsIaexVRelhOSZhE2PU+TpUbNujydpDOFw3T6BeOcFycIvJxKUHOU72Q4af/tA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794926413; 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=nHWPW4VdSrJJatZiB9Q4c/ci+6thEbpBkkx8hkoBRWU=; b=Bhush7YCTWbT0bES8hPuVVUbiAw92RJbe2yAaViSbZenu4ixtaUa1a+rzizsOnx263tO 65V0rD+IauDMCR5uYXJ+nDyHN9yLsQTmU2FvTDqD3cM7czT/Ae9YinRl0PHDjACzx6lZ2 c3GRRsACdl6C4ctvaMTutDbuMY1XYBGPuZAYbMc4wmnLeyvPN567dF4AUtj5mILKmD0z4 QniYb2r7tJiG+G1e0AJ/PUvCVwjZulGJCZhWG1lMNebx8ebGBZvfpbWDk5C3hFGyrm5XY bYhGu4Lx+nppFEZX58eCbdkRZzgGQ0urISm9QaNPulzx7e5Pi9tdDpC0F+00ReitpDA== 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=TQo4pYXH; 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 66E27606A31C; Tue, 17 Nov 2026 14:40:13 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74F2A1F000C4; Tue, 17 Nov 2026 14:40:12 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794926413; bh=nHWPW4VdSrJJatZiB9Q4c/ci+6thEbpBkkx8hkoBRWU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=TQo4pYXH1QA18aakyvBJ2E80M8uA19DCBq1jaTFZJk+q4y8LiRCDZNOSN7o9yoeuy B4GoG4r086s90D1ftPWB0MRn7PO67sIXCu98xwm85TXjUBN6eKRqhFsG/6gHgrXoMC 3dX2A7H5CFtkxgVi2ncHaY3vEB5wD1fm8Trshhn6mgmFc5JQ5Y4D3Vbt0T+vM7IiL2 xSCb55hFnexsvG8p6MFmaxYf81PvcIuh8fNbd+mVX43wo6B3WAaMfJd9NguG2h1Aau a7zsNdap1RWb9XQgqz4P3O4Y55vVk8BLXEQRWVqfXGOBT7sAo9y66ApSBNvlyfMscV yd8FGkCIhTqKw== X-Cc: jv@jvosburgh.net, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org X-In-Reply-To: <20261113-bond_enslave_restruct-v1-4-364c549e78db@kylinos.cn> X-sashiko-severity: Low 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