All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Grodzovsky <andrey2805@gmail.com>
To: MPT-FusionLinux.pdl@broadcom.com
Cc: Andrey Grodzovsky <andrey2805@gmail.com>,
	<linux-scsi@vger.kernel.org>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Chaitra P B <chaitra.basappa@broadcom.com>,
	Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
	Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>,
	Hannes Reinecke <hare@suse.de>, <stable@vger.kernel.org>
Subject: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v2)
Date: Tue,  1 Nov 2016 20:09:54 -0400	[thread overview]
Message-ID: <1478045394-19536-1-git-send-email-andrey2805@gmail.com> (raw)
In-Reply-To: <2179ecb8-183f-a500-4d65-10f64f0f43cc@suse.de>

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.

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 | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 5a97e32..43ab0cc 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3500,6 +3500,20 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status)
 	    SAM_STAT_CHECK_CONDITION;
 }
 
+/**
+ * This is a work around for a bug with LSI Fusion MPT SAS2 when
+ * pefroming secure erase. Due to the verly long time the operation
+ * takes commands issued during the erase will time out and will trigger
+ * execution of abort hook. This leads to device reset and premature
+ * termination of the secured erase.
+ *
+ */
+static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
+{
+   return (scmd->cmnd[0] == 0xa1 || scmd->cmnd[0] == 0x85);
+}
+
+
 
 /**
  * _scsih_qcmd - main scsi request entry point
@@ -3528,6 +3542,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 +4084,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


WARNING: multiple messages have this Message-ID (diff)
From: Andrey Grodzovsky <andrey2805@gmail.com>
To: MPT-FusionLinux.pdl@broadcom.com
Cc: Andrey Grodzovsky <andrey2805@gmail.com>,
	linux-scsi@vger.kernel.org,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Chaitra P B <chaitra.basappa@broadcom.com>,
	Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
	Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>,
	Hannes Reinecke <hare@suse.de>,
	stable@vger.kernel.org
Subject: [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v2)
Date: Tue,  1 Nov 2016 20:09:54 -0400	[thread overview]
Message-ID: <1478045394-19536-1-git-send-email-andrey2805@gmail.com> (raw)
In-Reply-To: <2179ecb8-183f-a500-4d65-10f64f0f43cc@suse.de>

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.

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 | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 5a97e32..43ab0cc 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3500,6 +3500,20 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status)
 	    SAM_STAT_CHECK_CONDITION;
 }
 
+/**
+ * This is a work around for a bug with LSI Fusion MPT SAS2 when
+ * pefroming secure erase. Due to the verly long time the operation
+ * takes commands issued during the erase will time out and will trigger
+ * execution of abort hook. This leads to device reset and premature
+ * termination of the secured erase.
+ *
+ */
+static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
+{
+   return (scmd->cmnd[0] == 0xa1 || scmd->cmnd[0] == 0x85);
+}
+
+
 
 /**
  * _scsih_qcmd - main scsi request entry point
@@ -3528,6 +3542,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 +4084,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

  reply	other threads:[~2016-11-02  0:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-30 12:43 [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination Andrey Grodzovsky
2016-10-30 12:43 ` Andrey Grodzovsky
2016-10-30 18:43 ` Hannes Reinecke
2016-10-30 18:43   ` Hannes Reinecke
2016-11-02  0:09   ` Andrey Grodzovsky [this message]
2016-11-02  0:09     ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v2) Andrey Grodzovsky
2016-11-02  2:07     ` Hannes Reinecke
2016-11-02  2:07       ` Hannes Reinecke
2016-11-02 10:05       ` Sreekanth Reddy
     [not found]         ` <CAJphD_qrQftfCOn_uzXCfdX=Xv9BYvVQ60AZ4DR2rc3gfXQa_Q@mail.gmail.com>
     [not found]           ` <30w645ulbhlofxrk1h4a9q3s.1478144944778@email.android.com>
2016-11-04 12:45             ` Sreekanth Reddy
2016-11-04 14:51               ` Hannes Reinecke
2016-11-04 16:35                 ` Martin K. Petersen
2016-11-04 16:35                   ` Martin K. Petersen
2018-04-24  9:09                   ` Steffen Maier
2018-04-24 12:33                     ` Hannes Reinecke
2016-11-05 13:17                 ` Andrey Grodzovsky
2016-11-10 12:07                   ` Sreekanth Reddy
2016-11-10 13:42                     ` [PATCH] [SCSI] mpt3sas: Fix secure erase premature termination (v3) Andrey Grodzovsky
2016-11-10 13:42                       ` 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-10 14:35                           ` Andrey Grodzovsky
2016-11-11  4:38                           ` Sreekanth Reddy
2018-04-23 18:28                             ` Igor Rybak
2018-04-24  7:25                               ` Greg KH
2016-11-12 15:29                           ` Martin K. Petersen
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478045394-19536-1-git-send-email-andrey2805@gmail.com \
    --to=andrey2805@gmail.com \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=Sreekanth.Reddy@broadcom.com \
    --cc=chaitra.basappa@broadcom.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sathya.prakash@broadcom.com \
    --cc=stable@vger.kernel.org \
    --cc=suganath-prabu.subramani@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.