Re: [PATCH] mpt2sas: Fix secure erase premature termination.

2016-11-21 Thread Johannes Thumshirn
On Mon, Nov 21, 2016 at 10:41:38AM +0100, Greg KH wrote:
> On Mon, Nov 21, 2016 at 03:05:38PM +0530, Suganath Prabu Subramani wrote:
> > Commit id and other details are given below:
> > 
> > commit 18f6084a989ba1b38702f9af37a2e4049a924be6
> > Author: Andrey Grodzovsky 
> > Date:   Thu Nov 10 09:35:27 2016 -0500
> > 
> >     scsi: mpt3sas: Fix secure erase premature termination
> > 
> 
> For what?  I have no context here...

Hi, 

Let me chime in and give you some context. Once upon a time there have been
two LSI/Avago/Broadcom SAS HBA drivers called mpt2sas and mpt3sas. Luckily
they got merged and so we only have to fix bugs in one file instead all of 
it's copies. This was around commit c84b06a48c4d8ac8270624453132f3fa1a4a0f9d
which went in v4.4. This patch looks like the mpt2sas version of above fix for
stable kernels before the mpt{2,3}sas unification (a.k.a pre-4.4).

Hope that helps.

Byte,
Johannes

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mpt2sas: Fix secure erase premature termination.

2016-11-21 Thread Greg KH
On Mon, Nov 21, 2016 at 03:05:38PM +0530, Suganath Prabu Subramani wrote:
> Commit id and other details are given below:
> 
> commit 18f6084a989ba1b38702f9af37a2e4049a924be6
> Author: Andrey Grodzovsky 
> Date:   Thu Nov 10 09:35:27 2016 -0500
> 
>     scsi: mpt3sas: Fix secure erase premature termination
> 

For what?  I have no context here...


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mpt2sas: Fix secure erase premature termination.

2016-11-18 Thread Greg KH
On Fri, Nov 18, 2016 at 05:12:49PM +0530, Suganath Prabu S wrote:
> 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.
> 
> P.S
> This is a backport from the same fix for mpt3sas driver intended
> for pre-4.4 stable trees.

What is the git commit id of the patch in Linus's tree that matches up
with this one?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mpt2sas: Fix secure erase premature termination.

2016-11-18 Thread Suganath Prabu S
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.

P.S
This is a backport from the same fix for mpt3sas driver intended
for pre-4.4 stable trees.

Signed-off-by: Suganath Prabu S 
Cc: sta...@vger.kernel.org
---
 drivers/scsi/mpt2sas/mpt2sas_scsih.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c 
b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 0ad09b2..3ab639f 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3848,6 +3848,11 @@ _scsih_temp_threshold_events(struct MPT2SAS_ADAPTER *ioc,
}
 }
 
+static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
+{
+   return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16);
+}
+
 /**
  * _scsih_flush_running_cmds - completing outstanding commands.
  * @ioc: per adapter object
@@ -3869,6 +3874,9 @@ _scsih_flush_running_cmds(struct MPT2SAS_ADAPTER *ioc)
if (!scmd)
continue;
count++;
+   if (ata_12_16_cmd(scmd))
+   scsi_internal_device_unblock(scmd->device,
+   SDEV_RUNNING);
mpt2sas_base_free_smid(ioc, smid);
scsi_dma_unmap(scmd);
if (ioc->pci_error_recovery)
@@ -4073,6 +4081,13 @@ _scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd 
*scmd)
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);
+
sas_device_priv_data = scmd->device->hostdata;
if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
scmd->result = DID_NO_CONNECT << 16;
@@ -4621,6 +4636,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) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html