* [PATCH] virtio_scsi: let host do exception handling
@ 2017-06-21 14:35 Paolo Bonzini
2017-06-26 17:11 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2017-06-21 14:35 UTC (permalink / raw)
To: linux-kernel, virtualization
Cc: Douglas Miller, James E.J. Bottomley, Martin K. Petersen,
Hannes Reinecke, linux-scsi, stable
virtio_scsi tries to do exception handling after the default
30 seconds timeout expires. However, it's better to let the host
control the timeout, otherwise with a heavy I/O load it is
likely that an abort will also timeout. This leads to fatal
errors like filesystems going offline.
Disable the 'sd' timeout and allow the host to do exception
handling, following the precedent of the storvsc driver.
Hannes has a proposal to introduce timeouts in virtio, but
this provides an immediate solution for stable kernels too.
Reported-by: Douglas Miller <dougmill@linux.vnet.ibm.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: linux-scsi@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
drivers/scsi/virtio_scsi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index f8dbfeee6c63..55d344ea6869 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -796,6 +796,16 @@ static int virtscsi_map_queues(struct Scsi_Host *shost)
return blk_mq_virtio_map_queues(&shost->tag_set, vscsi->vdev, 2);
}
+/*
+ * The host guarantees to respond to each command, although I/O latencies might
+ * be higher than on bare meta. Reset the timer unconditionally to give the
+ * host a chance to perform EH.
+ */
+static enum blk_eh_timer_return virtscsi_eh_timed_out(struct scsi_cmnd *scmnd)
+{
+ return BLK_EH_RESET_TIMER;
+}
+
static struct scsi_host_template virtscsi_host_template_single = {
.module = THIS_MODULE,
.name = "Virtio SCSI HBA",
@@ -806,6 +816,7 @@ static struct scsi_host_template virtscsi_host_template_single = {
.change_queue_depth = virtscsi_change_queue_depth,
.eh_abort_handler = virtscsi_abort,
.eh_device_reset_handler = virtscsi_device_reset,
+ .eh_timed_out = virtscsi_eh_timed_out,
.slave_alloc = virtscsi_device_alloc,
.can_queue = 1024,
@@ -826,6 +837,7 @@ static struct scsi_host_template virtscsi_host_template_multi = {
.change_queue_depth = virtscsi_change_queue_depth,
.eh_abort_handler = virtscsi_abort,
.eh_device_reset_handler = virtscsi_device_reset,
+ .eh_timed_out = virtscsi_eh_timed_out,
.can_queue = 1024,
.dma_boundary = UINT_MAX,
--
2.13.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] virtio_scsi: let host do exception handling
2017-06-21 14:35 [PATCH] virtio_scsi: let host do exception handling Paolo Bonzini
@ 2017-06-26 17:11 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2017-06-26 17:11 UTC (permalink / raw)
To: Paolo Bonzini
Cc: linux-kernel, virtualization, Douglas Miller,
James E.J. Bottomley, Martin K. Petersen, Hannes Reinecke,
linux-scsi, stable
Paolo,
> virtio_scsi tries to do exception handling after the default 30
> seconds timeout expires. However, it's better to let the host control
> the timeout, otherwise with a heavy I/O load it is likely that an
> abort will also timeout. This leads to fatal errors like filesystems
> going offline.
>
> Disable the 'sd' timeout and allow the host to do exception handling,
> following the precedent of the storvsc driver.
Applied to 4.13/scsi-queue. Thank you!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-26 17:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-21 14:35 [PATCH] virtio_scsi: let host do exception handling Paolo Bonzini
2017-06-26 17:11 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox