Re: [PATCH RESEND net-next v4 1/4] net: bonding: use workqueue to make sure peer notify updated in lacp mode
From: Paolo Abeni <pabeni@redhat.com>
Date: 2026-01-15 10:46:47
On 1/12/26 3:40 AM, Tonghao Zhang wrote:
+static void bond_peer_notify_handler(struct work_struct *work)
+{
+ struct bonding *bond = container_of(work, struct bonding,
+ peer_notify_work.work);
+
+ if (!rtnl_trylock()) {
+ bond_peer_notify_work_rearm(bond, 1);
+ return;
+ }
+
+ bond_peer_notify_reset(bond);
+
+ rtnl_unlock();
+ return;I'm sorry for nit picking, but this is a bit ugly: please remove the `return;` statement above.
quoted hunk ↗ jump to hunk
@@ -1279,19 +1306,17 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) bond_do_fail_over_mac(bond, new_active, old_active); + call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, bond->dev); + if (netif_running(bond->dev)) { - bond->send_peer_notif = - bond->params.num_peer_notif * - max(1, bond->params.peer_notif_delay); - should_notify_peers = - bond_should_notify_peers(bond); - } + bond_peer_notify_reset(bond); - call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, bond->dev); - if (should_notify_peers) { - bond->send_peer_notif--; - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, - bond->dev); + if (bond_should_notify_peers(bond)) { + bond->send_peer_notif--; + call_netdevice_notifiers( + NETDEV_NOTIFY_PEERS, + bond->dev);
Since a repost is needed, plase move this if block to a separate helper to reduce indentation and avoid bad formatting. Thanks, Paolo