diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 6e8f0a1c51ea..582d5a66df59 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -1092,7 +1092,7 @@ bstp_tick(void *arg) struct bridge_softc *sc = arg; struct bridge_iflist *bif; - BRIDGE_LOCK(sc); + BRIDGE_LOCK_ASSERT(sc); #if 0 LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { @@ -1141,8 +1141,6 @@ bstp_tick(void *arg) if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) callout_reset(&sc->sc_bstpcallout, hz, bstp_tick, sc); - - BRIDGE_UNLOCK(sc); } void diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 06cd8f037b43..b35f7aa1d288 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -439,8 +439,8 @@ bridge_clone_create(struct if_clone *ifc, int unit) /* Initialize our routing table. */ bridge_rtable_init(sc); - callout_init(&sc->sc_brcallout, 0); - callout_init(&sc->sc_bstpcallout, 0); + callout_init_mtx(&sc->sc_brcallout, &sc->sc_mtx, 0); + callout_init_mtx(&sc->sc_bstpcallout, &sc->sc_mtx, 0); LIST_INIT(&sc->sc_iflist); @@ -498,6 +498,9 @@ bridge_clone_destroy(struct ifnet *ifp) BRIDGE_UNLOCK(sc); + callout_drain(&sc->sc_brcallout); + callout_drain(&sc->sc_bstpcallout); + mtx_lock(&bridge_list_mtx); LIST_REMOVE(sc, sc_list); mtx_unlock(&bridge_list_mtx); @@ -1212,10 +1215,10 @@ bridge_init(void *xsc) if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; + BRIDGE_LOCK(sc); callout_reset(&sc->sc_brcallout, bridge_rtable_prune_period * hz, bridge_timer, sc); - BRIDGE_LOCK(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; bstp_initialization(sc); BRIDGE_UNLOCK(sc); @@ -1988,9 +1991,9 @@ bridge_timer(void *arg) { struct bridge_softc *sc = arg; - BRIDGE_LOCK(sc); + BRIDGE_LOCK_ASSERT(sc); + bridge_rtage(sc); - BRIDGE_UNLOCK(sc); if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) callout_reset(&sc->sc_brcallout,