freebsd-skq/sys/geom
royger 35bdc8c699 geom: fix initialization order
There's a race between the initialization of devsoftc.mtx (by devinit)
and the creation of the geom worker thread g_run_events, which calls
devctl_queue_data_f. Both of those are initialized at SI_SUB_DRIVERS
and SI_ORDER_FIRST, which means the geom worked thread can be created
before the mutex has been initialized, leading to the panic below:

 wpanic: mtx_lock() of spin mutex (null) @ /usr/home/osstest/build.135317.build-amd64-freebsd/freebsd/sys/kern/subr_bus.c:620
 cpuid = 3
 time = 1
 KDB: stack backtrace:
 db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe003b968710
 vpanic() at vpanic+0x19d/frame 0xfffffe003b968760
 panic() at panic+0x43/frame 0xfffffe003b9687c0
 __mtx_lock_flags() at __mtx_lock_flags+0x145/frame 0xfffffe003b968810
 devctl_queue_data_f() at devctl_queue_data_f+0x6a/frame 0xfffffe003b968840
 g_dev_taste() at g_dev_taste+0x463/frame 0xfffffe003b968a00
 g_load_class() at g_load_class+0x1bc/frame 0xfffffe003b968a30
 g_run_events() at g_run_events+0x197/frame 0xfffffe003b968a70
 fork_exit() at fork_exit+0x84/frame 0xfffffe003b968ab0
 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe003b968ab0
 --- trap 0, rip = 0, rsp = 0, rbp = 0 ---
 KDB: enter: panic
 [ thread pid 13 tid 100029 ]
 Stopped at      kdb_enter+0x3b: movq    $0,kdb_why

Fix this by initializing geom at SI_ORDER_SECOND instead of
SI_ORDER_FIRST.

Sponsored by:		Citrix Systems R&D
Reviewed by:		kevans, markj
Differential revision:	https://reviews.freebsd.org/D20148
2019-05-06 09:48:34 +00:00
..
bde
cache
concat Add a missing return statement to g_concat_kernel_dump(). 2019-02-26 18:30:51 +00:00
eli Implement automatic online expansion of GELI providers - if the underlying 2019-04-03 23:57:37 +00:00
gate
journal Normally when an attempt is made to mount a UFS/FFS filesystem whose 2018-12-06 00:09:39 +00:00
label Support device-independent labels for geom_flashmap slices. 2019-03-24 19:11:45 +00:00
linux_lvm
mirror gmirror: Relocate DEVICE_FLAGS to adjacent lines 2019-01-23 16:44:21 +00:00
mountver
multipath
nop gnop(8): Nopify configuration as a kernel dump device 2019-04-22 03:25:49 +00:00
part Revert revision 254095 2019-03-05 04:15:34 +00:00
raid Use g_handleattr() to reply to GEOM::candelete queries. 2019-01-02 15:52:16 +00:00
raid3
sched
shsec
stripe Extend stripeoffset and stripesize of GEOMs from u_int to off_t 2018-10-27 16:14:42 +00:00
uzip Modularize xz. 2019-02-26 19:55:03 +00:00
vinum
virstor
zero
geom_bsd_enc.c
geom_bsd.c
geom_ccd.c
geom_ctl.c Define a constant for the maximum number of GEOM_CTL arguments. 2019-02-20 17:07:08 +00:00
geom_ctl.h Define a constant for the maximum number of GEOM_CTL arguments. 2019-02-20 17:07:08 +00:00
geom_dev.c Call delist_dev() before destroy_dev_sched_cb(). 2019-04-24 19:56:02 +00:00
geom_disk.c
geom_disk.h Extend stripeoffset and stripesize of GEOMs from u_int to off_t 2018-10-27 16:14:42 +00:00
geom_dump.c Extend stripeoffset and stripesize of GEOMs from u_int to off_t 2018-10-27 16:14:42 +00:00
geom_event.c
geom_flashmap.c Support device-independent labels for geom_flashmap slices. 2019-03-24 19:11:45 +00:00
geom_flashmap.h Support device-independent labels for geom_flashmap slices. 2019-03-24 19:11:45 +00:00
geom_fox.c
geom_int.h
geom_io.c stack(9): Drop unused API mode and comment that referenced it 2019-03-15 22:39:55 +00:00
geom_kern.c
geom_map.c
geom_mbr_enc.c
geom_mbr.c
geom_redboot.c Extend stripeoffset and stripesize of GEOMs from u_int to off_t 2018-10-27 16:14:42 +00:00
geom_slice.c
geom_slice.h
geom_subr.c Extend stripeoffset and stripesize of GEOMs from u_int to off_t 2018-10-27 16:14:42 +00:00
geom_sunlabel_enc.c
geom_sunlabel.c
geom_vfs.c
geom_vfs.h
geom_vol_ffs.c
geom.h geom: fix initialization order 2019-05-06 09:48:34 +00:00
notes