diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index da7dac77f8cd..fc01cbe63ab7 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1816,7 +1816,10 @@ check_type: * assume caller has checked sense and determined * the check condition was retryable. */ - if (req->cmd_flags & REQ_FAILFAST_DEV || blk_rq_is_passthrough(req)) + if (req->cmd_flags & REQ_FAILFAST_DEV) + return true; + if (blk_rq_is_passthrough(req) && + !(scmd->flags & SCMD_RETRY_PASSTHROUGH)) return true; return false; diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index ce930d1fc2cc..dd3bd080bba4 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -54,8 +54,11 @@ struct scsi_pointer { #define SCMD_INITIALIZED (1 << 1) #define SCMD_LAST (1 << 2) #define SCMD_FAIL_IF_RECOVERING (1 << 4) +/* If set, retry a passthrough command in case of a unit attention. */ +#define SCMD_RETRY_PASSTHROUGH (1 << 5) /* flags preserved across unprep / reprep */ -#define SCMD_PRESERVED_FLAGS (SCMD_INITIALIZED | SCMD_FAIL_IF_RECOVERING) +#define SCMD_PRESERVED_FLAGS \ + (SCMD_INITIALIZED | SCMD_FAIL_IF_RECOVERING | SCMD_RETRY_PASSTHROUGH) /* for scmd->state */ #define SCMD_STATE_COMPLETE 0