Re: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)

2018-04-24 Thread Greg KH
On Mon, Apr 23, 2018 at 06:28:03PM +, Igor Rybak wrote:
> Hi,
> 
> We are running kernel 4.4.0-22 and the patch below does not seem to be 
> present in the mpt3sas driver. Can you please confirm?

Please update your kernel, this patch was in the 4.4.36 kernel release
which came out December 2, 2016, well over a full year ago.

thanks,

greg k-h


RE: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)

2018-04-23 Thread Igor Rybak
Hi,

We are running kernel 4.4.0-22 and the patch below does not seem to be present 
in the mpt3sas driver. Can you please confirm?
As a reminder the patch was related to a Security Erase ATA command that 
requires a very long timeout like 100 minutes or more and the drive retains a 
busy status. And the driver should not try to send other commands or reset the 
drive.

Thanks,

Igor Rybak
CTO
MediaClone Inc
6900 Canby Ave Ste 107
Reseda, CA 91335
USA
+1-818-654-6286

From: Sreekanth Reddy [sreekanth.re...@broadcom.com]
Sent: Thursday, November 10, 2016 8:38 PM
To: Andrey Grodzovsky
Cc: PDL-MPT-FUSIONLINUX; Igor Rybak; Ezra Kohavi; linux-scsi@vger.kernel.org; 
Sathya Prakash; Chaitra P B; Suganath Prabu Subramani; Hannes Reinecke; 
sta...@vger.kernel.org
Subject: Re: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)

On Thu, Nov 10, 2016 at 8:05 PM, Andrey Grodzovsky <andrey2...@gmail.com> 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.
> More data and logs can be found here -
> https://drive.google.com/file/d/0B9ocOHYHbbS1Q3VMdkkzeWFkTjg/view
>
> v2: Update according to example patch by Hannes Reinecke to apply
> the blocking logic to any ATA 12/16 command.
>
> v3: Use SCSI commands opcodes definitions instead of value and
> correct identation.
>
> v4: Fix checkpath errors and warning.
>
> Signed-off-by: Andrey Grodzovsky <andrey2...@gmail.com>
> Cc: <linux-scsi@vger.kernel.org>
> Cc: Sathya Prakash <sathya.prak...@broadcom.com>
> Cc: Chaitra P B <chaitra.basa...@broadcom.com>
> Cc: Suganath Prabu Subramani <suganath-prabu.subram...@broadcom.com>
> Cc: Sreekanth Reddy <sreekanth.re...@broadcom.com>
> Cc: Hannes Reinecke <h...@suse.de>
> Cc: <sta...@vger.kernel.org>

Acked-by: Sreekanth Reddy <sreekanth.re...@broadcom.com>

