From patchwork Tue May 2 18:00:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9708429 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 7510460349 for ; Tue, 2 May 2017 18:00:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A2332848E for ; Tue, 2 May 2017 18:00:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EBD1284D5; Tue, 2 May 2017 18:00:58 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham 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 819552848E for ; Tue, 2 May 2017 18:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751265AbdEBSA4 (ORCPT ); Tue, 2 May 2017 14:00:56 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:42055 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750912AbdEBSAz (ORCPT ); Tue, 2 May 2017 14:00:55 -0400 X-IronPort-AV: E=Sophos;i="5.38,280,1491235200"; d="scan'208";a="14766344" Received: from mail-by2nam03lp0056.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([216.32.180.56]) by ob1.hgst.iphmx.com with ESMTP; 03 May 2017 02:00:54 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ldXZHJl5EG9ckPsUOCViuCbenSML3+ws+go8pLn/zpU=; b=RxVCx2VIs0ofgCuKjM2n/8WRdHbgQEldI29Aijh0sxH9Oxt0IjQ9iAAuMsl3B+fxYE9d2TfAJCZ55G+gjRYP79FJhqRTsTouD49uitZKtme6/zpKsLB4IT9+ouTmGfrBtqVjKE10YYerjxxAVx2BbDhEPfChVbYSklFB/h3iI4A= Received: from BN3PR0401CA0028.namprd04.prod.outlook.com (10.162.159.166) by BLUPR0401MB1537.namprd04.prod.outlook.com (10.163.83.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Tue, 2 May 2017 18:00:51 +0000 Received: from CO1NAM04FT060.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::200) by BN3PR0401CA0028.outlook.office365.com (2a01:111:e400:51d1::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12 via Frontend Transport; Tue, 2 May 2017 18:00:50 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.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 CO1NAM04FT060.mail.protection.outlook.com (10.152.91.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1047.9 via Frontend Transport; Tue, 2 May 2017 18:00:49 +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 BF.CF.29323.E49C8095; Tue, 2 May 2017 11:00:49 -0700 (PDT) Received: from milsmgip12.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; Tue, 2 May 2017 11:00:46 -0700 X-AuditID: 0ac94369-1d7ff7000000728b-9c-5908c94ee93a Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id C3.F9.18148.B49C8095; Tue, 2 May 2017 11:00:46 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , James Bottomley CC: , Bart Van Assche , Christoph Hellwig , Hannes Reinecke , Johannes Thumshirn , Sreekanth Reddy Subject: [PATCH v6 1/5] Split scsi_internal_device_block() Date: Tue, 2 May 2017 11:00:39 -0700 Message-ID: <20170502180043.14734-2-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170502180043.14734-1-bart.vanassche@sandisk.com> References: <20170502180043.14734-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrELMWRmVeSWpSXmKPExsXCddJ5kW7gSY5Ig2WrRC0WvNnLZrFy9VEm i439HBaPu2awWnRf38Fmsfz4PyaLmV+fsjuwe8y6f5bNY9qkU2weu282sHl8fHqLxWP9lqss HptPV3t83iQXwB7FZZOSmpNZllqkb5fAlbFv1xnGgh+GFbcPtbI1MC7T7GLk5JAQMJH4M2cH SxcjF4eQwFImiSPLTrNCOFsZJVrvzmOHqbqz4zITRGIjo8TcyQcZQRJsAkYS397PZAGxRQQK JS5t6wCLMwu8Y5TY36kIYgsLWEnMv72JFcRmEVCROPdvEpjNK2Av8a35FxPEAnmJs1t2Mncx cnBwCjhIvPrrBBIWAirZ+fcvM8heCYFNrBI7Xy5ngeg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ME-Version: 1.0 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:(10019020)(6009001)(39860400002)(39840400002)(39450400003)(39400400002)(39850400002)(39410400002)(2980300002)(438002)(189002)(199003)(9170700003)(33646002)(8936002)(305945005)(2906002)(50986999)(54906002)(76176999)(38730400002)(50226002)(53936002)(81166006)(5003940100001)(4326008)(36756003)(8676002)(356003)(47776003)(50466002)(6666003)(48376002)(2950100002)(508600001)(1076002)(189998001)(86362001)(77096006)(5660300001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR0401MB1537; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT060; 1:IqIawO6japOv9Ck/nEfLlqVw0r0Yx7eAiiWwmQ5axxqwu2FjzX3gLc0R+eb/eu8ppHccrI/RZewJwJRJ0gkLlc3sAE+1T+ubWhLz55ySgGoVTQ2BEI9NU/lLwQ0iQ6OtC687iUVnQxnVaUyu7NTGJMdOFZxaAPB/7UPLa/IIa/9Zdvn71Alwpf91iAPf+CngkDEDEli1/zrZ/nQBvOiJASPCApMdrbfPsD7mSdpleD69GgL6B6i4rGC5TleqP/Rdhm8Am2TCKI7ZwST5HJTNPMIWHPITCTajDEx7t7rsGv0j1iSJee5W2eWRePuskh09W7KAmfGSuLCZn4Mp7dCwlatKr0QVsrJjw5bpGu0Gl/TDTiiFG6LqNDWGImDa9GPl77sCADbrVfZj4QAfyMvrUnbLBnsTX90ojgs8r5yyR5Jpb/MRyTf7HpcUErzlv5051TuAnGyGY6eU9sjmYOz7jen8MoIjF+CNxCiUlYp4cCBvYPpqlT8NmLPXYVPAiWOvBBoEPeV7Ii8mVIqjB3ZGsnih9AT3KID506QUJbjTip8= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 74304631-297c-491b-7aaa-08d491852aef X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:BLUPR0401MB1537; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0401MB1537; 3:OwhG1/HO/GXAz3vpZhKkFSnYfUjwOdQcOuKo9LNZSniKxw3vvTVrKsCZpH+q2BSWgRF6/+ksOMg5EpzrV01H7zrzgmL2tg9mJOtLrsnx5ZKEnjbJ44mPdqhFFJ08uUs/jIynFwabXqQSg11MIYVE4Mo6ztDzRYUM8cxb76y2MF4D4bdBf4IgfQK11BaTtnz63nKr8jOMIDtqN1jTELxLkrZGGy5zM6SAcGFykLP5aoPPMlBufBQrbcYGbcBYZMKxtky+WBGVHCl/DK0SjFEMyVhVcpJBaVX78XBWs3LosWxazynCpDj6L7oc9fDyNE6uoWVolEFnIzyCVgN9dXpI911SkQPmnF0N2bn8RpgfzHa9+XMSdaRQ4vpQQZaZCh/8v0mMrsmKfJ7gCgnwRAJswGsMBh+2IgTS3kmGp0/AX8Sng2O6l7fUJnAKJ0GE7XY2mhzUcJgPnE+6wbW1yagCjB1BGdOGHwC/kroGgd5ygIwAmnsAuRhJm318hv35a0bt X-Microsoft-Exchange-Diagnostics: 1; BLUPR0401MB1537; 25:BNn7kXNjViXGd3xvKl4tSzQ+TRNi1g64OPMGznZITNP/0LLyKJ331yLVT6g4mB7rog7LylC0pvzSlhwNP/p0JwORRe5CUjz1Hpa8+EQR8wS72Wu9MSdLscfhxJ0FN0Jcdf0PJY7PLXio7rIniU07pQ66jBjHxvtSkvQ5W/Phr6JQpJYT/WoQmyjTORVg//XNI47jSgRh88DjKFSGt+2+DN8uzp5tgPwOQ06BaG0XU81gHGAjqmoy+Zokiqfptvv39IqfzS5shg8YWMxgnbpsdtuvzd8F3ydEcisVGBMSPW70XYDsMBkU8TUft8S9a4aKmgh8n87QT0K1cU+SVnXKHVfWLCQ3yZDlVpxw9gRaQ/1hZHkJ5JidsEDEN+ExcLKJF6N6kjmV2iwNVfH2WReTL6IiHER/M9Y9YMLLi4qk2INj+0nyulozjnkyewTDMgaigvZYbAQv7fJnFS2Pz8mV7w==; 31:0sRWij8ZvqSuNWnzItUjHjfh4Kgl0Ut6MvZXHrxaRqwkl1QnvZjXY+Z7Q+QCIBbn2R0CAo5k08HgxnpIO2m78ZgIrD9DnBb+leHyOEoQQGjHW8pGZAvMYICf8YKFy5zS0xCNv4b4w1kHppt+0fptcv/9Fzd6QlKJtUSdw/JPVNaF9kSXk2eArCfUKPesH3I3noaRI6AG5sr1gDtq01QZLI9UU+M6wKQxg7NJbSKz2aMerBI3q2nMJYdbCFpKbwqWkPoUDIEKL/uHs9alq7Hx0Q== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; BLUPR0401MB1537; 20:AvF5FliqieExmXjs5ko+bGKd+zsyc54Tnz5dELReOypeO8En6tjf7LtVL0qXX76z9eaqDWcPhzczUQty3Xjmxe/po6VmSgAWwJ+Bk+8JfCRNrxK0TASvS38EOUHoFhv5i82nlfeFYDKtGdQDoQD/+qY0AD3KXp6ycsOPx9wBQzr62782Se4sZAxrSL7v+advk/0JLTVHotmt6M+iSPalPJq3tELuo5Ot+JL/tPceJMxl5Qsw4xtrEE9bzhFaWhQEJOF4So5Qy20N13eeH6R6WeKfq4EB146yUMc/LDD3DA5FT8ZpyxkKb7gGp+PwfaV0bA0SYigDs+TrPImHPbfz4EqFlRyO930xBg1XmQVgIRsn1uEoimiFy984geSFM8Z5w81H7ZYZb2Lc4Jgq4jdpAlkNkxaElXJvJlCalRrPe3upV4QaBLT6sqi33MwcJlsIb1AGMgUg2yRA+oDSzmytP+rfvOTq1mTPZCG0Y1lpgPEic+JiB3QDJqapvpxwJUS9 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13018025)(13016025)(8121501046)(5005006)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123555025)(20161123564025)(6072148); SRVR:BLUPR0401MB1537; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0401MB1537; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0401MB1537; 4:psGNGp0KKJisxkVlVjq8aBsY1dTqEBzjQfeaAI1t8/FXXYnrvFO1lsLReQA0TmSbkS9OLBzN7SEfMkeAIO7l0IvX+PhnOQSXVxy1Hfsv2jvJzoDB/2y/InPYvEMXQ/JcW5jfN9NcAsQlfdoyv7v1vQDixv/Y8ZHapOeMwjzBb31jftGN+LtdQcCrTF7FlR/t3zBJJhdBFE9WXaXxrkkS2TWGCtLrvGo19DIDehsv/AbUQLOrggz3oKig0/SXaJVAQxsSqRe4ZbRqB1QODYbuOXUT3L3Sdgw7NRRcbU2QG+POOOiRTTf1xkfV/bICNRtUshiANIgOONa64uwxU3pfhagWxDM6jyYfNLmGk64z/RiY9mS94hg/9EPmbMNo2MahALS8kZDdAuzviHt7oHgj8NhSo4HLpJTGAqD9fsq3daeiJFMRP45LTMyGWOsH48eUYPDl49sMVM2qHMzWAzFscJyTSJ4oHlh9BF79fdLTK0yuQEShLOSCU5xRux/K4+Zz5kuIblx5CX6DQ7k8K6IRQTntojmvZ53uLiI3ppNsTkHcyyIz7QUGO6KMtTN2bQMPKbBg98q1zB/SdRSfAXr8ur8O6Tk3R7dLjBVKoE/cLo97ZhScED4DFoyXSBdxX6UQhe7F4pLVCF2z/fR8nrD1MLza1PZZTePslF/EHu1MlK82v/m4UeiCe5Cjco2wI3w1/plXDQOmPX3gpfSqwiggwBGcJtW/+Pdt+XQcWWHUwP4digl4LsC1Pj5/7/C4fD7IiI6qWfHOKMFBSSVcVUv82xI+vFyv3YBQvuX5M0GI+sldU56B4tK78W1Dzb64WphH X-Forefront-PRVS: 02951C14DC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q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utput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0401MB1537; 7:sfFL1uGskWk7ZtQPVdjG23AmOjdDQE+RRjDkTjx176MZzB0Z6RCsahliiyCwj4sfLvmLea1Rls0h23EuMvwM+2IvC2QEtfQjnAbGRSvvQeOOvPbdQp8skLPf4E9uOW2zfXYSDUooXtn7w0NZcwtL3j5wxgV1cZqyYuTuZEjY0nSd0ZA9gmxusNxnYV+IUuEnIazIxGDKPViPFV3h3kFopRHgxC9GnLPLyNq10gEEolCxKEwBVYsBb7Re3eJv1+UW8NsQ/WWn/QeH7mSjESAxvCRzTEkFJoc8JUcU7ijEW8D66FnpIhjB4KOZxeadyx5sYtCsPz+tBoCnLEoeasXusw==; 20:sz0XWOhzmk/knFCTCNTiiQJ1iMelt/DRk/5yQ+BtAGv5NF9IktkCwrIy6OzyfCj3coeV2XegNTrTD7qlMF4UnKN9leVKp5YHp6kNZmeBUVvuq5DTvH3CRBIvZPyGv0vyxd2Wwb9ZQ38N6lRyotZzf0QmGWIrv4dkEQIOyLPDv2s= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2017 18:00:49.5910 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0401MB1537 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of passing a "wait" argument to scsi_internal_device_block(), split this function into a function that waits and a function that doesn't wait. This will make it easier to serialize SCSI device state changes through a mutex. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Sreekanth Reddy --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +- drivers/scsi/scsi_lib.c | 73 +++++++++++++++++++++++------------- include/scsi/scsi_device.h | 2 +- 3 files changed, 50 insertions(+), 29 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 919ba2bb15f1..25e89cfe4417 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -2859,7 +2859,7 @@ _scsih_internal_device_block(struct scsi_device *sdev, sas_device_priv_data->sas_target->handle); sas_device_priv_data->block = 1; - r = scsi_internal_device_block(sdev, false); + r = scsi_internal_device_block_nowait(sdev); if (r == -EINVAL) sdev_printk(KERN_WARNING, sdev, "device_block failed with return(%d) for handle(0x%04x)\n", @@ -2895,7 +2895,7 @@ _scsih_internal_device_unblock(struct scsi_device *sdev, "performing a block followed by an unblock\n", r, sas_device_priv_data->sas_target->handle); sas_device_priv_data->block = 1; - r = scsi_internal_device_block(sdev, false); + r = scsi_internal_device_block_nowait(sdev); if (r) sdev_printk(KERN_WARNING, sdev, "retried device_block " "failed with return(%d) for handle(0x%04x)\n", diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b7b340c494ab..ca20d3702b45 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2937,28 +2937,20 @@ scsi_target_resume(struct scsi_target *starget) EXPORT_SYMBOL(scsi_target_resume); /** - * scsi_internal_device_block - internal function to put a device temporarily into the SDEV_BLOCK state - * @sdev: device to block - * @wait: Whether or not to wait until ongoing .queuecommand() / - * .queue_rq() calls have finished. + * scsi_internal_device_block_nowait - try to transition to the SDEV_BLOCK state + * @sdev: device to block * - * Block request made by scsi lld's to temporarily stop all - * scsi commands on the specified device. May sleep. + * Pause SCSI command processing on the specified device. Does not sleep. * - * Returns zero if successful or error if not + * Returns zero if successful or a negative error code upon failure. * - * Notes: - * This routine transitions the device to the SDEV_BLOCK state - * (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(). + * Notes: + * This routine transitions the device to the SDEV_BLOCK state (which must be + * a legal transition). When the device is in this state, command processing + * is paused until the device leaves the SDEV_BLOCK state. See also + * scsi_internal_device_unblock_nowait(). */ -int -scsi_internal_device_block(struct scsi_device *sdev, bool wait) +int scsi_internal_device_block_nowait(struct scsi_device *sdev) { struct request_queue *q = sdev->request_queue; unsigned long flags; @@ -2978,21 +2970,50 @@ scsi_internal_device_block(struct scsi_device *sdev, bool wait) * request queue. */ if (q->mq_ops) { - if (wait) - blk_mq_quiesce_queue(q); - else - blk_mq_stop_hw_queues(q); + blk_mq_stop_hw_queues(q); } else { spin_lock_irqsave(q->queue_lock, flags); blk_stop_queue(q); spin_unlock_irqrestore(q->queue_lock, flags); - if (wait) - scsi_wait_for_queuecommand(sdev); } return 0; } -EXPORT_SYMBOL_GPL(scsi_internal_device_block); +EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait); + +/** + * scsi_internal_device_block - try to transition to the SDEV_BLOCK state + * @sdev: device to block + * + * Pause SCSI command processing on the specified device and wait until all + * ongoing scsi_request_fn() / scsi_queue_rq() calls have finished. May sleep. + * + * Returns zero if successful or a negative error code upon failure. + * + * Note: + * This routine transitions the device to the SDEV_BLOCK state (which must be + * a legal transition). When the device is in this state, command processing + * is paused until the device leaves the SDEV_BLOCK state. See also + * scsi_internal_device_unblock(). + * + * 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(). + */ +static int scsi_internal_device_block(struct scsi_device *sdev) +{ + struct request_queue *q = sdev->request_queue; + int err; + + err = scsi_internal_device_block_nowait(sdev); + if (err == 0) { + if (q->mq_ops) + blk_mq_quiesce_queue(q); + else + scsi_wait_for_queuecommand(sdev); + } + return err; +} /** * scsi_internal_device_unblock - resume a device after a block request @@ -3049,7 +3070,7 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_unblock); static void device_block(struct scsi_device *sdev, void *data) { - scsi_internal_device_block(sdev, true); + scsi_internal_device_block(sdev); } static int diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 080c7ce9bae8..e2f43ae3e264 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -472,7 +472,7 @@ static inline int scsi_device_created(struct scsi_device *sdev) sdev->sdev_state == SDEV_CREATED_BLOCK; } -int scsi_internal_device_block(struct scsi_device *sdev, bool wait); +int scsi_internal_device_block_nowait(struct scsi_device *sdev); int scsi_internal_device_unblock(struct scsi_device *sdev, enum scsi_device_state new_state);