git: b37b2543a23b - main - ggate: Avoid dropping the GEOM topology lock in dumpconf
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 04 Oct 2024 15:57:09 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=b37b2543a23b44c78f6d78823dcfcedba46570db
commit b37b2543a23b44c78f6d78823dcfcedba46570db
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-04 14:53:57 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-10-04 15:56:34 +0000
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
---
sys/geom/gate/g_gate.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c
index 85c21406eda0..ecdcacff6707 100644
--- a/sys/geom/gate/g_gate.c
+++ b/sys/geom/gate/g_gate.c
@@ -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