]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.36/scsi-mpt3sas-fix-secure-erase-premature-termination.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 4.4.36 / scsi-mpt3sas-fix-secure-erase-premature-termination.patch
CommitLineData
9c6fd700
GKH
1From 18f6084a989ba1b38702f9af37a2e4049a924be6 Mon Sep 17 00:00:00 2001
2From: Andrey Grodzovsky <andrey2805@gmail.com>
3Date: Thu, 10 Nov 2016 09:35:27 -0500
4Subject: scsi: mpt3sas: Fix secure erase premature termination
5
6From: Andrey Grodzovsky <andrey2805@gmail.com>
7
8commit 18f6084a989ba1b38702f9af37a2e4049a924be6 upstream.
9
10This is a work around for a bug with LSI Fusion MPT SAS2 when perfoming
11secure erase. Due to the very long time the operation takes, commands
12issued during the erase will time out and will trigger execution of the
13abort hook. Even though the abort hook is called for the specific
14command which timed out, this leads to entire device halt
15(scsi_state terminated) and premature termination of the secure erase.
16
17Set device state to busy while ATA passthrough commands are in progress.
18
19[mkp: hand applied to 4.9/scsi-fixes, tweaked patch description]
20
21Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com>
22Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
23Cc: <linux-scsi@vger.kernel.org>
24Cc: Sathya Prakash <sathya.prakash@broadcom.com>
25Cc: Chaitra P B <chaitra.basappa@broadcom.com>
26Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
27Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
28Cc: Hannes Reinecke <hare@suse.de>
29Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
30Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31
32---
33 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 15 ++++++++++++++-
34 1 file changed, 14 insertions(+), 1 deletion(-)
35
36--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
37+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
38@@ -3831,7 +3831,10 @@ _scsih_eedp_error_handling(struct scsi_c
39 SAM_STAT_CHECK_CONDITION;
40 }
41
42-
43+static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
44+{
45+ return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16);
46+}
47
48 /**
49 * scsih_qcmd - main scsi request entry point
50@@ -3859,6 +3862,13 @@ scsih_qcmd(struct Scsi_Host *shost, stru
51 if (ioc->logging_level & MPT_DEBUG_SCSI)
52 scsi_print_command(scmd);
53
54+ /*
55+ * Lock the device for any subsequent command until command is
56+ * done.
57+ */
58+ if (ata_12_16_cmd(scmd))
59+ scsi_internal_device_block(scmd->device);
60+
61 sas_device_priv_data = scmd->device->hostdata;
62 if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
63 scmd->result = DID_NO_CONNECT << 16;
64@@ -4431,6 +4441,9 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *i
65 if (scmd == NULL)
66 return 1;
67
68+ if (ata_12_16_cmd(scmd))
69+ scsi_internal_device_unblock(scmd->device, SDEV_RUNNING);
70+
71 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
72
73 if (mpi_reply == NULL) {