freebsd-dev/sys/cam/scsi
Alexander Motin 90bcc81bc3 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
2022-07-14 16:17:36 -04:00
..
scsi_all.c CAM: List few missed opcodes. 2021-12-31 11:48:03 -05:00
scsi_all.h
scsi_cd.c Delay GEOM disk_create() until CAM periph probe completes. 2022-07-14 16:17:36 -04:00
scsi_cd.h
scsi_ch.c
scsi_ch.h cam(4): Fix a few typos in source code comments 2022-02-06 13:45:47 +01:00
scsi_da.c Delay GEOM disk_create() until CAM periph probe completes. 2022-07-14 16:17:36 -04:00
scsi_da.h
scsi_enc_internal.h Delay GEOM disk_create() until CAM periph probe completes. 2022-07-14 16:17:36 -04:00
scsi_enc_safte.c ses: minor cleanup 2022-01-19 12:08:03 -07:00
scsi_enc_ses.c ses: minor cleanup 2022-01-19 12:08:03 -07:00
scsi_enc.c Delay GEOM disk_create() until CAM periph probe completes. 2022-07-14 16:17:36 -04:00
scsi_enc.h ses: minor cleanup 2022-01-19 12:08:03 -07:00
scsi_iu.h
scsi_message.h
scsi_pass.c ses: don't panic if disk elements have really weird descriptors 2022-06-23 11:19:20 -06:00
scsi_pass.h
scsi_pt.c
scsi_pt.h
scsi_sa.c Update sa(4) comments and man page after review. 2022-01-18 13:50:31 -05:00
scsi_sa.h
scsi_ses.h cam(4): Remove a double word in a source code comment 2022-04-09 10:13:59 +02:00
scsi_sg.c
scsi_sg.h
scsi_targ_bh.c
scsi_target.c
scsi_targetio.h
scsi_xpt.c Fix bd82711aff serial number trailing spaces removal. 2022-05-09 10:30:04 -04:00
smp_all.c
smp_all.h