diff mbox series

[2/5] scsi: Clear state bit SCMD_NORETRIES_ABORT of scsi_cmd before start request

Message ID 1596595862-11075-3-git-send-email-muneendra.kumar@broadcom.com
State New
Headers show
Series scsi: Support to handle Intermittent errors | expand

Commit Message

Muneendra Kumar Aug. 5, 2020, 2:50 a.m. UTC
Clearing the SCMD_NORETRIES_ABORT bit in state flag of scsi_cmd if the
block layer didn't complete the request due to a timeout injection so that
the timeout handler will see it needs to escalate its own error recovery.
Also clearing the SCMD_NORETRIES_ABORT bit in state flag before
blk_mq_start_request.

Signed-off-by: Muneendra <muneendra.kumar@broadcom.com>
---
 drivers/scsi/scsi_lib.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 27b52fc..3da6402 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1594,12 +1594,15 @@  static void scsi_mq_done(struct scsi_cmnd *cmd)
 
 	/*
 	 * If the block layer didn't complete the request due to a timeout
-	 * injection, scsi must clear its internal completed state so that the
+	 * injection, scsi must clear its internal completed state and
+	 * SCMD_NORETRIES_ABORT bit in state field  so that the
 	 * timeout handler will see it needs to escalate its own error
 	 * recovery.
 	 */
-	if (unlikely(!blk_mq_complete_request(cmd->request)))
+	if (unlikely(!blk_mq_complete_request(cmd->request))) {
 		clear_bit(SCMD_STATE_COMPLETE, &cmd->state);
+		clear_bit(SCMD_NORETRIES_ABORT, &cmd->state);
+	}
 }
 
 static void scsi_mq_put_budget(struct blk_mq_hw_ctx *hctx)
@@ -1652,6 +1655,7 @@  static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
 		req->rq_flags |= RQF_DONTPREP;
 	} else {
 		clear_bit(SCMD_STATE_COMPLETE, &cmd->state);
+		clear_bit(SCMD_NORETRIES_ABORT, &cmd->state);
 		blk_mq_start_request(req);
 	}