diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2018-04-05 19:33:01 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-04-10 03:31:37 +0200 |
commit | f4abab3f182b6b01e3e0f052721b4721a269a133 (patch) | |
tree | d6eeda8b5016da42e3898dd77ebf345e16d93341 | |
parent | scsi: core: Rename __scsi_error_from_host_byte() into scsi_result_to_blk_stat... (diff) | |
download | linux-f4abab3f182b6b01e3e0f052721b4721a269a133.tar.xz linux-f4abab3f182b6b01e3e0f052721b4721a269a133.zip |
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 <bart.vanassche@wdc.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Lee Duncan <lduncan@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/scsi_lib.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ca5a6dfbe239..e9b4f279d29c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -733,6 +733,15 @@ static bool scsi_end_request(struct request *req, blk_status_t error, static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result) { switch (host_byte(result)) { + case DID_OK: + /* + * Also check the other bytes than the status byte in result + * to handle the case when a SCSI LLD sets result to + * DRIVER_SENSE << 24 without setting SAM_STAT_CHECK_CONDITION. + */ + if (scsi_status_is_good(result) && (result & ~0xff) == 0) + return BLK_STS_OK; + return BLK_STS_IOERR; case DID_TRANSPORT_FAILFAST: return BLK_STS_TRANSPORT; case DID_TARGET_FAILURE: |