diff mbox series

[RFC,10/22] scsi: Allow passthrough to request infinite retries

Message ID 20220922100704.753666-11-michael.christie@oracle.com
State New
Headers show
Series Allow scsi_execute users to control retries | expand

Commit Message

Mike Christie Sept. 22, 2022, 10:06 a.m. UTC
hp_sw and rdac request unimited retries for their failover commands. This
allows them to request this by using a special value.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/scsi_error.c | 3 ++-
 include/scsi/scsi_cmnd.h  | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 059c5f40d236..ea79bad4b865 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1881,7 +1881,8 @@  static enum scsi_disposition scsi_check_passthrough(struct scsi_cmnd *scmd)
 	return SCSI_RETURN_NOT_HANDLED;
 
 maybe_retry:
-	if (++failure->retries <= failure->allowed)
+	if (failure->allowed == SCMD_FAILURE_NO_LIMIT ||
+	    ++failure->retries <= failure->allowed)
 		return NEEDS_RETRY;
 
 	return SUCCESS;
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index ee3986401f52..cb1191ff698c 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -69,6 +69,7 @@  enum scsi_cmnd_submitter {
 #define SCMD_FAILURE_ANY	0xffffffff
 #define SCMD_FAILURE_ASC_ANY	0xff
 #define SCMD_FAILURE_ASCQ_ANY	0xff
+#define SCMD_FAILURE_NO_LIMIT	255
 
 struct scsi_failure {
 	u8 sense;