在 2026/11/4 17:31, Eric Dumazet 写道:
Le mer. 4 nov. 2026 à 07:44, Yun Lu [off-list ref] a écrit :
quoted
From: Yun Lu <redacted>
During 802.3ad bring-up, packets can be dropped despite carrier being up
and LACP having enabled ports for distribution. This was observed on a
machine in real use.
The LACP worker enables ports before queuing slave_arr_work to rebuild
usable_slaves. The transmit path keeps using that array, which can
remain empty while the array worker retries rtnl_trylock(). Unrelated
RTNL contention can therefore prolong the packet loss.
Rebuild the arrays directly from the LACP worker after releasing
mode_lock and RCU, and remove the retry worker's RTNL dependency. Retain
delayed work to retry allocation failures.
Use a per-bond mutex to serialize array allocation, filling and
publication, and walk the lower list under RCU. Keep upper link/unlink
notifications outside this mutex. Exclude new slaves from both arrays
until all fallible setup, including XDP propagation, succeeds and
commits array_ready under the same mutex. This keeps concurrently linked
slaves from overrunning arrays sized from an earlier slave count.
Release completes its final rebuild or allocation-failure skip under the
mutex before waiting for RCU readers and freeing a slave.
Retry failed final updates for running bonds. Also rebuild broadcast
arrays on open and retry failed open updates. Protect the
peer-notification array reader with RCU now that RTNL no longer excludes
writers. Updating the shared arrays also covers XDP and lower-device
queries without changing their selection rules.
Tests used an RTNL holder, userspace LACP peers, slow notifiers and
test-only allocation failures under KASAN and lockdep to check recovery,
concurrent member changes and teardown. All 16 bonding selftests passed.
Fixes: ee6377147409 ("bonding: Simplify the xmit function for modes that use xmit_hash")
Signed-off-by: Yun Lu <redacted>
---
I think this should target net-next. The rtnl_trylock() retry
has been there since v3.18, and this patch adds a new locking scheme
across enslave, release, open, uninit and the 3ad worker. With the
Fixes: tag it would be backported to every stable tree, which seems
risky for an issue that only shows up under RTNL contention. Please
resend against net-next without the Fixes: tag, and keep the problem
description in the changelog.
Hi Eric,
Thanks for the review and the routing guidance.
I will resend against net-next as v6, without the Fixes tag and with
the problem description kept in the changelog, rebased on current
net-next.
---
Thanks,
Yun Lu
pw-bot: cr