Skip to content

Commit f4abab3

Browse files
KAGA-KOKOmartinkpetersen
authored andcommitted
scsi: core: Make scsi_result_to_blk_status() recognize CONDITION MET
Ensure that CONDITION MET and other non-zero status values that indicate success are translated into BLK_STS_OK. Signed-off-by: Bart Van Assche <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Douglas Gilbert <[email protected]> Cc: Damien Le Moal <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Lee Duncan <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent a77b32d commit f4abab3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,15 @@ static bool scsi_end_request(struct request *req, blk_status_t error,
733733
static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
734734
{
735735
switch (host_byte(result)) {
736+
case DID_OK:
737+
/*
738+
* Also check the other bytes than the status byte in result
739+
* to handle the case when a SCSI LLD sets result to
740+
* DRIVER_SENSE << 24 without setting SAM_STAT_CHECK_CONDITION.
741+
*/
742+
if (scsi_status_is_good(result) && (result & ~0xff) == 0)
743+
return BLK_STS_OK;
744+
return BLK_STS_IOERR;
736745
case DID_TRANSPORT_FAILFAST:
737746
return BLK_STS_TRANSPORT;
738747
case DID_TARGET_FAILURE:

0 commit comments

Comments
 (0)