scsi: core: Add a new error code DID_TRANSPORT_MARGINAL in scsi.h
authorMuneendra Kumar <muneendra.kumar@broadcom.com>
Wed, 6 Jan 2021 21:49:04 +0000 (03:19 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 15 Jan 2021 03:55:17 +0000 (22:55 -0500)
Add code in scsi_result_to_blk_status to translate a new error
DID_TRANSPORT_MARGINAL to the corresponding blk_status_t i.e
BLK_STS_TRANSPORT.

Add DID_TRANSPORT_MARGINAL case to scsi_decide_disposition().

Link: https://lore.kernel.org/r/1609969748-17684-2-git-send-email-muneendra.kumar@broadcom.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Muneendra Kumar <muneendra.kumar@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c
include/scsi/scsi.h

index f11f51e..28056ee 100644 (file)
@@ -1861,6 +1861,12 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                 * the fast io fail tmo fired), so send IO directly upwards.
                 */
                return SUCCESS;
+       case DID_TRANSPORT_MARGINAL:
+               /*
+                * caller has decided not to do retries on
+                * abort success, so send IO directly upwards
+                */
+               return SUCCESS;
        case DID_ERROR:
                if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
                    status_byte(scmd->result) == RESERVATION_CONFLICT)
index b3f14f0..d0ae586 100644 (file)
@@ -630,6 +630,7 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
                        return BLK_STS_OK;
                return BLK_STS_IOERR;
        case DID_TRANSPORT_FAILFAST:
+       case DID_TRANSPORT_MARGINAL:
                return BLK_STS_TRANSPORT;
        case DID_TARGET_FAILURE:
                set_host_byte(cmd, DID_OK);
index 5339baa..5b287ad 100644 (file)
@@ -159,6 +159,7 @@ static inline int scsi_is_wlun(u64 lun)
                                 * paths might yield different results */
 #define DID_ALLOC_FAILURE 0x12  /* Space allocation on the device failed */
 #define DID_MEDIUM_ERROR  0x13  /* Medium error */
+#define DID_TRANSPORT_MARGINAL 0x14 /* Transport marginal errors */
 #define DRIVER_OK       0x00   /* Driver status                           */
 
 /*