From patchwork Thu Apr 30 08:57:10 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: 6300821 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 87FFCBEEE1 for ; Thu, 30 Apr 2015 09:12:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B44B22015A for ; Thu, 30 Apr 2015 09:12:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AFE8B2013A for ; Thu, 30 Apr 2015 09:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751072AbbD3JMW (ORCPT ); Thu, 30 Apr 2015 05:12:22 -0400 Received: from mail-bl2on0066.outbound.protection.outlook.com ([65.55.169.66]:38432 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750811AbbD3JMU (ORCPT ); Thu, 30 Apr 2015 05:12:20 -0400 Received: from BLUPR02CA054.namprd02.prod.outlook.com (25.160.23.172) by DM2PR0201MB1037.namprd02.prod.outlook.com (25.160.219.147) with Microsoft SMTP Server (TLS) id 15.1.154.19; Thu, 30 Apr 2015 08:57:15 +0000 Received: from BL2FFO11FD018.protection.gbl (2a01:111:f400:7c09::190) by BLUPR02CA054.outlook.office365.com (2a01:111:e400:8ad::44) with Microsoft SMTP Server (TLS) id 15.1.154.19 via Frontend Transport; Thu, 30 Apr 2015 08:57:14 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; odin.com; 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 BL2FFO11FD018.mail.protection.outlook.com (10.173.161.36) with Microsoft SMTP Server id 15.1.160.8 via Frontend Transport; Thu, 30 Apr 2015 08:57:12 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 3C.1A.14695.86EE1455; Thu, 30 Apr 2015 01:57:12 -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; Thu, 30 Apr 2015 01:57:12 -0700 X-AuditID: ac160a69-f79656d000003967-50-5541ee68f489 Received: from [10.50.231.61] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id 66.CC.19112.66EE1455; Thu, 30 Apr 2015 01:57:12 -0700 (PDT) Message-ID: <5541EE66.7090608@sandisk.com> Date: Thu, 30 Apr 2015 10:57:10 +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 02/12] scsi_transport_srp: Fix a race condition References: <5541EE21.3050809@sandisk.com> In-Reply-To: <5541EE21.3050809@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42JZI8azSDfjnWOowaYzGhYvz39gtfi//jaL xbNDvSwW3dd3sFncaHvAZnHyNr8Dm8ez6YeZPA7/+MHs8efPZ2aP9/uusnl83iQXwBrFZZOS mpNZllqkb5fAldH3+hJ7wV6+ilVnPrI0MF7j6WLk5JAQMJGY1naeFcIWk7hwbz1bFyMXh5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JxcEo1MJZ8sN9noVqveOXOx62Xqm5P7ZrL2vnzl/jiJwdNVhn73tA6 M51xm+/fhcJRi90vVJ7N0HH0yCrfdH7Xn8N7c+as6jxfO3nL+7aXHre3HBQPn+f0tPHtASXL xVdr0g6efHlo04QHVWn9brWn/t4MPPJbYnvwgxCG5L5U1/uLp3Q2mSQbX3/OxtGtxFKckWio xVxUnAgASV8N5BICAAA= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(189002)(199003)(77096005)(59896002)(2950100001)(47776003)(4001350100001)(87936001)(62966003)(77156002)(92566002)(33656002)(65806001)(65956001)(229853001)(76176999)(87266999)(46102003)(50986999)(54356999)(86362001)(19580405001)(23676002)(80316001)(83506001)(106466001)(19580395003)(64126003)(36756003)(65816999)(50466002)(5001960100002)(110136002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0201MB1037; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0201MB1037; 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:DM2PR0201MB1037; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0201MB1037; X-Forefront-PRVS: 056297E276 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2015 08:57:12.6997 (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: DM2PR0201MB1037 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 Avoid that srp_terminate_io() can get invoked while srp_queuecommand() is in progress. This patch avoids that an I/O timeout can trigger the following kernel warning: WARNING: at drivers/infiniband/ulp/srp/ib_srp.c:1447 srp_terminate_io+0xef/0x100 [ib_srp]() Call Trace: [] dump_stack+0x4e/0x68 [] warn_slowpath_common+0x81/0xa0 [] warn_slowpath_null+0x1a/0x20 [] srp_terminate_io+0xef/0x100 [ib_srp] [] __rport_fail_io_fast+0xba/0xc0 [scsi_transport_srp] [] rport_fast_io_fail_timedout+0xe0/0xf0 [scsi_transport_srp] [] process_one_work+0x1db/0x780 [] worker_thread+0x11b/0x450 [] kthread+0xe4/0x100 [] ret_from_fork+0x7c/0xb0 See also patch "scsi_transport_srp: Add transport layer error handling" (commit ID 29c17324803c). Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Sagi Grimberg Cc: Sebastian Parschauer Cc: #v3.13 --- drivers/scsi/scsi_transport_srp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 6ce1c48..4a44337 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -437,8 +437,10 @@ static void __rport_fail_io_fast(struct srp_rport *rport) /* Involve the LLD if possible to terminate all I/O on the rport. */ i = to_srp_internal(shost->transportt); - if (i->f->terminate_rport_io) + if (i->f->terminate_rport_io) { + srp_wait_for_queuecommand(shost); i->f->terminate_rport_io(rport); + } } /**