[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1486322541-8206-43-git-send-email-w@1wt.eu>
Date: Sun, 5 Feb 2017 20:19:24 +0100
From: Willy Tarreau <w@....eu>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
linux@...ck-us.net
Cc: Andrey Grodzovsky <andrey2805@...il.com>,
Sreekanth Reddy <Sreekanth.Reddy@...adcom.com>,
Hannes Reinecke <hare@...e.de>,
PDL-MPT-FUSIONLINUX <MPT-FusionLinux.pdl@...adcom.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Willy Tarreau <w@....eu>
Subject: [PATCH 3.10 142/319] mpt2sas: Fix secure erase premature termination
From: Andrey Grodzovsky <andrey2805@...il.com>
Problem:
This is a work around for a bug with LSI Fusion MPT SAS2 when
pefroming secure erase. Due to the very long time the operation
takes commands issued during the erase will time out and will trigger
execution of abort hook. Even though the abort hook is called for
the specific command which timed out this leads to entire device halt
(scsi_state terminated) and premature termination of the secured erase.
Fix:
Set device state to busy while erase in progress to reject any incoming
commands until the erase is done. The device is blocked any way during
this time and cannot execute any other command.
More data and logs can be found here -
https://drive.google.com/file/d/0B9ocOHYHbbS1Q3VMdkkzeWFkTjg/view
P.S
This is a backport from the same fix for mpt3sas driver intended
for pre-4.4 stable trees.
Signed-off-by: Andrey Grodzovsky <andrey2805@...il.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@...adcom.com>
Cc: Hannes Reinecke <hare@...e.de>
Cc: PDL-MPT-FUSIONLINUX <MPT-FusionLinux.pdl@...adcom.com>
Cc: Martin K. Petersen <martin.petersen@...cle.com>
Signed-off-by: Willy Tarreau <w@....eu>
---
drivers/scsi/mpt2sas/mpt2sas_scsih.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index fe76185..64caa5c 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3926,6 +3926,11 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
}
}
+static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
+{
+ return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16);
+}
+
/**
* _scsih_qcmd - main scsi request entry point
* @scmd: pointer to scsi command object
@@ -3948,6 +3953,13 @@ _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
u32 mpi_control;
u16 smid;
+ /**
+ * Lock the device for any subsequent command until
+ * command is done.
+ */
+ if (ata_12_16_cmd(scmd))
+ scsi_internal_device_block(scmd->device);
+
scmd->scsi_done = done;
sas_device_priv_data = scmd->device->hostdata;
if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
@@ -4454,6 +4466,9 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
if (scmd == NULL)
return 1;
+ if (ata_12_16_cmd(scmd))
+ scsi_internal_device_unblock(scmd->device, SDEV_RUNNING);
+
mpi_request = mpt2sas_base_get_msg_frame(ioc, smid);
if (mpi_reply == NULL) {
--
2.8.0.rc2.1.gbe9624a
Powered by blists - more mailing lists