Skip to content

Commit dc293f6

Browse files
committed
scsi: fix sense code for EREMOTEIO
SENSE_CODE(LUN_COMM_FAILURE) has an ABORTED COMMAND sense key, so it results in a retry in Linux. To ensure that EREMOTEIO is forwarded to the guest, use a HARDWARE ERROR sense key instead. Note that the code before commit d7a8402 was incorrect because it used HARDWARE_ERROR as a SCSI status, not as a sense key. Reported-by: Marc-André Lureau <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 26dbec4 commit dc293f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scsi/utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ int scsi_sense_from_errno(int errno_value, SCSISense *sense)
589589
return TASK_SET_FULL;
590590
#ifdef CONFIG_LINUX
591591
/* These errno mapping are specific to Linux. For more information:
592-
* - scsi_decide_disposition in drivers/scsi/scsi_error.c
592+
* - scsi_check_sense and scsi_decide_disposition in drivers/scsi/scsi_error.c
593593
* - scsi_result_to_blk_status in drivers/scsi/scsi_lib.c
594594
* - blk_errors[] in block/blk-core.c
595595
*/
@@ -599,7 +599,7 @@ int scsi_sense_from_errno(int errno_value, SCSISense *sense)
599599
*sense = SENSE_CODE(READ_ERROR);
600600
return CHECK_CONDITION;
601601
case EREMOTEIO:
602-
*sense = SENSE_CODE(LUN_COMM_FAILURE);
602+
*sense = SENSE_CODE(TARGET_FAILURE);
603603
return CHECK_CONDITION;
604604
#endif
605605
case ENOMEDIUM:

0 commit comments

Comments
 (0)