Skip to contentSkip to conversation

Patch "scsi: virtio_scsi: let host do exception handling" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Jul 22, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

scsi: virtio_scsi: let host do exception handling

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
scsi-virtio_scsi-let-host-do-exception-handling.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e72c9a2a67a6400c8ef3d01d4c461dbbbfa0e1f0 Mon Sep 17 00:00:00 2001

From: Paolo Bonzini <[email protected]>
Date: Wed, 21 Jun 2017 16:35:46 +0200
Subject: scsi: virtio_scsi: let host do exception handling

From: Paolo Bonzini <[email protected]>

commit e72c9a2a67a6400c8ef3d01d4c461dbbbfa0e1f0 upstream.

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.

[mkp: fixed typo]

---
 drivers/scsi/virtio_scsi.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/scsi/virtio_scsi.c +12 -0
@@ -796,6 +796,16 @@ static int virtscsi_map_queues(struct Sc
 	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 metal.  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 virtscs
 	.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 virtscs
 	.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,

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/scsi-virtio_scsi-let-host-do-exception-handling.patch queue-4.12/scsi-virtio_scsi-always-read-vpd-pages-for-multiqueue-too.patch