From patchwork Wed Jun 21 14:35:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9802047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 788106038C for ; Wed, 21 Jun 2017 14:36:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A61E223B2 for ; Wed, 21 Jun 2017 14:36:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EEB5223C7; Wed, 21 Jun 2017 14:36:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D86F3223B3 for ; Wed, 21 Jun 2017 14:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752658AbdFUOgE (ORCPT ); Wed, 21 Jun 2017 10:36:04 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33630 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752454AbdFUOgC (ORCPT ); Wed, 21 Jun 2017 10:36:02 -0400 Received: by mail-wr0-f193.google.com with SMTP id x23so27012810wrb.0; Wed, 21 Jun 2017 07:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=wZMH1GGH631YMPfkPSyo/Pm7ERU+2tjwX03PaZYxCDw=; b=GySkhFdRPEwpTco6/tEypyAjzWBWDnU6U3cQTo7egx/iFaQELfxbC1MukfDOpwvAJi I6akiqPp0EGAEYOqiQZaVEkgApe32FwYWSFdiaqjRXujbxbV+hLWLtFgEnuFYN3ADYbq ZGdKkrbq5e19sd77xVDP4IehHOCa37jCT2A6iYxH4Pr87xZ0T1QQ2S3mK6s3Er5GdVLj BJpnfAdmID2RmCCKHCRXzTseAoxowwlaMPMOpyTGRuNKcKKleaHZUhepfWjV0RbsTb2j QvY11CW4baDu/8gzd2yoGhW0NNtXmbXs+5tj1OQIcCOdK5NgfdrRp7Bs+QMB29StTKDT sSCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=wZMH1GGH631YMPfkPSyo/Pm7ERU+2tjwX03PaZYxCDw=; b=lgPQR4Jt1bC1Y32ARXxa7DQ3FFVo9cgwuPjQ+gTBJ+/gigkGJtydxPK4gQrgA01mlX 0PMuUyEwlJq5sP47W/bJf79MG20ky5yTSX+Jo6SMKi+pYni96FgOMxCc8vNQmleBuSjg ggjkm4TTDrKBT5yfe9M2J7tITa9CQ0TuEIdbmPvDDfQBSpQoliHFc9AdVcvutDKc1u/2 0C0oKm3M8YRPb4WiyNFLaxpPtXKmY4yoOSOu3apI6WYyWcBjdTJ5poUKoQfAFt4y9luE k96kFwQyD0RJT3IVNWhmC8cNKgm7n2DPlotHJuUxiLG3/Qy6AtSOm9doxLlNpHtjHBT8 kzsg== X-Gm-Message-State: AKS2vOysqMJGbqDsYhBVpO9du02RL6vwhQVKbJfeogZOdTU6AIlTFiMX n+xm1rbHkTZGsNhbtkk= X-Received: by 10.28.95.135 with SMTP id t129mr7124016wmb.61.1498055750074; Wed, 21 Jun 2017 07:35:50 -0700 (PDT) Received: from donizetti.redhat.com (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id 92sm19763771wrb.55.2017.06.21.07.35.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Jun 2017 07:35:48 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: Douglas Miller , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , linux-scsi@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] virtio_scsi: let host do exception handling Date: Wed, 21 Jun 2017 16:35:46 +0200 Message-Id: <20170621143546.5826-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.13.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Hannes Reinecke Cc: linux-scsi@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini --- 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,