]>
Commit | Line | Data |
---|---|---|
9c6fd700 GKH |
1 | From 18f6084a989ba1b38702f9af37a2e4049a924be6 Mon Sep 17 00:00:00 2001 |
2 | From: Andrey Grodzovsky <andrey2805@gmail.com> | |
3 | Date: Thu, 10 Nov 2016 09:35:27 -0500 | |
4 | Subject: scsi: mpt3sas: Fix secure erase premature termination | |
5 | ||
6 | From: Andrey Grodzovsky <andrey2805@gmail.com> | |
7 | ||
8 | commit 18f6084a989ba1b38702f9af37a2e4049a924be6 upstream. | |
9 | ||
10 | This is a work around for a bug with LSI Fusion MPT SAS2 when perfoming | |
11 | secure erase. Due to the very long time the operation takes, commands | |
12 | issued during the erase will time out and will trigger execution of the | |
13 | abort hook. Even though the abort hook is called for the specific | |
14 | command which timed out, this leads to entire device halt | |
15 | (scsi_state terminated) and premature termination of the secure erase. | |
16 | ||
17 | Set 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 | ||
21 | Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com> | |
22 | Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com> | |
23 | Cc: <linux-scsi@vger.kernel.org> | |
24 | Cc: Sathya Prakash <sathya.prakash@broadcom.com> | |
25 | Cc: Chaitra P B <chaitra.basappa@broadcom.com> | |
26 | Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com> | |
27 | Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com> | |
28 | Cc: Hannes Reinecke <hare@suse.de> | |
29 | Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> | |
30 | Signed-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) { |