From patchwork Mon May 18 11:24:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 6428171 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A1E39C0432 for ; Mon, 18 May 2015 11:24:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7E84205EB for ; Mon, 18 May 2015 11:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C51CA205DC for ; Mon, 18 May 2015 11:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753524AbbERLYq (ORCPT ); Mon, 18 May 2015 07:24:46 -0400 Received: from mail-by2on0075.outbound.protection.outlook.com ([207.46.100.75]:46928 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751435AbbERLYo (ORCPT ); Mon, 18 May 2015 07:24:44 -0400 Received: from BLUPR02CA049.namprd02.prod.outlook.com (25.160.23.167) by BLUPR02MB277.namprd02.prod.outlook.com (10.141.76.16) with Microsoft SMTP Server (TLS) id 15.1.166.22; Mon, 18 May 2015 11:24:42 +0000 Received: from BY2FFO11FD039.protection.gbl (2a01:111:f400:7c0c::132) by BLUPR02CA049.outlook.office365.com (2a01:111:e400:8ad::39) with Microsoft SMTP Server (TLS) id 15.1.166.22 via Frontend Transport; Mon, 18 May 2015 11:24:41 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BY2FFO11FD039.mail.protection.outlook.com (10.1.14.224) with Microsoft SMTP Server id 15.1.172.14 via Frontend Transport; Mon, 18 May 2015 11:24:40 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 7B.27.06265.8FBC9555; Mon, 18 May 2015 04:24:40 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.224.2; Mon, 18 May 2015 04:24:40 -0700 X-AuditID: ac160a69-f790f6d000001879-15-5559cbf8ffe4 Received: from [10.50.231.56] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id 38.E7.03643.7FBC9555; Mon, 18 May 2015 04:24:40 -0700 (PDT) Message-ID: <5559CBF6.8000903@sandisk.com> Date: Mon, 18 May 2015 13:24:38 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Doug Ledford CC: James Bottomley , Sagi Grimberg , Sebastian Parschauer , linux-rdma , "linux-scsi@vger.kernel.org" Subject: [PATCH v2 07/12] scsi_transport_srp: Reduce failover time References: <5559CB3A.6060102@sandisk.com> In-Reply-To: <5559CB3A.6060102@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeLIzCtJLcpLzFFi42JZI8azSPfH6chQgyXfDS1env/AavF//W0W i2eHelksuq/vYLO40faAzeLkbX4HNo9n0w8zeRz+8YPZ48+fz8we7/ddZfP4vEkugDWKyyYl NSezLLVI3y6BK+Pm5QPsBfv5Kyb/m8bWwDiRt4uRg0NCwERi8jKhLkZOIFNM4sK99WxdjFwc QgInGCX27nnGCuHsYJTYfPo7C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SV2q6u9pUdQXc2bRK8pan839o98NTx f62mv77tNVBY2izpohF7qaFPkT9DW2bSrLWVItI6ltturFfr9/04+cLjhN4Uk44VfXvTfC7/ KxOVy6m+e9dhZUTvBN8j/nYPCi5zCr/x6b+xROBGFscumStHHKuyi3flKei0HZjO/btWiaU4 I9FQi7moOBEAep4RMw8CAAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD039; 1:yklqMLMIEn7IBoY+ykVeGg86m0Dr1fnw5QdDQrKwItJo+CQ3NPdHenXSxyNloj6sJKiDf2QyQ/PWi+lcwb+Oim+PSYGVloFSeiLjVKd4K+ev70t2gHC+dW8wkhy392fIzsiDf86mAKR8YCuv1/UFmtotkcpVwjR/Dtz3IphoV34TVSPtwA9Ltfdd2/dDEMuFa7wF2heKoxUc1ZCeDXs8Zc1e4IENV9iuzNEmooHeWHJoYrRyUm7IEmPqpYLuEIfkg81AfAX/cNk6QpH9jlsu4m1ETZ4Th8ZXdsZeVoS0uyWpHo2UgQt4hgplse+mRT6sbEcu4Usnp7AfSGNY2nsx3Q== X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(199003)(189002)(47776003)(92566002)(86362001)(64706001)(69596002)(65806001)(19580395003)(64126003)(36756003)(46102003)(2950100001)(59896002)(87936001)(19580405001)(87266999)(80316001)(83506001)(50466002)(50986999)(65816999)(54356999)(76176999)(81156007)(97736004)(4001540100001)(4001350100001)(229853001)(65956001)(77156002)(68736005)(23676002)(110136002)(62966003)(33656002)(5001960100002)(5001860100001)(77096005)(106466001)(189998001)(5001830100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB277; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:ErrorRetry; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB277; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BLUPR02MB277; BCL:0; PCL:0; RULEID:; SRVR:BLUPR02MB277; X-Forefront-PRVS: 058043A388 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2015 11:24:40.8775 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB277 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Unlike FC, there is no risk that SCSI devices will be offlined by the SCSI error handler if the SCSI error handler is started while a reconnect attempt is ongoing. Hence report timeout errors as soon as possible if a higher software layer (e.g. multipathd) needs to be informed about a timeout. It is assumed that if both fast_io_fail_tmo < 0 and rport->dev_loss_tmo < 0 that this means that there is no need to report timeouts quickly. Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Sagi Grimberg Cc: Sebastian Parschauer --- drivers/scsi/scsi_transport_srp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index f115f67..a85292b 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -61,6 +61,11 @@ static inline struct Scsi_Host *rport_to_shost(struct srp_rport *r) return dev_to_shost(r->dev.parent); } +static inline struct srp_rport *shost_to_rport(struct Scsi_Host *shost) +{ + return transport_class_to_srp_rport(&shost->shost_gendev); +} + /** * srp_tmo_valid() - check timeout combination validity * @reconnect_delay: Reconnect delay in seconds. @@ -628,9 +633,11 @@ static enum blk_eh_timer_return srp_timed_out(struct scsi_cmnd *scmd) struct scsi_device *sdev = scmd->device; struct Scsi_Host *shost = sdev->host; struct srp_internal *i = to_srp_internal(shost->transportt); + struct srp_rport *rport = shost_to_rport(shost); pr_debug("timeout for sdev %s\n", dev_name(&sdev->sdev_gendev)); - return i->f->reset_timer_if_blocked && scsi_device_blocked(sdev) ? + return rport->fast_io_fail_tmo < 0 && rport->dev_loss_tmo < 0 && + i->f->reset_timer_if_blocked && scsi_device_blocked(sdev) ? BLK_EH_RESET_TIMER : BLK_EH_NOT_HANDLED; }