1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-21 07:15:49 +00:00

ggate: Avoid dropping the GEOM topology lock in dumpconf

In general it's not safe to drop the topology lock in these routines, as
GEOM assumes that the mesh will be consistent during traversal.
However, there's no reason we can't hold the topology lock across calls
to g_gate_release().  (Note that g_gate_hold() can be called with the
topology lock held.)

PR:		238814
MFC after:	2 weeks
This commit is contained in:
Mark Johnston 2024-10-04 14:53:57 +00:00
parent d9fe718287
commit b37b2543a2

View File

@ -329,7 +329,6 @@ static void
g_gate_release(struct g_gate_softc *sc)
{
g_topology_assert_not();
mtx_lock(&g_gate_units_lock);
sc->sc_ref--;
KASSERT(sc->sc_ref >= 0, ("Negative sc_ref for %s.", sc->sc_name));
@ -453,9 +452,7 @@ g_gate_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
sc->sc_queue_size);
sbuf_printf(sb, "%s<ref>%u</ref>\n", indent, sc->sc_ref);
sbuf_printf(sb, "%s<unit>%d</unit>\n", indent, sc->sc_unit);
g_topology_unlock();
g_gate_release(sc);
g_topology_lock();
}
static int