Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: virtio_scsi: Drop DID_TARGET_FAILURE use

DID_TARGET_FAILURE is internal to the SCSI layer. Drivers must not use it
because:

1. It's not propagated upwards, so SG IO/passthrough users will not see an
error and think a command was successful.

2. There is no handling for it in scsi_decide_disposition() so it results
in entering SCSI error handling.

virtio_scsi gets this when something like qemu returns
VIRTIO_SCSI_S_TARGET_FAILURE. It looks like qemu returns that error code
if a host OS returns it, but this shouldn't happen for Linux since we never
propagate that error to userspace.

This has us use DID_BAD_TARGET in case some other virt layer is returning
it. In that case we will still get a hard error like before and it conveys
something unexpected happened.

Link: https://lore.kernel.org/r/20220812010027.8251-5-michael.christie@oracle.com
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
beb4dac8 f1d0d5c9

+1 -1
+1 -1
drivers/scsi/virtio_scsi.c
··· 141 141 set_host_byte(sc, DID_TRANSPORT_DISRUPTED); 142 142 break; 143 143 case VIRTIO_SCSI_S_TARGET_FAILURE: 144 - set_host_byte(sc, DID_TARGET_FAILURE); 144 + set_host_byte(sc, DID_BAD_TARGET); 145 145 break; 146 146 case VIRTIO_SCSI_S_NEXUS_FAILURE: 147 147 set_host_byte(sc, DID_NEXUS_FAILURE);