> ---
>  drivers/scsi/mpt3sas/mpt3sas_scsih.c | 16 
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
> b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> index 5a97e32..c032319 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> @@ -3500,6 +3500,10 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 
> ioc_status)
> SAM_STAT_CHECK_CONDITION;
>  }
>
> +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
> @@ -3528,6 +3532,14 @@ _scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd 
> *scmd)
> scsi_print_command(scmd);
>  #endif
>
> +   /**
> +   * 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;
> @@ -4062,6 +4074,10 @@ _scsih_io_done(struct MPT3SAS_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 = mpt3sas_base_get_msg_frame(ioc, smid);
>
> if (mpi_reply == NULL) {
> --
> 2.1.4
>



Re: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)

2016-11-14 Thread Martin K. Petersen
> "Andrey" == Andrey Grodzovsky  writes:

Andrey,

Andrey> Regarding older code where there is still a separate mpt2sas
Andrey> driver, should a separate patch to be done or this fix will be
Andrey> ported there ?

Feel free to submit a mpt2sas patch to the pre-4.4 stable trees.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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] [SCSI] mpt3sas: Fix secure erase premature termination (v4)

2016-11-12 Thread Andrey Grodzovsky
On Sat, Nov 12, 2016 at 10:29 AM, Martin K. Petersen
 wrote:
>> "Andrey" == Andrey Grodzovsky  writes:
>
> Andrey,
>
> Andrey> Problem: This is a work around for a bug with LSI Fusion MPT
> Andrey> SAS2 when pefroming secure erase. Due to the very long time the
> Andrey> operation takes commands issued during the erase will time out
> Andrey> and will trigger execution of abort hook. Even though the abort
> Andrey> hook is called for the specific command which timed out this
> Andrey> leads to entire device halt (scsi_state terminated) and
> Andrey> premature termination of the secured erase.
>
> This patch didn't apply to the SCSI tree. I merged it into
> 4.9/scsi-fixes by hand.

Sorry about that and thanks. Next time i will work of off latest tree.
Regarding older code where there is still a separate mpt2sas driver, should
a separate patch to be done or this fix will be ported there ?

Thanks,
Andrey
>
> Also, please check Documentation/SubmittingPatches for future
> submissions. Patch version goes inside the [PATCH foo/bar] brackets and
> patch changelog entries below "---" separator.
>
> Thanks!
> Martin
>
> --
> Martin K. Petersen  Oracle Linux Engineering
--
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] [SCSI] mpt3sas: Fix secure erase premature termination (v4)

2016-11-12 Thread Martin K. Petersen
> "Andrey" == Andrey Grodzovsky  writes:

Andrey,

Andrey> Problem: This is a work around for a bug with LSI Fusion MPT
Andrey> SAS2 when pefroming secure erase. Due to the very long time the
Andrey> operation takes commands issued during the erase will time out
Andrey> and will trigger execution of abort hook. Even though the abort
Andrey> hook is called for the specific command which timed out this
Andrey> leads to entire device halt (scsi_state terminated) and
Andrey> premature termination of the secured erase.

This patch didn't apply to the SCSI tree. I merged it into
4.9/scsi-fixes by hand.

Also, please check Documentation/SubmittingPatches for future
submissions. Patch version goes inside the [PATCH foo/bar] brackets and
patch changelog entries below "---" separator.

Thanks!
Martin

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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] [SCSI] mpt3sas: Fix secure erase premature termination (v4)

2016-11-10 Thread Sreekanth Reddy
On Thu, Nov 10, 2016 at 8:05 PM, Andrey Grodzovsky  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.
> More data and logs can be found here -
> https://drive.google.com/file/d/0B9ocOHYHbbS1Q3VMdkkzeWFkTjg/view
>
> v2: Update according to example patch by Hannes Reinecke to apply
> the blocking logic to any ATA 12/16 command.
>
> v3: Use SCSI commands opcodes definitions instead of value and
> correct identation.
>
> v4: Fix checkpath errors and warning.
>
> Signed-off-by: Andrey Grodzovsky 
> Cc: 
> Cc: Sathya Prakash 
> Cc: Chaitra P B 
> Cc: Suganath Prabu Subramani 
> Cc: Sreekanth Reddy 
> Cc: Hannes Reinecke 
> Cc: 

Acked-by: Sreekanth Reddy 

> ---
>  drivers/scsi/mpt3sas/mpt3sas_scsih.c | 16 
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
> b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> index 5a97e32..c032319 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> @@ -3500,6 +3500,10 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 
> ioc_status)
> SAM_STAT_CHECK_CONDITION;
>  }
>
> +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
> @@ -3528,6 +3532,14 @@ _scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd 
> *scmd)
> scsi_print_command(scmd);
>  #endif
>
> +   /**
> +   * 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;
> @@ -4062,6 +4074,10 @@ _scsih_io_done(struct MPT3SAS_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 = mpt3sas_base_get_msg_frame(ioc, smid);
>
> if (mpi_reply == NULL) {
> --
> 2.1.4
>
--
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] [SCSI] mpt3sas: Fix secure erase premature termination (v4)

2016-11-10 Thread Andrey Grodzovsky
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

v2: Update according to example patch by Hannes Reinecke to apply
the blocking logic to any ATA 12/16 command.

v3: Use SCSI commands opcodes definitions instead of value and
correct identation.

v4: Fix checkpath errors and warning.

Signed-off-by: Andrey Grodzovsky 
Cc: 
Cc: Sathya Prakash 
Cc: Chaitra P B 
Cc: Suganath Prabu Subramani 
Cc: Sreekanth Reddy 
Cc: Hannes Reinecke 
Cc: 
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 5a97e32..c032319 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3500,6 +3500,10 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 
ioc_status)
SAM_STAT_CHECK_CONDITION;
 }
 
+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
@@ -3528,6 +3532,14 @@ _scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd 
*scmd)
scsi_print_command(scmd);
 #endif
 
+   /**
+   * 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;
@@ -4062,6 +4074,10 @@ _scsih_io_done(struct MPT3SAS_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 = mpt3sas_base_get_msg_frame(ioc, smid);
 
if (mpi_reply == NULL) {
-- 
2.1.4

--
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