]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
scsi: storvsc: Handle PERSISTENT_RESERVE_IN truncation for Hyper-V vFC
authorLi Tian <litian@redhat.com>
Mon, 6 Apr 2026 01:53:44 +0000 (09:53 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 9 Apr 2026 01:52:06 +0000 (21:52 -0400)
commit9cf351b289fb2be22491fa3964f99126db67aa08
treeef154be4181d8c6bbb40170799443281c51f53ce
parent7aa0f56d4b48fb1a1ed3af11b53ba19901092e0a
scsi: storvsc: Handle PERSISTENT_RESERVE_IN truncation for Hyper-V vFC

The storvsc driver has become stricter in handling SRB status codes
returned by the Hyper-V host. When using Virtual Fibre Channel (vFC)
passthrough, the host may return SRB_STATUS_DATA_OVERRUN for
PERSISTENT_RESERVE_IN commands if the allocation length in the CDB does
not match the host's expected response size.

Currently, this status is treated as a fatal error, propagating
Host_status=0x07 [DID_ERROR] to the SCSI mid-layer. This causes
userspace storage utilities (such as sg_persist) to fail with transport
errors, even when the host has actually returned the requested
reservation data in the buffer.

Refactor the existing command-specific workarounds into a new helper
function, storvsc_host_mishandles_cmd(), and add PERSISTENT_RESERVE_IN
to the list of commands where SRB status errors should be suppressed for
vFC devices. This ensures that the SCSI mid-layer processes the returned
data buffer instead of terminating the command.

Signed-off-by: Li Tian <litian@redhat.com>
Reviewed-by: Long Li <longli@microsoft.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Link: https://patch.msgid.link/20260406015344.12566-1-litian@redhat.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/storvsc_drv.c