All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mpt2sas: Fix secure erase premature termination.
@ 2016-11-18 11:42 Suganath Prabu S
  2016-11-18 11:54 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Suganath Prabu S @ 2016-11-18 11:42 UTC (permalink / raw)
  To: stable, greg, andrey2805, hch
  Cc: jejb, martin.petersen, linux-scsi, FusionLinux.pdl, hare,
	Sathya.Prakash, 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 <suganath-prabu.subramani@broadcom.com>
Cc: stable@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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mpt2sas: Fix secure erase premature termination.
  2016-11-18 11:42 [PATCH] mpt2sas: Fix secure erase premature termination Suganath Prabu S
@ 2016-11-18 11:54 ` Greg KH
       [not found]   ` <CA+RiK67B6CJtw9B0Omisp2h1EgnRsCf77bTtmw294Rscyqu8yg@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2016-11-18 11:54 UTC (permalink / raw)
  To: Suganath Prabu S
  Cc: stable, andrey2805, hch, jejb, martin.petersen, linux-scsi,
	FusionLinux.pdl, hare, Sathya.Prakash

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mpt2sas: Fix secure erase premature termination.
       [not found]   ` <CA+RiK67B6CJtw9B0Omisp2h1EgnRsCf77bTtmw294Rscyqu8yg@mail.gmail.com>
@ 2016-11-21  9:41       ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2016-11-21  9:41 UTC (permalink / raw)
  To: Suganath Prabu Subramani
  Cc: stable, Andrey Grodzovsky, Christoph Hellwig, jejb,
	Martin K. Petersen, linux-scsi, FusionLinux.pdl, Hannes Reinecke,
	Sathya Prakash

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 <andrey2805@gmail.com>
> Date: � Thu Nov 10 09:35:27 2016 -0500
> 
> � � scsi: mpt3sas: Fix secure erase premature termination
> 

For what?  I have no context here...



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mpt2sas: Fix secure erase premature termination.
@ 2016-11-21  9:41       ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2016-11-21  9:41 UTC (permalink / raw)
  To: Suganath Prabu Subramani
  Cc: stable, Andrey Grodzovsky, Christoph Hellwig, jejb,
	Martin K. Petersen, linux-scsi, FusionLinux.pdl, Hannes Reinecke,
	Sathya Prakash

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 <andrey2805@gmail.com>
> Date:   Thu Nov 10 09:35:27 2016 -0500
> 
>     scsi: mpt3sas: Fix secure erase premature termination
> 

For what?  I have no context here...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mpt2sas: Fix secure erase premature termination.
  2016-11-21  9:41       ` Greg KH
@ 2016-11-21  9:53         ` Johannes Thumshirn
  -1 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2016-11-21  9:53 UTC (permalink / raw)
  To: Greg KH
  Cc: Suganath Prabu Subramani, stable, Andrey Grodzovsky,
	Christoph Hellwig, jejb, Martin K. Petersen, linux-scsi,
	FusionLinux.pdl, Hannes Reinecke, Sathya Prakash

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 <andrey2805@gmail.com>
> > 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
jthumshirn@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mpt2sas: Fix secure erase premature termination.
@ 2016-11-21  9:53         ` Johannes Thumshirn
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2016-11-21  9:53 UTC (permalink / raw)
  To: Greg KH
  Cc: Suganath Prabu Subramani, stable, Andrey Grodzovsky,
	Christoph Hellwig, jejb, Martin K. Petersen, linux-scsi,
	FusionLinux.pdl, Hannes Reinecke, Sathya Prakash

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 <andrey2805@gmail.com>
> > 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
jthumshirn@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-21  9:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 11:42 [PATCH] mpt2sas: Fix secure erase premature termination Suganath Prabu S
2016-11-18 11:54 ` Greg KH
     [not found]   ` <CA+RiK67B6CJtw9B0Omisp2h1EgnRsCf77bTtmw294Rscyqu8yg@mail.gmail.com>
2016-11-21  9:41     ` Greg KH
2016-11-21  9:41       ` Greg KH
2016-11-21  9:53       ` Johannes Thumshirn
2016-11-21  9:53         ` Johannes Thumshirn

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.