Re: [PATCH net-next v4 03/14] net: bridge: mcast: avoid sleeping on bridge-down

From: Ido Schimmel

Date: Mon Mar 09 2026 - 08:43:51 EST


On Sat, Mar 07, 2026 at 05:45:37AM +0100, Linus Lüssing wrote:
> @@ -4111,29 +4123,40 @@ void br_multicast_ctx_init(struct net_bridge *br,
> seqcount_spinlock_init(&brmctx->ip6_querier.seq, &br->multicast_lock);
> #endif
>
> - timer_setup(&brmctx->ip4_mc_router_timer,
> - br_ip4_multicast_local_router_expired, 0);
> - timer_setup(&brmctx->ip4_other_query.timer,
> - br_ip4_multicast_querier_expired, 0);
> - timer_setup(&brmctx->ip4_other_query.delay_timer,
> - br_multicast_query_delay_expired, 0);
> - timer_setup(&brmctx->ip4_own_query.timer,
> - br_ip4_multicast_query_expired, 0);
> + timer_setup(&brmctx->ip4_mc_router_timer, NULL, 0);
> + timer_setup(&brmctx->ip4_other_query.timer, NULL, 0);
> + timer_setup(&brmctx->ip4_other_query.delay_timer, NULL, 0);
> + timer_setup(&brmctx->ip4_own_query.timer, NULL, 0);
> #if IS_ENABLED(CONFIG_IPV6)
> - timer_setup(&brmctx->ip6_mc_router_timer,
> - br_ip6_multicast_local_router_expired, 0);
> - timer_setup(&brmctx->ip6_other_query.timer,
> - br_ip6_multicast_querier_expired, 0);
> - timer_setup(&brmctx->ip6_other_query.delay_timer,
> - br_multicast_query_delay_expired, 0);
> - timer_setup(&brmctx->ip6_own_query.timer,
> - br_ip6_multicast_query_expired, 0);
> + timer_setup(&brmctx->ip6_mc_router_timer, NULL, 0);
> + timer_setup(&brmctx->ip6_other_query.timer, NULL, 0);
> + timer_setup(&brmctx->ip6_other_query.delay_timer, NULL, 0);
> + timer_setup(&brmctx->ip6_own_query.timer, NULL, 0);
> #endif
> +
> + /* for non-vlan multicast timer callbacks:
> + * they are set on br_multicast_open() instead
> + */
> + if (!vlan)
> + return;
> +
> + spin_lock_bh(&br->multicast_lock);
> + br_multicast_reset_timer_cbs(&vlan->br_mcast_ctx);
> + spin_unlock_bh(&br->multicast_lock);

It wasn't clear to me why special treatment is needed for the per-VLAN
context and it's not explained in the commit message either. I suspect
that it's a workaround for the fact that br_multicast_reset_timer_cbs()
is only called for VLANs that were actually added on the bridge (i.e.,
"brentry"), whereas the "other query" timers are used even when the VLAN
entry is not used for filtering.

This is related to my comment on patch #9 and it should probably be
handled in br_multicast_toggle_vlan(), which is called both when
multicast snooping is toggled on a specific VLAN and on all the VLANs
(i.e., "mcast_vlan_snooping").

> }