git: c11b70191511 - main - geom: Push GEOM sysinit ordering to after devctl

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Wed, 26 Mar 2025 14:58:14 UTC
The branch main has been updated by jhibbits:

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

commit c11b701915116bf512f3d77dfdac7a867f51ca0a
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2025-03-26 14:43:14 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2025-03-26 14:55:24 +0000

    geom: Push GEOM sysinit ordering to after devctl
    
    GEOM depends on devctl being initialized, as it uses devctl_notify,
    which assumes that devctl is initialized already.  However, if devctl is
    not initialized yet, the devctl UMA zone is NULL, resulting in a panic.
    Thus far this has worked seemingly by linker luck that lets devctl sort
    before GEOM, but this is not guaranteed.  Instead, enforce the ordering
    by pushing GEOM to third place, explicitly ordering it after
    devctl_init, which is ordered second.
    
    Since g_raid wants to initialize after GEOM, push that to fourth place
    as well.
    
    Sponsored by:   Juniper Networks, Inc.
---
 sys/geom/geom.h        | 2 +-
 sys/geom/raid/g_raid.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index 0eb6775701fd..dcd6f793f9f7 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -417,7 +417,7 @@ g_free(void *ptr)
 	static moduledata_t name##_mod = {			\
 		#name, g_modevent, &class			\
 	};							\
-	DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND);
+	DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
 
 int g_is_geom_thread(struct thread *td);
 
diff --git a/sys/geom/raid/g_raid.c b/sys/geom/raid/g_raid.c
index 6938491d696c..a483622d14a5 100644
--- a/sys/geom/raid/g_raid.c
+++ b/sys/geom/raid/g_raid.c
@@ -2571,5 +2571,5 @@ static moduledata_t g_raid_mod = {
 	g_modevent,
 	&g_raid_class
 };
-DECLARE_MODULE(g_raid, g_raid_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
+DECLARE_MODULE(g_raid, g_raid_mod, SI_SUB_DRIVERS, SI_ORDER_FOURTH);
 MODULE_VERSION(geom_raid, 0);