opnsense-src/sys/geom
Alexander Motin 4ced2678ac Delay GEOM disk_create() until CAM periph probe completes.
Before this patch CAM periph drivers called both disk_alloc() and
disk_create() same time on periph creation.  But then prevented disks
from opening until the periph probe completion with cam_periph_hold().
As result, especially if disk misbehaves during the probe, GEOM event
thread, triggered to taste the disk, got blocked on open attempt,
potentially for a long time, unable to process other events.

This patch moves disk_create() call from periph creation to the end of
the probe. To allow disk_create() calls from non-sleepable CAM contexts
some of its duties requiring memory allocations are moved either back
to disk_alloc() or forward to g_disk_create(), so now disk_alloc() and
disk_add_alias() are the only disk methods that require sleeping.  If
disk fails during the probe disk_create() may just be skipped, going
directly to disk_destroy().  Other method calls during that time are
just ignored.  Since GEOM may now see the disks after CAM bus scan is
already completed, introduce per-periph boot hold functions. Enclosure
driver already had such mechanism, so just generalize it.

Reviewed by:	imp
MFC after:	1 month
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D35784

(cherry picked from commit 90bcc81bc3)
2022-08-15 13:37:58 -04:00
..
bde gbde: replace malloc_last_fail with a kludge 2020-11-12 20:20:57 +00:00
cache GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
concat GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
eli geli: Add a chicken switch for unmapped I/O 2022-07-19 09:52:00 -04:00
gate geom_gate: Distinguish between classes of errors 2022-03-05 13:52:24 +11:00
journal GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
label glabel: Set G_CF_DIRECT_SEND/RECEIVE for taste consumer. 2022-02-10 19:50:46 -05:00
linux_lvm GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
mirror g_mirror: don't fail reads while losing next-to-last disk 2022-02-17 08:46:14 +02:00
mountver Make g_attach() return ENXIO for orphaned providers; update various 2020-10-18 16:24:08 +00:00
multipath GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
nop kerneldump: remove physical argument from d_dumper 2022-06-27 16:32:06 -03:00
part gpart(8): Fix two typos in source code comments 2022-04-02 15:33:36 +02:00
raid kerneldump: remove physical from dump routines 2022-06-27 16:32:06 -03:00
raid3 GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
shsec GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
stripe GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
uzip Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
vinum GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
virstor geom(4): Fix a common typo in a source code comment 2022-06-10 14:25:26 +02:00
zero geom(4): Mark all sysctls as CTLFLAG_MPSAFE. 2021-08-24 21:53:17 -04:00
geom.h GEOM: Introduce partial confxml API 2022-05-10 21:20:25 -04:00
geom_bsd_enc.c sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
geom_ccd.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_ctl.c GEOM: Introduce partial confxml API 2022-05-10 21:20:25 -04:00
geom_ctl.h Define a constant for the maximum number of GEOM_CTL arguments. 2019-02-20 17:07:08 +00:00
geom_dbg.h GEOM: Reduce unnecessary log interleaving with sbufs 2019-08-07 19:28:35 +00:00
geom_dev.c ses: don't panic if disk elements have really weird descriptors 2022-07-24 09:41:18 -06:00
geom_disk.c Delay GEOM disk_create() until CAM periph probe completes. 2022-08-15 13:37:58 -04:00
geom_disk.h Delay GEOM disk_create() until CAM periph probe completes. 2022-08-15 13:37:58 -04:00
geom_dump.c GEOM: Introduce partial confxml API 2022-05-10 21:20:25 -04:00
geom_event.c Adjust function definitions in geom_event.c to avoid clang 15 warnings 2022-07-29 20:28:08 +02:00
geom_flashmap.c Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
geom_flashmap.h geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_int.h GEOM: Introduce partial confxml API 2022-05-10 21:20:25 -04:00
geom_io.c Adjust function definition in geom_io.c to avoid clang 15 warnings 2022-07-29 20:30:01 +02:00
geom_kern.c GEOM: Relax direct dispatch for GEOM threads. 2022-02-10 19:50:45 -05:00
geom_map.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_redboot.c geom_map and geom_redboot: Remove unused ctlreq handler. 2020-07-26 22:30:01 +00:00
geom_slice.c Pass BIO_SPEEDUP through all the geom layers 2020-01-17 01:15:55 +00:00
geom_slice.h sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
geom_subr.c Adjust function definition in geom_subr.c to avoid clang 15 warnings 2022-07-29 20:31:13 +02:00
geom_vfs.c geom_vfs: Pre-allocate event for g_vfs_destroy. 2022-04-29 13:50:03 -07:00
geom_vfs.h sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
notes