From patchwork Mon May 18 11:22:44 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: 6428071 Return-Path: X-Original-To: patchwork-linux-scsi@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 BCCC3C0433 for ; Mon, 18 May 2015 11:22:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DBE04200F4 for ; Mon, 18 May 2015 11:22:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA946205EB for ; Mon, 18 May 2015 11:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753574AbbERLWy (ORCPT ); Mon, 18 May 2015 07:22:54 -0400 Received: from mail-bl2on0055.outbound.protection.outlook.com ([65.55.169.55]:19846 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753894AbbERLWw (ORCPT ); Mon, 18 May 2015 07:22:52 -0400 Received: from BY1PR0201CA0023.namprd02.prod.outlook.com (25.160.191.161) by DM2PR02MB285.namprd02.prod.outlook.com (10.141.55.145) with Microsoft SMTP Server (TLS) id 15.1.160.19; Mon, 18 May 2015 11:22:49 +0000 Received: from BL2FFO11OLC003.protection.gbl (2a01:111:f400:7c09::116) by BY1PR0201CA0023.outlook.office365.com (2a01:111:e400:4814::33) with Microsoft SMTP Server (TLS) id 15.1.166.22 via Frontend Transport; Mon, 18 May 2015 11:22:48 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; mellanox.com; dkim=none (message not signed) header.d=none; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.172 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.172; helo=milsmgep11.sandisk.com; Received: from milsmgep11.sandisk.com (63.163.107.172) by BL2FFO11OLC003.mail.protection.outlook.com (10.173.161.187) with Microsoft SMTP Server id 15.1.172.14 via Frontend Transport; Mon, 18 May 2015 11:22:47 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id D0.C3.04667.68BC9555; Mon, 18 May 2015 04:22:46 -0700 (PDT) Received: from milsmgip12.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:22:46 -0700 X-AuditID: ac160a68-f790b6d00000123b-5d-5559cb86998d Received: from [10.50.231.56] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id D2.47.04661.48BC9555; Mon, 18 May 2015 04:22:46 -0700 (PDT) Message-ID: <5559CB84.7020506@sandisk.com> Date: Mon, 18 May 2015 13:22:44 +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 02/12] scsi_transport_srp: Fix a race condition References: <5559CB3A.6060102@sandisk.com> In-Reply-To: <5559CB3A.6060102@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42JZI8azSLftdGSoQetOWYuX5z+wWvxff5vF 4tmhXhaL7us72CxutD1gszh5m9+BzePZ9MNMHod//GD2+PPnM7PH+31X2Tw+b5ILYI3isklJ zcksSy3St0vgyrgzs5+pYC9fRfflQ4wNjNd4uhg5OSQETCR+rutih7DFJC7cW8/WxcjFISRw glHi3tMF7BDODkaJpTM/M8N0XLjby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Gn9YmW31f6eg8jYHRPXyFroaCjZhtcKtqmr/D J4bo09Onl3tc7utTZ9quuS9i/a9g/w0NbnzOEX8XaDWbGP3RqDhmy25/3WPLuZ57C2KLbpsw pLyb6HVdIr/EuNsgcO2Nd8fv//nll7embs7iQ2GanQ57BLN+7Qt4fKCkwKLmuBJLcUaioRZz UXEiAOBVkMwSAgAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC003; 1:oF6MfJ3ZCmwBv5bpKJS6mQtzNHHefw1dKbOi4BraWwN4/1sygGT2x5KKqHDOlEOTt4ge+ZW71n5mnXnB4ZLN8dHqjXnWHrBitfCzdS+xMEqcrr9qRmf1P9FYcoMkAMEz8mB2ZELsLgKhd10VFtgWrajiBGFTuk5h8hSGWXxnJUNrJljMuMEyE7tGJhZ8sjRj1dzn3sVQilAiGnq/HlfYJtuBcsrWs4mzE3d334r2eHw4iFxgJiR435p0GpzF+micTnbseHEKjl65KcSVAVG2LQQ2Ftr0UAUV85IwheInEWeP6lG+pRT6qcE93evvF3CDFbwT1RngcZSFvjyHgmA8nQ== X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(189002)(199003)(110136002)(189998001)(5001960100002)(5001830100001)(5001860100001)(23676002)(68736005)(106466001)(64126003)(33656002)(69596002)(19580395003)(19580405001)(59896002)(229853001)(36756003)(83506001)(80316001)(65816999)(87266999)(50466002)(54356999)(47776003)(86362001)(65806001)(65956001)(87936001)(50986999)(76176999)(2950100001)(77156002)(62966003)(4001350100001)(46102003)(81156007)(92566002)(64706001)(77096005)(4001540100001)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR02MB285; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; PTR:ErrorRetry; MX:1; A:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR02MB285; 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:DM2PR02MB285; BCL:0; PCL:0; RULEID:; SRVR:DM2PR02MB285; X-Forefront-PRVS: 058043A388 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2015 11:22:47.0004 (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.172]; Helo=[milsmgep11.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR02MB285 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 e05cd7e..f115f67 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -439,8 +439,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); + } } /**