All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libsas: Disable asynchronous aborts for SATA devices
@ 2018-01-09 15:43 Hannes Reinecke
  2018-01-10  8:15 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hannes Reinecke @ 2018-01-09 15:43 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi,
	Yves-Alexis Perez, Hannes Reinecke, Hannes Reinecke

Handling CD-ROM devices from libsas is decidedly odd, as libata
relies on SCSI EH to be started to figure out that no medium is
present.
So we cannot do asynchronous aborts for SATA devices.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/libsas/sas_scsi_host.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 6267272..6de9681 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -487,15 +487,28 @@ static int sas_queue_reset(struct domain_device *dev, int reset_type,
 
 int sas_eh_abort_handler(struct scsi_cmnd *cmd)
 {
-	int res;
+	int res = TMF_RESP_FUNC_FAILED;
 	struct sas_task *task = TO_SAS_TASK(cmd);
 	struct Scsi_Host *host = cmd->device->host;
+	struct domain_device *dev = cmd_to_domain_dev(cmd);
 	struct sas_internal *i = to_sas_internal(host->transportt);
+	unsigned long flags;
 
 	if (!i->dft->lldd_abort_task)
 		return FAILED;
 
-	res = i->dft->lldd_abort_task(task);
+	spin_lock_irqsave(host->host_lock, flags);
+	/* We cannot do async aborts for SATA devices */
+	if (dev_is_sata(dev) && !host->host_eh_scheduled) {
+		spin_unlock_irqrestore(host->host_lock, flags);
+		return FAILED;
+	}
+	spin_unlock_irqrestore(host->host_lock, flags);
+
+	if (task)
+		res = i->dft->lldd_abort_task(task);
+	else
+		SAS_DPRINTK("no task to abort\n");
 	if (res == TMF_RESP_FUNC_SUCC || res == TMF_RESP_FUNC_COMPLETE)
 		return SUCCESS;
 
-- 
1.8.5.6

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

* Re: [PATCH] libsas: Disable asynchronous aborts for SATA devices
  2018-01-09 15:43 [PATCH] libsas: Disable asynchronous aborts for SATA devices Hannes Reinecke
@ 2018-01-10  8:15 ` Christoph Hellwig
  2018-01-10  8:51   ` Hannes Reinecke
  2018-01-10  8:27 ` Yves-Alexis Perez
  2018-01-10 21:40 ` Martin K. Petersen
  2 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2018-01-10  8:15 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Yves-Alexis Perez, Hannes Reinecke

Looks fine to me for 4.15 and -stable:

Reviewed-by: Christoph Hellwig <hch@lst.de>

But we really need to fix this properly in the long run.

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

* Re: [PATCH] libsas: Disable asynchronous aborts for SATA devices
  2018-01-09 15:43 [PATCH] libsas: Disable asynchronous aborts for SATA devices Hannes Reinecke
  2018-01-10  8:15 ` Christoph Hellwig
@ 2018-01-10  8:27 ` Yves-Alexis Perez
  2018-01-10 21:40 ` Martin K. Petersen
  2 siblings, 0 replies; 5+ messages in thread
From: Yves-Alexis Perez @ 2018-01-10  8:27 UTC (permalink / raw)
  To: Hannes Reinecke, Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

On Tue, 2018-01-09 at 16:43 +0100, Hannes Reinecke wrote:
> Handling CD-ROM devices from libsas is decidedly odd, as libata
> relies on SCSI EH to be started to figure out that no medium is
> present.
> So we cannot do asynchronous aborts for SATA devices.

The box boots fine with this change, thanks!

Tested-by: Yves-Alexis Perez <corsac@debian.org>
-- 
Yves-Alexis

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] libsas: Disable asynchronous aborts for SATA devices
  2018-01-10  8:15 ` Christoph Hellwig
@ 2018-01-10  8:51   ` Hannes Reinecke
  0 siblings, 0 replies; 5+ messages in thread
From: Hannes Reinecke @ 2018-01-10  8:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Martin K. Petersen, James Bottomley, linux-scsi,
	Yves-Alexis Perez, Hannes Reinecke

On 01/10/2018 09:15 AM, Christoph Hellwig wrote:
> Looks fine to me for 4.15 and -stable:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> But we really need to fix this properly in the long run.
> 
Looked into it, but I'm not sure if we can due to the fundamental
differences between SCSI and libata EH.

And there really is no way on how we can do async aborts on SATA; as
soon as we're submitting NCQ commands _all_ commands will be aborted on
error and we have to pick up the pieces.

We might be handling things a tad better than now (we're always punting
the abort to a workqueue, only to figure out from the workqueue function
that we should've invoked SCSI EH proper).
But I can't really see a better way here.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH] libsas: Disable asynchronous aborts for SATA devices
  2018-01-09 15:43 [PATCH] libsas: Disable asynchronous aborts for SATA devices Hannes Reinecke
  2018-01-10  8:15 ` Christoph Hellwig
  2018-01-10  8:27 ` Yves-Alexis Perez
@ 2018-01-10 21:40 ` Martin K. Petersen
  2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2018-01-10 21:40 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Yves-Alexis Perez, Hannes Reinecke


Hannes,

> Handling CD-ROM devices from libsas is decidedly odd, as libata relies
> on SCSI EH to be started to figure out that no medium is present.  So
> we cannot do asynchronous aborts for SATA devices.

Applied to 4.15/scsi-fixes. Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2018-01-10 21:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09 15:43 [PATCH] libsas: Disable asynchronous aborts for SATA devices Hannes Reinecke
2018-01-10  8:15 ` Christoph Hellwig
2018-01-10  8:51   ` Hannes Reinecke
2018-01-10  8:27 ` Yves-Alexis Perez
2018-01-10 21:40 ` Martin K. Petersen

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.