From patchwork Wed Oct 26 22:55:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9398643 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 35F4060234 for ; Wed, 26 Oct 2016 23:13:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2B35209CF for ; Wed, 26 Oct 2016 23:13:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E78BC29E2F; Wed, 26 Oct 2016 23:13:11 +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 7A9B5209CF for ; Wed, 26 Oct 2016 23:13:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754265AbcJZXNJ (ORCPT ); Wed, 26 Oct 2016 19:13:09 -0400 Received: from mail-cys01nam02on0049.outbound.protection.outlook.com ([104.47.37.49]:31923 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754378AbcJZXNH (ORCPT ); Wed, 26 Oct 2016 19:13:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=HXJn45ukSAYVHr8NVtARhsXyKHLffORIPdoo5clk1h8=; b=AdqO5+LoH8CqWvx1VZ+J/+tG434jyXlY2ZkTQAjzYKl3s2OOiXvTHyJdPL7LBJLRU9NpPfrPpnKzuUwjL0wIx0WQ+y3NpJUIHU9ZdXg5bsHwAsEpX+H5jO/1GucdRoJ+jkUYqUt+9M5nLoWattMh+x/SyyU7LtkavkEddWlqUKA= Received: from BY1PR0201CA0029.namprd02.prod.outlook.com (10.160.191.167) by BN3PR02MB1159.namprd02.prod.outlook.com (10.162.168.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Wed, 26 Oct 2016 22:55:35 +0000 Received: from BY2FFO11FD019.protection.gbl (2a01:111:f400:7c0c::154) by BY1PR0201CA0029.outlook.office365.com (2a01:111:e400:4814::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12 via Frontend Transport; Wed, 26 Oct 2016 22:55:35 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BY2FFO11FD019.mail.protection.outlook.com (10.1.14.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.5 via Frontend Transport; Wed, 26 Oct 2016 22:55:35 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 21.E2.26959.4D131185; Wed, 26 Oct 2016 15:44:36 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.9.6) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Wed, 26 Oct 2016 15:55:34 -0700 X-AuditID: 0ac94369-babff7000001694f-b7-581131d4fb6a Received: from exp-402881.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 9B.FD.02564.66431185; Wed, 26 Oct 2016 15:55:34 -0700 (PDT) Subject: [PATCH 10/12] SRP transport, scsi-mq: Wait for .queue_rq() if necessary To: Jens Axboe References: CC: Christoph Hellwig , James Bottomley , "Martin K. Petersen" , Mike Snitzer , Doug Ledford , Keith Busch , Ming Lei , Laurence Oberman , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-nvme@lists.infradead.org" From: Bart Van Assche Message-ID: <0cd77719-1f11-d5c3-3186-1c7c3cfd6886@sandisk.com> Date: Wed, 26 Oct 2016 15:55:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRmVeSWpSXmKPExsXCddJ5ke4VQ8EIg5mLpCz+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi723tC3mL3vKbvHsUC+LRff1HWwW5z+8YrJYfvwfk0Xbxq+MFu9/ XGd34PWY2PyO3WPnrLvsHov3vGTyeHBoM4vH5iX1HrtvNrB5fHx6i8Xj/b6rbB6fN8kFcEZx 2aSk5mSWpRbp2yVwZTyctomxYLtgxbtrxQ2MV/i6GDk5JARMJJYdnsvWxcjFISSwlEniyN/1 LBDONkaJ1Rt7WGCq2k6sZoJILGaUaDnUzwySEBYIkji48A4jiC0iICvxffdrNhBbSMBO4ueZ 9ewgDcwCe1gk/j1YCjaJTcBI4tv7mWA2L1DRvavb2EFsFgFViQWzF4ENFRWIkNj0dQ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rn+fr1HNMdRavNPfjrJ7101BAzOtw6bYbFuRkXPm3x OZ/cdlL29XfNMp6pJ1Kn8yV7Jxt4frvKpHzyl4NeRO8OcfGa9BX/WJRYijMSDbWYi4oTAYBN aS06AgAA X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(83506001)(2906002)(4326007)(65806001)(19580405001)(69596002)(626004)(81166006)(8676002)(110136003)(586003)(19580395003)(81156014)(87936001)(50466002)(64126003)(47776003)(230700001)(65956001)(7416002)(23676002)(8936002)(68736007)(77096005)(31686004)(65826007)(6916009)(7846002)(2950100002)(92566002)(106466001)(36756003)(305945005)(33646002)(53416004)(356003)(11100500001)(86362001)(4001350100001)(97736004)(76176999)(31696002)(229853001)(50986999)(189998001)(5660300001)(2270400002)(54356999)(142923001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR02MB1159; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD019; 1:7Vk9mXW34wDwnvlEf9clJrgvk33jp+gfBgG5wE6BjWJvik/1KwW5Kh6sIs2JlRs7QDAuyYUrmb1cfdsFFz3HH1OGBlfQKELILe9qezPpNdWOXbhBmQM6bpRQAItBEZsg2er5OBxsHp5zj9vCsjKMoEihYusljN9ij1r1cUhzGqjY6jK44A/WACjVxxptcOzb0YjYDoe9I6m5w54PHbz1gRUNKPtqbhVJfUe1pYS4owhTKYNF9Pj7VCakTz6zxItETceH78MeXProAtPhNWdapxwcnFNNIuzY4yCq2nXgxvXX1yRYZDak91eMvrn0acw8RIaIRhdNi29nN3+MLnOJR/Ga1c6o6sqKND9i2F15BTZ21QGeFyLJFme7vJ6c4pkRJRVS6M4go29VtEfS1x31tXqf5ApgcC7+s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 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(104084551191319)(146099531331640)(42932892334569)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(13016025)(13018025)(10201501046)(3002001)(6055026); SRVR:BN3PR02MB1159; BCL:0; PCL:0; RULEID:; SRVR:BN3PR02MB1159; X-Microsoft-Exchange-Diagnostics: 1; BN3PR02MB1159; 4:aQUl/ABOT00DaAn6j1VWJUAKOj86VUluDshac/wEOdE17bjBhup3FVi0VxaoJDjYJnh/L2vutesQPqum/C3l4a4DQuTGJwbYeDzWZ0j9kltdiaG282Q0+aaC8v2HS9jFc4gOv8Cf20TYo8gjtw1gKDs7tnpoMrsDCTd7T/sK+eMErLA8Jdje0TTFniF2wcMKHa1ENYXl40cBJL0VXGZYxmGsFs2cj5Box6PeHKb6eze1dwNoV5SNGf2ALh7JN+Sho02WtVZjEZ12AebOGAOzimK8P2kf17HvmZ/8DQhRvDEt/1jS82JfUqDZOBRXNc46sSc8kDbf034VzIX11HOWdhuUrJ8iFLiK89XhH40VS0pJ5Tw+txazW3Ohl9ybN0d9pl7pA3utk+5DOgJLspqplj2sdxUt/WYCeHjcKN/jxQdYBkcgS01PstEgHW0FBZ5zsWRQsQLUID7J9oXmr5aa4/sKSuTXFuN9Se7i4lS84nBWCw5d5xeHVP+xTQtyVzUNMZ0AXd5WCgCqbWuuVLffjznigD69JHYm53VP9qViSR9I0IzXdp60EpSDUtxfDBvGugnN8PvTZWd8E77MghwVxwAZxqssfBXCWlANj0AE7ng= X-Forefront-PRVS: 0107098B6C X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjNQUjAyTUIxMTU5OzIzOjA5dkZmWm1Id1o2cm5WV1EzVXhqclNnMUZW?= =?utf-8?B?bE92bXNlOTNFMStWa0tnakVsTWtRbkFvWTI1SDNRM0dKTk5EUlZwWHY4YVVa?= =?utf-8?B?Skw4Mjg0bGZ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f2c/eHtrB03RdASXibNaVYSOb6gkSIah1lgEVoQaliu6LMLrx1cSCDFwwdmwsirvdRxlt9f5UUUKK5ZEMUeTRiZCSq+oJ1/P6fLlGBYtYfP224RTxlqRHGKNV/oMm7 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2016 22:55:35.1903 (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.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR02MB1159 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure that if scsi-mq is enabled that scsi_wait_for_queuecommand() waits until ongoing shost->hostt->queuecommand() calls have finished. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: James Bottomley Cc: Martin K. Petersen Cc: Doug Ledford Reviewed-by: Johannes Thumshirn Reviewed-by: Sagi Grimberg --- drivers/scsi/scsi_lib.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index c1561e7..9b8b19e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2724,8 +2724,6 @@ EXPORT_SYMBOL_GPL(sdev_evt_send_simple); /** * scsi_request_fn_active() - number of kernel threads inside scsi_request_fn() * @shost: SCSI host for which to count the number of scsi_request_fn() callers. - * - * To do: add support for scsi-mq in this function. */ static int scsi_request_fn_active(struct Scsi_Host *shost) { @@ -2744,12 +2742,20 @@ static int scsi_request_fn_active(struct Scsi_Host *shost) return request_fn_active; } +static void scsi_mq_wait_for_queuecommand(struct Scsi_Host *shost) +{ + struct scsi_device *sdev; + + shost_for_each_device(sdev, shost) + blk_mq_quiesce_queue(sdev->request_queue); +} + /** * scsi_wait_for_queuecommand() - wait for ongoing queuecommand() calls * @shost: SCSI host pointer. * * Wait until the ongoing shost->hostt->queuecommand() calls that are - * invoked from scsi_request_fn() have finished. + * invoked from either scsi_request_fn() or scsi_queue_rq() have finished. * * To do: avoid that scsi_send_eh_cmnd() calls queuecommand() after * scsi_internal_device_block() has blocked a SCSI device and remove and also @@ -2757,8 +2763,12 @@ static int scsi_request_fn_active(struct Scsi_Host *shost) */ void scsi_wait_for_queuecommand(struct Scsi_Host *shost) { - while (scsi_request_fn_active(shost)) - msleep(20); + if (shost->use_blk_mq) { + scsi_mq_wait_for_queuecommand(shost); + } else { + while (scsi_request_fn_active(shost)) + msleep(20); + } } EXPORT_SYMBOL(scsi_wait_for_queuecommand);