The NVMe reservation model is closely patterned after SCSI Persistent
Reservations, so support NVMe devices through the existing persist
subcommand rather than adding a transport-specific subcommand. The
persist subcommand now dispatches on the device protocol, in the same
way the identify subcommand does.
The SCSI syntax is unchanged. For NVMe devices, the -i modes all map
to the Reservation Report command (read_full_status requests the
extended data structure, which contains 128-bit Host Identifiers), and
the -o service actions map to the corresponding NVMe reservation
operations: register, register_ignore, reserve, preempt,
preempt_abort, release and clear, plus two NVMe-only actions,
unregister and replace. The reservation type names for -T are shared
between SCSI and NVMe. A new -c option gives explicit control over
the NVMe Persist Through Power Loss State; -p is equivalent to
-c enable. SCSI-only options return an error for NVMe devices.
Tested against a PASCARI X200 series SSD (reservation capabilities:
WR_EX, PTPL, IEKEY13): register, reserve, release, replace,
unregister, -c enable/disable (Persist Through Power Loss State change
verified in the report output), reservation report, and the error
paths. register_ignore is rejected by drives that implement NVMe 1.3
IEKEY semantics, as expected. SCSI persist against a da(4) device is
unchanged.
sbin/camcontrol/nvres.c:
New file, the NVMe reservation backend for the persist subcommand.
sbin/camcontrol/camcontrol.c:
Dispatch the persist subcommand to scsipersist() or nvmepersist() based on the device protocol.
sbin/camcontrol/camcontrol.h:
Add the nvmepersist() prototype.
sbin/camcontrol/Makefile:
Add nvres.c to the build.
sbin/camcontrol/camcontrol.8:
Document NVMe support in the persist subcommand section, and note the differences from SCSI where they occur.
Co-authored-by: Reid Linnemann <reidl@spectralogic.com>
Sponsored by: Spectra Logic
Depends on D59532
Depends on D59533
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>