summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt3sas/mpt3sas_scsih.c
diff options
context:
space:
mode:
authorSreekanth Reddy <sreekanth.reddy@broadcom.com>2022-08-16 13:38:01 +0530
committerMartin K. Petersen <martin.petersen@oracle.com>2022-09-01 00:08:35 -0400
commite75c8ea0d73bebdbff3ceb51f55fd735cb232d86 (patch)
tree55de79390401cede1f49d8ce1c9435944bcc117d /drivers/scsi/mpt3sas/mpt3sas_scsih.c
parent48658213202c4f48ef34b43b9b6f60af8b67fb8a (diff)
downloadlinux-e75c8ea0d73bebdbff3ceb51f55fd735cb232d86.tar.gz
linux-e75c8ea0d73bebdbff3ceb51f55fd735cb232d86.tar.bz2
linux-e75c8ea0d73bebdbff3ceb51f55fd735cb232d86.zip
scsi: mpt3sas: Prevent error handler escalation when device removed
If SCSI error handling is taking place for timed out I/Os on a drive and the corresponding drive is removed, then stop escalating to higher level of reset by returning the TUR with "I_T NEXUS LOSS OCCURRED" sense key. Link: https://lore.kernel.org/r/20220816080801.13929-1-sreekanth.reddy@broadcom.com Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mpt3sas/mpt3sas_scsih.c')
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 3507e2ace903..514ae8f5afa3 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -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);