SCSI: Fix Persistent Reservation (PR) NVMe->SCSI conversion of HostID to Transport ID - #4383
SCSI: Fix Persistent Reservation (PR) NVMe->SCSI conversion of HostID to Transport ID#4383Alex Landau (alandau) wants to merge 2 commits into
Conversation
… to Transport ID Just copying it, as was done before, is wrong since HostID is 8 or 16 bytes (random-ish) and TransportID is 24 bytes (and has structure). This change follows the [T10 SPC-3 spec](https://www.t10.org/ftp/t10/document.02/02-246r1.pdf) for the format of the TransportID retaining backward compatibility for NVMe HostIDs that start with `06 00 00 00`. This last part can happen when the NVMe HostID itself is incorrectly derived from an underlying SCSI TransportID by just copying bytes.
There was a problem hiding this comment.
🟡 Changes recommended
The new SAS TransportID construction currently risks populating reserved bytes for 16-byte HostIDs, which can produce a non-conformant TransportID and should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates SCSI Persistent Reservation (PR) “REPORT FULL STATUS” handling to correctly convert NVMe HostID values into a structured SCSI TransportID (SAS protocol identifier), rather than copying HostID bytes directly.
Changes:
- Constructs a fixed-size SAS TransportID buffer and emits it in the FULL STATUS descriptor.
- Adds a compatibility heuristic for NVMe HostIDs that appear to already contain the SAS TransportID prefix.
- Updates the descriptor’s
additional_descriptor_lengthto match the emitted TransportID size.
File summaries
| File | Description |
|---|---|
| vm/devices/storage/scsidisk/src/reservation.rs | Builds a SAS TransportID for REPORT FULL STATUS and adjusts descriptor length/output accordingly. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
The changes are small, internally consistent (length fields match emitted bytes), and the updated tests align with the corrected on-wire format.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
Just copying it, as was done before, is wrong since HostID is 8 or 16 bytes (random-ish) and TransportID is 24 bytes (and has structure).
This change follows the T10 SPC-3 spec for the format of the TransportID retaining backward compatibility for NVMe HostIDs that start with
06 00 00 00. This last part can happen when the NVMe HostID itself is incorrectly derived from an underlying SCSI TransportID by just copying bytes.Before:
After: