]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: virtio_scsi: let host do exception handling
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 16 Nov 2018 00:36:51 +0000 (08:36 +0800)
committerBrian Maly <brian.maly@oracle.com>
Tue, 20 Nov 2018 19:17:56 +0000 (14:17 -0500)
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]

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>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 28856913

(cherry picked from commit e72c9a2a67a6400c8ef3d01d4c461dbbbfa0e1f0)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
- The function above virtscsi_host_template_single() is
  virtscsi_target_destroy() (in uek4), but not virtscsi_map_queues() (in
  upstream)
- virtscsi_host_template_multi.slave_alloc is implemented in upstream, but
  not uek4

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Patrick Colp <patrick.colp@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/scsi/virtio_scsi.c

index f164f24a4a556cfe19c91f9031682a8ff6d9f0c5..731a321b801ee345e40c399eac8d6c78dbe5a50a 100644 (file)
@@ -751,6 +751,16 @@ static void virtscsi_target_destroy(struct scsi_target *starget)
        kfree(tgt);
 }
 
+/*
+ * 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",
@@ -761,6 +771,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,
 
        .can_queue = 1024,
        .dma_boundary = UINT_MAX,
@@ -780,6 +791,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,