* [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v3)
[not found] <CAK=zhgqeRBcMHgvmeQSgRmpC+JBx8vAYoy3Jr8jh6VkV02UFSg@mail.gmail.com>
@ 2016-11-10 13:42 ` Andrey Grodzovsky
2016-11-10 13:54 ` Greg KH
0 siblings, 1 reply; 10+ messages in thread
From: Andrey Grodzovsky @ 2016-11-10 13:42 UTC (permalink / raw)
To: MPT-FusionLinux.pdl
Cc: igor, ezra, Andrey Grodzovsky, linux-scsi, Sathya Prakash,
Chaitra P B, Suganath Prabu Subramani, Sreekanth Reddy,
Hannes Reinecke, stable
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 specifc 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.
Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com>
Cc: <linux-scsi@vger.kernel.org>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: <stable@vger.kernel.org>
---
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..320f16c 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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v3)
2016-11-10 13:42 ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v3) Andrey Grodzovsky
@ 2016-11-10 13:54 ` Greg KH
2016-11-10 14:35 ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4) Andrey Grodzovsky
0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2016-11-10 13:54 UTC (permalink / raw)
To: Andrey Grodzovsky
Cc: MPT-FusionLinux.pdl, igor, ezra, linux-scsi, Sathya Prakash,
Chaitra P B, Suganath Prabu Subramani, Sreekanth Reddy,
Hannes Reinecke, stable
On Thu, Nov 10, 2016 at 08:42:52AM -0500, 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 specifc 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.
>
> Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com>
> Cc: <linux-scsi@vger.kernel.org>
> Cc: Sathya Prakash <sathya.prakash@broadcom.com>
> Cc: Chaitra P B <chaitra.basappa@broadcom.com>
> Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
> Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: <stable@vger.kernel.org>
> ---
> 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..320f16c 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);
> +}
Please always run your patches through checkpatch.pl so you don't get a
grumpy maintainer emailing you and telling you to run your patches
through checkpatch.pl...
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)
2016-11-10 13:54 ` Greg KH
@ 2016-11-10 14:35 ` Andrey Grodzovsky
2016-11-12 15:29 ` Martin K. Petersen
[not found] ` <CAK=zhgpUo-t=xBm93NmBf6q-VD01C2s7mqFOy-C7Vo=WABGvSw@mail.gmail.com>
0 siblings, 2 replies; 10+ messages in thread
From: Andrey Grodzovsky @ 2016-11-10 14:35 UTC (permalink / raw)
To: MPT-FusionLinux.pdl
Cc: igor, ezra, Andrey Grodzovsky, linux-scsi, Sathya Prakash,
Chaitra P B, Suganath Prabu Subramani, Sreekanth Reddy,
Hannes Reinecke, stable
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 <andrey2805@gmail.com>
Cc: <linux-scsi@vger.kernel.org>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: <stable@vger.kernel.org>
---
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)
2016-11-10 14:35 ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4) Andrey Grodzovsky
@ 2016-11-12 15:29 ` Martin K. Petersen
2016-11-12 16:36 ` Andrey Grodzovsky
[not found] ` <CAK=zhgpUo-t=xBm93NmBf6q-VD01C2s7mqFOy-C7Vo=WABGvSw@mail.gmail.com>
1 sibling, 1 reply; 10+ messages in thread
From: Martin K. Petersen @ 2016-11-12 15:29 UTC (permalink / raw)
To: Andrey Grodzovsky
Cc: MPT-FusionLinux.pdl, igor, ezra, linux-scsi, Sathya Prakash,
Chaitra P B, Suganath Prabu Subramani, Sreekanth Reddy,
Hannes Reinecke, stable
>>>>> "Andrey" == Andrey Grodzovsky <andrey2805@gmail.com> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)
2016-11-12 15:29 ` Martin K. Petersen
@ 2016-11-12 16:36 ` Andrey Grodzovsky
2016-11-14 23:30 ` Martin K. Petersen
0 siblings, 1 reply; 10+ messages in thread
From: Andrey Grodzovsky @ 2016-11-12 16:36 UTC (permalink / raw)
To: Martin K. Petersen
Cc: PDL-MPT-FUSIONLINUX, Igor Rybak, Ezra Kohavi, linux-scsi,
Sathya Prakash, Chaitra P B, Suganath Prabu Subramani,
Sreekanth Reddy, Hannes Reinecke, stable
On Sat, Nov 12, 2016 at 10:29 AM, Martin K. Petersen
<martin.petersen@oracle.com> wrote:
>>>>>> "Andrey" == Andrey Grodzovsky <andrey2805@gmail.com> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)
2016-11-12 16:36 ` Andrey Grodzovsky
@ 2016-11-14 23:30 ` Martin K. Petersen
2016-11-17 1:15 ` [PATCH] [SCSI] mpt2sas: Fix secure erase premature termination Andrey Grodzovsky
0 siblings, 1 reply; 10+ messages in thread
From: Martin K. Petersen @ 2016-11-14 23:30 UTC (permalink / raw)
To: Andrey Grodzovsky
Cc: Martin K. Petersen, PDL-MPT-FUSIONLINUX, Igor Rybak, Ezra Kohavi,
linux-scsi, Sathya Prakash, Chaitra P B, Suganath Prabu Subramani,
Sreekanth Reddy, Hannes Reinecke, stable
>>>>> "Andrey" == Andrey Grodzovsky <andrey2805@gmail.com> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] [SCSI] mpt2sas: Fix secure erase premature termination
2016-11-14 23:30 ` Martin K. Petersen
@ 2016-11-17 1:15 ` Andrey Grodzovsky
2016-11-17 7:11 ` Greg KH
0 siblings, 1 reply; 10+ messages in thread
From: Andrey Grodzovsky @ 2016-11-17 1:15 UTC (permalink / raw)
To: stable
Cc: Andrey Grodzovsky, Sreekanth Reddy, Hannes Reinecke,
PDL-MPT-FUSIONLINUX, Martin K. Petersen
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@gmail.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: PDL-MPT-FUSIONLINUX <MPT-FusionLinux.pdl@broadcom.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
---
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 3f26147..988c1da 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3884,6 +3884,11 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
_scsih_scsi_direct_io_set(ioc, smid, 1);
}
+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
@@ -3906,6 +3911,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;
@@ -4447,6 +4459,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.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] [SCSI] mpt2sas: Fix secure erase premature termination
2016-11-17 1:15 ` [PATCH] [SCSI] mpt2sas: Fix secure erase premature termination Andrey Grodzovsky
@ 2016-11-17 7:11 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2016-11-17 7:11 UTC (permalink / raw)
To: Andrey Grodzovsky
Cc: stable, Sreekanth Reddy, Hannes Reinecke, PDL-MPT-FUSIONLINUX,
Martin K. Petersen
On Wed, Nov 16, 2016 at 08:15:08PM -0500, 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
>
> P.S
> This is a backport from the same fix for mpt3sas driver intended
> for pre-4.4 stable trees.
What is "the same fix"? What is the git commit id in Linus's tree for
this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)
[not found] ` <CAK=zhgpUo-t=xBm93NmBf6q-VD01C2s7mqFOy-C7Vo=WABGvSw@mail.gmail.com>
@ 2018-04-23 18:28 ` Igor Rybak
2018-04-24 7:25 ` Greg KH
0 siblings, 1 reply; 10+ messages in thread
From: Igor Rybak @ 2018-04-23 18:28 UTC (permalink / raw)
To: Sreekanth Reddy, Andrey Grodzovsky
Cc: PDL-MPT-FUSIONLINUX, Ezra Kohavi, linux-scsi@vger.kernel.org,
Sathya Prakash, Chaitra P B, Suganath Prabu Subramani,
Hannes Reinecke, stable@vger.kernel.org
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.reddy@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; stable@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 <andrey2805@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 <andrey2805@gmail.com>
> Cc: <linux-scsi@vger.kernel.org>
> Cc: Sathya Prakash <sathya.prakash@broadcom.com>
> Cc: Chaitra P B <chaitra.basappa@broadcom.com>
> Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
> Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: <stable@vger.kernel.org>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@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
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4)
2018-04-23 18:28 ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4) Igor Rybak
@ 2018-04-24 7:25 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2018-04-24 7:25 UTC (permalink / raw)
To: Igor Rybak
Cc: Sreekanth Reddy, Andrey Grodzovsky, PDL-MPT-FUSIONLINUX,
Ezra Kohavi, linux-scsi@vger.kernel.org, Sathya Prakash,
Chaitra P B, Suganath Prabu Subramani, Hannes Reinecke,
stable@vger.kernel.org
On Mon, Apr 23, 2018 at 06:28:03PM +0000, 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
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-04-24 7:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAK=zhgqeRBcMHgvmeQSgRmpC+JBx8vAYoy3Jr8jh6VkV02UFSg@mail.gmail.com>
2016-11-10 13:42 ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v3) Andrey Grodzovsky
2016-11-10 13:54 ` Greg KH
2016-11-10 14:35 ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4) Andrey Grodzovsky
2016-11-12 15:29 ` Martin K. Petersen
2016-11-12 16:36 ` Andrey Grodzovsky
2016-11-14 23:30 ` Martin K. Petersen
2016-11-17 1:15 ` [PATCH] [SCSI] mpt2sas: Fix secure erase premature termination Andrey Grodzovsky
2016-11-17 7:11 ` Greg KH
[not found] ` <CAK=zhgpUo-t=xBm93NmBf6q-VD01C2s7mqFOy-C7Vo=WABGvSw@mail.gmail.com>
2018-04-23 18:28 ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v4) Igor Rybak
2018-04-24 7:25 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).