The list of ports in configuration path shall be protected by locks,

epoch shall be used only for fast path.  Thus use LAGG_XLOCK() in
lagg_[un]register_vlan.  This fixes sleeping in epoch panic.

PR:		240609
This commit is contained in:
Gleb Smirnoff 2020-12-08 16:46:00 +00:00
parent 2c9ac5855b
commit e1074ed6a0

View File

@ -471,17 +471,16 @@ lagg_proto_portreq(struct lagg_softc *sc, struct lagg_port *lp, void *v)
static void
lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
{
struct epoch_tracker et;
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
if (ifp->if_softc != arg) /* Not our event */
return;
NET_EPOCH_ENTER(et);
LAGG_XLOCK(sc);
CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
NET_EPOCH_EXIT(et);
LAGG_XUNLOCK(sc);
}
/*
@ -491,17 +490,16 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
static void
lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
{
struct epoch_tracker et;
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
if (ifp->if_softc != arg) /* Not our event */
return;
NET_EPOCH_ENTER(et);
LAGG_XLOCK(sc);
CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
NET_EPOCH_EXIT(et);
LAGG_XUNLOCK(sc);
}
static int