From patchwork Sat Oct 29 00:22:37 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: 9402941 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 E7CB76022E for ; Sat, 29 Oct 2016 00:22:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D562D2A8B6 for ; Sat, 29 Oct 2016 00:22:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9BCA2A8DE; Sat, 29 Oct 2016 00:22:51 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,URIBL_BLACK 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 3612F2A8BB for ; Sat, 29 Oct 2016 00:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756185AbcJ2AWt (ORCPT ); Fri, 28 Oct 2016 20:22:49 -0400 Received: from mail-dm3nam03on0077.outbound.protection.outlook.com ([104.47.41.77]:21852 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964933AbcJ2AWp (ORCPT ); Fri, 28 Oct 2016 20:22:45 -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=L9Y2yTHWQ8BdAr7sFoS11mTju612cSWWZaDIlcu5rIU=; b=V68JGIVq5esavimlyEFAVbZNPJxGCMN0a9+oQPGI7e0m0L5XY9fMryZDFaiZZUsQY8yHyPZtMUo/uRjR1L/r9ZxKByCfsOKomrsVKmRB8YBBEVcoC1IPn5QZ84EcVHJ+bjHNNhRZhlLB8st1qDIGUd50nfYnfREckg4SqE3K8AU= Received: from BY2PR02CA0077.namprd02.prod.outlook.com (10.242.32.35) by BY2PR02MB265.namprd02.prod.outlook.com (10.242.236.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12; Sat, 29 Oct 2016 00:22:43 +0000 Received: from BN1AFFO11FD051.protection.gbl (2a01:111:f400:7c10::196) by BY2PR02CA0077.outlook.office365.com (2a01:111:e400:2c2a::35) 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; Sat, 29 Oct 2016 00:22:42 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; lists.infradead.org; dkim=none (message not signed) header.d=none; lists.infradead.org; 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 BN1AFFO11FD051.mail.protection.outlook.com (10.58.53.66) 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; Sat, 29 Oct 2016 00:22:41 +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 D5.3F.26959.839E3185; Fri, 28 Oct 2016 17:11:37 -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.319.2; Fri, 28 Oct 2016 17:22:37 -0700 X-AuditID: 0ac94369-ef8199800001694f-4c-5813e938d7e6 Received: from exp-402881.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id A9.4B.03615.DCBE3185; Fri, 28 Oct 2016 17:22:37 -0700 (PDT) Subject: [PATCH v5 11/14] SRP transport: Move queuecommand() wait code to SCSI core To: Jens Axboe References: <7460e8b2-2cfd-c0d5-7ae7-7f662d89dad3@sandisk.com> CC: Christoph Hellwig , James Bottomley , "Martin K. Petersen" , Mike Snitzer , Doug Ledford , Keith Busch , Ming Lei , "Konrad Rzeszutek Wilk" , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , 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: Date: Fri, 28 Oct 2016 17:22:37 -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: <7460e8b2-2cfd-c0d5-7ae7-7f662d89dad3@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsXCddJ5ka7lS+EIg8ZeDov/e46xWbw8/4HV YuXqo0wWqybmWdw7+oXJYtnip4wWe29pW8xf9pTd4tmhXhaL7us72CzOf3jFZLH8+D8mixnn F7NatG38ymjx/sd1dgd+j9eTJzB6TGx+x+6xc9Zddo/Fe14yeTw4tJnFY/OSeo/dNxvYPD4+ vcXi8X7fVTaPz5vkAriiuGxSUnMyy1KL9O0SuDJOzVvAWDBVs+Liu11sDYzXlLoYOTkkBEwk 2ndfZupi5OIQEljKJLFx/mx2CGcHo8TuhcdYY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CUzUJStoCReRWjWG5mTnFuemaBoZFe cWJeSmZxtl5yfu4mRkjERO1gvD7R/BAjEwenVAPjhPJIrrMxm30ef5L+oVGX/HPfD9534U0h You0hH88Mn62gm2+bOLVT6UbJy50mHnoLc/dvRvzHjOU7Vq6f0K6onLMnp2hbx3Y2bRKDt05 88+GRTFz2YsV/e6hB4xmfL7KuPnbDuNWd+u3uZsECz0XqCy9Y7fiws76J8//hkQ4eMfas/Xt eH3/iRJLcUaioRZzUXEiAN+nFG1IAgAA 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)(230700001)(2906002)(33646002)(92566002)(8666005)(4326007)(11100500001)(81156014)(305945005)(83506001)(97736004)(8936002)(8676002)(87936001)(86362001)(4001350100001)(356003)(50466002)(7846002)(36756003)(229853001)(53416004)(2270400002)(189998001)(7416002)(626004)(31686004)(69596002)(77096005)(586003)(64126003)(81166006)(110136003)(31696002)(19580405001)(54356999)(47776003)(68736007)(2950100002)(65826007)(6916009)(50986999)(5660300001)(65806001)(23676002)(106466001)(65956001)(76176999)(19580395003)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR02MB265; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD051; 1:JI807iASv0cEl4h+jIrXzciSHf+ihawBw1Bz1YNONX5v3xZaJKhcUUZwtJhqYK0ajNR8lfFeyqDDdzMb+dINuElCE5Em4g6i8ilIqDvssRiW6P63wNCx55yK4t/TTP2UHMKVvTK+4oDzooL+CPIrDO+G9X/SIgq2nNsRZqdluL5DVcyPizGu/YcMaxyndAJj0HOeCCtNGMTfKezmdp3o05OcIrt55yeRPYVhBJKaqs6VQSyPewpLYheYFY67biye0PP+tbwXFNwdSnwEHsjoG5mKLG/f78JilwLV85/qOODi7Ld9xUd+tCySMafRNo41O+Zr1GgRWmsvVGg9pDg+ZoT39EbUVubBfOncjTJuve4Ln4rkhev2phWiJvvsQUk3I9TD+OTIgA3r0ZyfpZ3nglc7Qo3RW9HbUv3oKcksG5TqXp7qa4NO4KNTszm/8nSMzhobzpOzuLZd2HuJViGAhkPRO+HjgFipjMWkbIHYQC2ymWdAnK7J6U51q4g7fSAGM8xdBJV2YkzKQwo5kPW63fngqBHfjArL5fqUPx4DnbooEp7meOdZc7CYqWa/2dHF X-MS-Office365-Filtering-Correlation-Id: db7e6cf1-d0a8-4086-ed09-08d3ff91b2e2 X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB265; 2:2nL7+YC8x85dqZ3pTqBZtxeoz4smHPEEaymqjgBWQ+27KaHqZAYd2u4IommRImWCWxDuld5AnkCWjONuXCxwjfThMU2RGefdB1NK3i6yjNC+nPd6Z6VMnqG5HVHYjrUNgrGWxvAfMRnIwehzA3UWOvZjUwfIDEYznYFySVHtEuH1b0TBEwqVq9PGqdBPIqIRh5e42/wkPeQ+b5SW1n6bYw==; 3:VZTUZTojxsDkw6cto5yfeXoO66cZ+wVoUeT0TYcm0NtK95szzEjandEnIqcsWLyN2kmt2jK4ut0cJy/PrRtymO5lCkiz6vFd8TzjYq0hZ2yDDirWcckefF11oJJSpkd4Z3VO0KnG/86PMzgHssXCtoGj4j+7SZ02i9wtVXQepihuAg3csizE1XJqhkvPXpwExTVklUT4WRNdtU9C1vRtUZ9MiqFX6f4+nOf7F0Oo3QIJKAmI1tpvze5BlMDFbJO1AqrKBIQKbbDJdkDRj5iNTtbO8VrX6i60Cmip/+ROcg4= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BY2PR02MB265; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB265; 25:tIQSvLZwVskF6hsKpERawo0PmhD+ZM8j1Yk2MQQHSy4TDyQVczPKsFhJ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ezXPMCmJ3lc2oMM0sU0ScN8MzJyEeoYclaAvwDlD2BUxqSZGFFO6I5qwPquRl5JnK97o/AiEI18znh8gArZl1J/cNiR3Ye4m6r9i2RbTdbReMBWt/M1w3D/j0HEKhPawiLf55Djo4QJhujpZJx 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)(13016025)(13018025)(5005006)(3002001)(10201501046)(6055026); SRVR:BY2PR02MB265; BCL:0; PCL:0; RULEID:; SRVR:BY2PR02MB265; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB265; 4:KGXmVTAoHfSOwF29Dcbml/jFuSMua1BCWVLfZ+aW5d3k28J9Ial9mimjOlOyM8ivja89DMz+w7nTXkaPID9t/JeDoxvzvPf2BTZhT9dl0BYHaFP7BOV6CFzxwBNi8P1/85pp5KCQfC8MYIPP9bDMABcvGZ77mpSdK9nQmxW5EOoUNXF5J7V1mU3QZIktsYSNYK5LsIx2uQXrnzTur/GlJGPFwy87Cm+64Grkfx8J8j7TWjqJDxFlTWatpIXkpaQZ4YKDhpMLq3IOyySsu6SfIVFP2Eqt2BUpOpXb70Bt2T20oRT59zfoq4CEC1FQtgBvydQYk8D1KhabNdNMOuyjij/z7d0uwkuV9h4DedUfe3mBnWL+XveZbM6Ogt8b+d+DHcRD2JkELgOokr6txXYlZJ4GGo3sxksDBdWGVniUq/bLy0By5Q3czMgMD24VjbgzSCUkDRTEHu07+cs1ln9CcIJBcc73sG5W/9YCSo5GsUsEfcIP8x81o9Q7f368+e//CYTiYi3gsfUT9okY/VSPuacMEsx7lJw3XMXtKVZWsIv0MvaOvVdPSNmam9FMPcLGTNDvmDhXWL3/a5vcHLpmHzPfIJAW6azFPaiAcotP4gU= X-Forefront-PRVS: 01106E96F6 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQ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=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB265; 6:HTizic82EqFFmYl78lnqlgAg9JYadXLqCnxl62YKjRirn2XM1EWaZwQf8+vZDLoNcAInfyg9linvdtOZgG36wt+vt3+lVAn9Q9pvhCx/vBhseW30Gf6ayLQjO5ln2VAOhAIEkegGmv9XPsRC9ydSj36Hlt3E8zqTDA47mxed9kIYeLtFjfgqwSMAXZnP6/LNZamiITYq62+OyWRVGstfs+YfOVJVvXye6RhP2oOXLG7l4YsPpSVNlWow9Oeni5CGVgbjPEMXP65tpLY1M0uyaaXXaVy1f8UfmxPer6aP5dB7CgsNMRVbjS8dOSErBLKPGjbjGHM9jbySVtcwNCQrkGBm4Q33gyvUXV9t5g5loRg=; 5:qGBvvbnz9/PfwsQflcyFGbsxq6wMbHHmEBDwk72JkE53ksUf/7Rij7twdZ6XZv1sUVT6byr6LNCIWwzHZuK30wCdY3jmKuntsfTeBVUCfKW+r4dnPkdNNVylMWflqmPNvHK0kGhD4XJMeyX7fjKyXQ==; 24:EzzkFDcozrIpIpkrrVhkpNzbGws8qQ5ZqXNMJZNsVLYkijmf7ub9d/PpfAfVhUzBYYIpHKDjFsfkZWqpiH/25ECa16VklB+ExP1+5d0u9pE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB265; 7:uPZabvgDV8S7ZHQvPjwI1Cn+Mwh/duq1PPscheCjoekBWTx9ICg9gvbjxJI/uTAhJCwXNsBJ2aHBnlx1QuhojoX89IUr8FId6cwTZGT5sRBN594b4XzY0IIyEWCTKkXx61dxvqW/dZdPswiS8q4F3Lv7UiSnvJnD1SKvOPghut5Pwyaw9C7yxEFZI0uUjzfQzgMSRU0agUhAfBFtH9OddYxP90mCjlD96iZfyaNV9abNY+1+zSdk5kRwOKpE29YWbeK13BsI4EmCTEL7vnYkkF0fqWCMpjdmlPNx2G090PROS8zfhaRpAe+RTzWiicPlXnXYFrKRqyE6H6U2VuzVqrrtleo44SNUT2kbWsvuuvk=; 20:/XkowjlzlTtWNUcxX7lRiHrnimTcln07Owzd3jJhuOxHFotdPwJ1ySikflir+aF1VNhnQRopdSbZnKlGqG61wZUtp/SB9VnMzDgkXrkZHunM0W8Bo27WkrDhmobqiFMw0aHfgx4IUC+ijKe8LrUDEOTLmxFLWGsHm+ukODeBobtagDo+tQh+TAnVWHSrfVgCmGGQng6F+NM+rzrsDgsIg3VkKY0mlH0aJ7wDZvnABmx/a9nnEE4KHQIut9GambZR X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2016 00:22:41.3137 (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: BY2PR02MB265 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 Additionally, rename srp_wait_for_queuecommand() into scsi_wait_for_queuecommand() and add a comment about the queuecommand() call from scsi_send_eh_cmnd(). Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Martin K. Petersen Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Doug Ledford Reviewed-by: Sagi Grimberg Reviewed-by: Martin K. Petersen --- drivers/scsi/scsi_lib.c | 38 ++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi_transport_srp.c | 41 ++++++--------------------------------- 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b4f682c..3ab9c87 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2721,6 +2721,39 @@ void sdev_evt_send_simple(struct scsi_device *sdev, EXPORT_SYMBOL_GPL(sdev_evt_send_simple); /** + * scsi_request_fn_active() - number of kernel threads inside scsi_request_fn() + * @sdev: SCSI device to count the number of scsi_request_fn() callers for. + */ +static int scsi_request_fn_active(struct scsi_device *sdev) +{ + struct request_queue *q = sdev->request_queue; + int request_fn_active; + + WARN_ON_ONCE(sdev->host->use_blk_mq); + + spin_lock_irq(q->queue_lock); + request_fn_active = q->request_fn_active; + spin_unlock_irq(q->queue_lock); + + return request_fn_active; +} + +/** + * 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. + */ +static void scsi_wait_for_queuecommand(struct scsi_device *sdev) +{ + WARN_ON_ONCE(sdev->host->use_blk_mq); + + while (scsi_request_fn_active(sdev)) + msleep(20); +} + +/** * scsi_device_quiesce - Block user issued commands. * @sdev: scsi device to quiesce. * @@ -2814,6 +2847,10 @@ EXPORT_SYMBOL(scsi_target_resume); * (which must be a legal transition). When the device is in this * state, all commands are deferred until the scsi lld reenables * the device with scsi_device_unblock or device_block_tmo fires. + * + * To do: avoid that scsi_send_eh_cmnd() calls queuecommand() after + * scsi_internal_device_block() has blocked a SCSI device and also + * remove the rport mutex lock and unlock calls from srp_queuecommand(). */ int scsi_internal_device_block(struct scsi_device *sdev) @@ -2841,6 +2878,7 @@ scsi_internal_device_block(struct scsi_device *sdev) spin_lock_irqsave(q->queue_lock, flags); blk_stop_queue(q); spin_unlock_irqrestore(q->queue_lock, flags); + scsi_wait_for_queuecommand(sdev); } return 0; diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index e3cd3ec..b48328a 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -402,36 +401,6 @@ static void srp_reconnect_work(struct work_struct *work) } } -/** - * 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) -{ - struct scsi_device *sdev; - struct request_queue *q; - int request_fn_active = 0; - - shost_for_each_device(sdev, shost) { - q = sdev->request_queue; - - spin_lock_irq(q->queue_lock); - request_fn_active += q->request_fn_active; - spin_unlock_irq(q->queue_lock); - } - - return request_fn_active; -} - -/* Wait until ongoing shost->hostt->queuecommand() calls have finished. */ -static void srp_wait_for_queuecommand(struct Scsi_Host *shost) -{ - while (scsi_request_fn_active(shost)) - msleep(20); -} - static void __rport_fail_io_fast(struct srp_rport *rport) { struct Scsi_Host *shost = rport_to_shost(rport); @@ -441,14 +410,17 @@ static void __rport_fail_io_fast(struct srp_rport *rport) if (srp_rport_set_state(rport, SRP_RPORT_FAIL_FAST)) return; + /* + * Call scsi_target_block() to wait for ongoing shost->queuecommand() + * calls before invoking i->f->terminate_rport_io(). + */ + scsi_target_block(rport->dev.parent); scsi_target_unblock(rport->dev.parent, SDEV_TRANSPORT_OFFLINE); /* 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) { - srp_wait_for_queuecommand(shost); + if (i->f->terminate_rport_io) i->f->terminate_rport_io(rport); - } } /** @@ -576,7 +548,6 @@ int srp_reconnect_rport(struct srp_rport *rport) if (res) goto out; scsi_target_block(&shost->shost_gendev); - srp_wait_for_queuecommand(shost); res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; pr_debug("%s (state %d): transport.reconnect() returned %d\n", dev_name(&shost->shost_gendev), rport->state, res);