HomeFreeBSD

Delay GEOM disk_create() until CAM periph probe completes.

Description

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 90bcc81bc35e89049a94a12c259b0c53fcf7a299)

Details

Provenance
mavAuthored on Jul 14 2022, 7:38 PM
Reviewer
imp
Differential Revision
D35784: Delay GEOM disk_create() until CAM periph probe complete
Parents
rGbdd4dbb070ac: nvme: Print CRD, M and DNR status bits on errors.
Branches
Unknown
Tags
Unknown