git: a8b9a05d3cad - main - if_bridge(4): don't sleep under epoch(9) in destruction

From: Pouria Mousavizadeh Tehrani <pouria_at_FreeBSD.org>
Date: Tue, 17 Mar 2026 08:13:11 UTC
The branch main has been updated by pouria:

URL: https://cgit.FreeBSD.org/src/commit/?id=a8b9a05d3cad3bdcb9008232c9172a1aeffbe9fd

commit a8b9a05d3cad3bdcb9008232c9172a1aeffbe9fd
Author:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-03-16 12:53:45 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-03-17 08:11:29 +0000

    if_bridge(4): don't sleep under epoch(9) in destruction
    
    bridge tries to run callout_drain(9) twice under epoch
    during destruction.
    once for bridge_timer, which is not required to be under epoch.
    second time for the BSTP callout, which is already disabled
    earlier inside bridge_delete_member.
    
    Reviewed by: glebius, zlei
    MFC after: 2 weeks
    Differential Revision: https://reviews.freebsd.org/D55876
---
 sys/net/if_bridge.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 0cd71a20fa35..d69fe85453f9 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -953,8 +953,6 @@ bridge_clone_destroy(struct if_clone *ifc, struct ifnet *ifp, uint32_t flags)
 
 	BRIDGE_UNLOCK(sc);
 
-	NET_EPOCH_ENTER(et);
-
 	callout_drain(&sc->sc_brcallout);
 
 	BRIDGE_LIST_LOCK();
@@ -962,6 +960,8 @@ bridge_clone_destroy(struct if_clone *ifc, struct ifnet *ifp, uint32_t flags)
 	BRIDGE_LIST_UNLOCK();
 
 	bstp_detach(&sc->sc_stp);
+
+	NET_EPOCH_ENTER(et);
 #ifdef ALTQ
 	IFQ_PURGE(&ifp->if_snd);
 #endif