git: 23b44ad101ca - stable/14 - ggate: Avoid dropping the GEOM topology lock in dumpconf

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sat, 19 Oct 2024 12:56:27 UTC
The branch stable/14 has been updated by markj:

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

commit 23b44ad101ca2381186aa565b6c04a978c02a35e
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-04 14:53:57 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-10-18 12:27:13 +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
    
    (cherry picked from commit b37b2543a23b44c78f6d78823dcfcedba46570db)
---
 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 820f18ba220c..8d0e96fce124 100644
--- a/sys/geom/gate/g_gate.c
+++ b/sys/geom/gate/g_gate.c
@@ -330,7 +330,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));
@@ -454,9 +453,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