On 8/5/20 4:50 AM, Muneendra wrote:
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@xxxxxxxxxxxx>
---
drivers/scsi/scsi_lib.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
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);
}
Reviewed-by: Hannes Reinecke <hare@xxxxxxx>
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@xxxxxxx +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer