]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - drivers/scsi/scsi_lib.c
scsi: core: Make scsi_result_to_blk_status() recognize CONDITION MET
[mirror_ubuntu-hirsute-kernel.git] / drivers / scsi / scsi_lib.c
index ca5a6dfbe23995b53369d78039a9401ecd4d838f..e9b4f279d29cb1de2b59f897b2f462bb8f7d3c9a 100644 (file)
@@ -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: