Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1533170

[PATCH 4.4 09/21] scsi: mpt3sas: Fix secure erase premature termination

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 09/21] scsi: mpt3sas: Fix secure erase premature termination
Date Wed, 30 Nov 2016 11:10:01 +0100
Message-ID <sJ9ZT-4JS-1@gated-at.bofh.it> (permalink)
References <sJ9nb-4fE-1@gated-at.bofh.it>
X-Mailer git-send-email 2.10.2
User-Agent quilt/0.65
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 72
Organization linux.* mail to news gateway
X-Original-Cc Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Andrey Grodzovsky <andrey2805@gmail.com>, Sreekanth Reddy <Sreekanth.Reddy@broadcom.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>, Hannes Reinecke <hare@suse.de>, "Martin K. Petersen" <martin.petersen@oracle.com>
X-Original-Date Wed, 30 Nov 2016 10:27:25 +0100
X-Original-Message-ID <20161130092655.398094910@linuxfoundation.org>
X-Original-References <20161130092654.890709900@linuxfoundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1533170

Show key headers only | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrey Grodzovsky <andrey2805@gmail.com>

commit 18f6084a989ba1b38702f9af37a2e4049a924be6 upstream.

This is a work around for a bug with LSI Fusion MPT SAS2 when perfoming
secure erase. Due to the very long time the operation takes, commands
issued during the erase will time out and will trigger execution of the
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 secure erase.

Set device state to busy while ATA passthrough commands are in progress.

[mkp: hand applied to 4.9/scsi-fixes, tweaked patch description]

Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.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>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3831,7 +3831,10 @@ _scsih_eedp_error_handling(struct scsi_c
 	    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
@@ -3859,6 +3862,13 @@ scsih_qcmd(struct Scsi_Host *shost, stru
 	if (ioc->logging_level & MPT_DEBUG_SCSI)
 		scsi_print_command(scmd);
 
+	/*
+	 * 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;
@@ -4431,6 +4441,9 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *i
 	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) {

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/21] 4.4.36-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 10:30 +0100
  [PATCH 4.4 07/21] USB: serial: ftdi_sio: add support for TI CC3200 LaunchPad Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 10:30 +0100
  [PATCH 4.4 15/21] parisc: Fix race in pci-dma.c Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 10:40 +0100
  [PATCH 4.4 06/21] USB: serial: cp210x: add ID for the Zone DPMX Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 10:40 +0100
  [PATCH 4.4 21/21] mei: fix return value on disconnection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 10:40 +0100
  [PATCH 4.4 17/21] mpi: Fix NULL ptr dereference in mpi_powm() [ver #3] Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 10:40 +0100
  [PATCH 4.4 20/21] mei: me: fix place for kaby point device ids. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 10:40 +0100
  [PATCH 4.4 05/21] usb: chipidea: move the lock initialization to core file Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 10:40 +0100
  [PATCH 4.4 19/21] mei: me: disable driver on SPT SPS firmware Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:00 +0100
  [PATCH 4.4 08/21] Fix USB CB/CBI storage devices with CONFIG_VMAP_STACK=y Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:00 +0100
  [PATCH 4.4 16/21] parisc: Also flush data TLB in flush_icache_page_asm Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:00 +0100
  [PATCH 4.4 12/21] apparmor: fix change_hat not finding hat after policy replacement Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:10 +0100
  [PATCH 4.4 09/21] scsi: mpt3sas: Fix secure erase premature termination Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:10 +0100
  [PATCH 4.4 10/21] tile: avoid using clocksource_cyc2ns with absolute cycle count Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:10 +0100
  [PATCH 4.4 14/21] parisc: Fix races in parisc_setup_cache_timing() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:10 +0100
  [PATCH 4.4 13/21] NFSv4.x: hide array-bounds warning Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:10 +0100
  [PATCH 4.4 11/21] cfg80211: limit scan results cache size Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 11:10 +0100
  Re: [PATCH 4.4 00/21] 4.4.36-stable review Andre Noll <maan@tuebingen.mpg.de> - 2016-11-30 14:50 +0100
    Re: [PATCH 4.4 00/21] 4.4.36-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 15:00 +0100
      Re: [PATCH 4.4 00/21] 4.4.36-stable review Andre Noll <maan@tuebingen.mpg.de> - 2016-11-30 15:10 +0100
        Re: [PATCH 4.4 00/21] 4.4.36-stable review Eric Dumazet <edumazet@google.com> - 2016-11-30 15:30 +0100
          Re: [PATCH 4.4 00/21] 4.4.36-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-30 15:40 +0100
        Re: [PATCH 4.4 00/21] 4.4.36-stable review David Miller <davem@davemloft.net> - 2016-11-30 16:00 +0100
          Re: [PATCH 4.4 00/21] 4.4.36-stable review Andre Noll <maan@tuebingen.mpg.de> - 2016-11-30 16:20 +0100
      Re: [PATCH 4.4 00/21] 4.4.36-stable review David Miller <davem@davemloft.net> - 2016-11-30 16:00 +0100
        Re: [PATCH 4.4 00/21] 4.4.36-stable review Greg KH <gregkh@linuxfoundation.org> - 2016-11-30 16:40 +0100
  Re: [PATCH 4.4 00/21] 4.4.36-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-11-30 17:10 +0100
  Re: [PATCH 4.4 00/21] 4.4.36-stable review Guenter Roeck <linux@roeck-us.net> - 2016-12-01 00:30 +0100

csiph-web