Skip to contentSkip to conversation

mpt3sas: Stop Error handler escalation when device removed

PATCH Applied Sreekanth Reddy 2 participants 2 messages Aug 16, 2022 – Sep 1, 2022

Subsystems (2)
lore
Share & tools
lore

Sreekanth Reddy

author maintainer
#0 lore raw

PATCH 1/1 mpt3sas: Stop Error handler escalation when device removed

If SCSI Error Handler is going on for timedout I/Os on a drive and that corresponding drive is removed then stop escalating to higher level of reset by returning the TUR with
"I_T NEXUS LOSS OCCURRED" sense key.

---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +13 -0
index e54747a..465603b 100644
@@ -5156,6 +5156,19 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 
 	/* invalid device handle */
 	handle = sas_target_priv_data->handle;
+
+	/*
+	 * Avoid error handling escallation when device is disconnected
+	 */
+	if (handle == MPT3SAS_INVALID_DEVICE_HANDLE || sas_device_priv_data->block) {
+		if (scmd->device->host->shost_state == SHOST_RECOVERY &&
+		    scmd->cmnd[0] == TEST_UNIT_READY) {
+			scsi_build_sense(scmd, 0, UNIT_ATTENTION, 0x29, 0x07);
+			scsi_done(scmd);
+			return 0;
+		}
+	}
+
 	if (handle == MPT3SAS_INVALID_DEVICE_HANDLE) {
 		scmd->result = DID_NO_CONNECT << 16;
 		scsi_done(scmd);
Signature · 1 line
2.27.0
#1 lore raw

Sreekanth,

Quoted 4 lines

If SCSI Error Handler is going on for timedout I/Os on a drive and that corresponding drive is removed then stop escalating to higher level of reset by returning the TUR with "I_T NEXUS LOSS OCCURRED" sense key.

Applied to 6.1/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering