@@ -1763,6 +1763,16 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
return 0;
check_type:
+ /*
+ * Check whether caller has decided not to do retries on
+ * abort success by checking the SCMD_NORETRIES_ABORT bit
+ */
+ if ((test_bit(SCMD_NORETRIES_ABORT, &scmd->state)) &&
+ (scmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT)) {
+ set_host_byte(scmd, DID_TRANSPORT_MARGINAL);
+ return 1;
+ }
+
/*
* assume caller has checked sense and determined
* the check condition was retryable.
@@ -1861,6 +1871,13 @@ 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)
@@ -629,6 +629,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);
@@ -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 */
/*
Made an additional check in scsi_noretry_cmd to verify whether user has decided not to do retries on abort success by checking the SCMD_NORETRIES_ABORT bit If SCMD_NORETRIES_ABORT bit is set we are making sure there won't be any retries done on the same path and also setting the host byte as DID_TRANSPORT_MARGINAL so that the error can be propogated as recoverable transport error to the blk layers. Added a new error code DID_TRANSPORT_MARGINAL to handle marginal errors in scsi.h Added a 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 Added DID_TRANSPORT_MARGINAL case to scsi_decide_disposition Signed-off-by: Muneendra <muneendra.kumar@broadcom.com> --- v6: Rearranged the patch by merging second hunk of the patch2 in v5 to this patch v5: added the DID_TRANSPORT_MARGINAL case to scsi_decide_disposition v4: Modified the comments in the code appropriately v3: Merged first part of the previous patch(v2 patch3) with this patch. v2: set the hostbyte as DID_TRANSPORT_MARGINAL instead of DID_TRANSPORT_FAILFAST. --- drivers/scsi/scsi_error.c | 17 +++++++++++++++++ drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi.h | 1 + 3 files changed, 19 insertions(+)