From patchwork Fri Apr 21 21:26:35 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: 9693755 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 3A48360328 for ; Fri, 21 Apr 2017 21:26:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B2CC2846A for ; Fri, 21 Apr 2017 21:26:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F96728674; Fri, 21 Apr 2017 21:26: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 920122846A for ; Fri, 21 Apr 2017 21:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422866AbdDUV04 (ORCPT ); Fri, 21 Apr 2017 17:26:56 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:50048 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422806AbdDUV0y (ORCPT ); Fri, 21 Apr 2017 17:26:54 -0400 X-IronPort-AV: E=Sophos;i="5.37,231,1488816000"; d="scan'208";a="12881809" Received: from mail-dm3nam03lp0017.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([207.46.163.17]) by ob1.hgst.iphmx.com with ESMTP; 22 Apr 2017 05:26:44 +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=Vppd4aiZx6/i43qBc/7reD+W63UOuSMlWKySD9F9FTM=; b=hVwMZs+aNxfcYoLDGVgcEpm8yqptN02CpCjgkdM0fjZPq1EHKTsL4dRP2HO56mGOJ+TLXsE+vbPnY3wBYckq4dustXZrUsNtDrKl6wXhxJ8a6/3pkk+Dxo5Px0TGiTUnqKYSZpl0tFx6nArmrMDK1vxocHn5u5pr3tV0KXILjss= Received: from DM5PR04CA0041.namprd04.prod.outlook.com (10.171.152.155) by DM2PR04MB893.namprd04.prod.outlook.com (10.141.157.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Fri, 21 Apr 2017 21:26:43 +0000 Received: from CO1NAM04FT047.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::201) by DM5PR04CA0041.outlook.office365.com (2603:10b6:3:12b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13 via Frontend Transport; Fri, 21 Apr 2017 21:26:43 +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 CO1NAM04FT047.mail.protection.outlook.com (10.152.90.126) 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; Fri, 21 Apr 2017 21:26:42 +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 EC.0E.29323.1197AF85; Fri, 21 Apr 2017 14:26:42 -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, 21 Apr 2017 14:26:39 -0700 X-AuditID: 0ac94369-548749800000728b-c1-58fa7911f29e Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 3E.14.18148.F097AF85; Fri, 21 Apr 2017 14:26:39 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , James Bottomley CC: , Bart Van Assche , Israel Rukshin , "Max Gurtovoy" , Hannes Reinecke , Benjamin Block , Song Liu Subject: [PATCH v4 3/4] sd: Make synchronize cache upon shutdown asynchronous Date: Fri, 21 Apr 2017 14:26:35 -0700 Message-ID: <20170421212636.14376-4-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170421212636.14376-1-bart.vanassche@sandisk.com> References: <20170421212636.14376-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRmVeSWpSXmKPExsXCddJ5ka5Q5a8Ig20LeCy+3LzCbLFn0SQm ixuL17JYbOznsOi+voPNYvnxf0wWpx8dYLf4efgMswOHx8Tmd+we0yadYvN4cGgzi8ez6YeZ PD4+vcXisfl0tcfnTXIB7FFcNimpOZllqUX6dglcGb1LzrMVTBCv+PH0KnsD4zehLkZODgkB E4mO11eZuxi5OIQEljJJzJk/jQnC2cEo8XX+QmaYqiVrN0IlNjJKPNj0iAkkwSZgJPHt/UwW EFtEoFDi0rYORpAiZoFuJok3m2exdTFycAgL+Eo0NfmB1LAIqErs3PWVFcTmFbCX2PD5KRvE AnmJs1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ZafumZ7UXb38ysbvzxWYinOSDTUYi4qTgQAlKksbtkB AAA= MIME-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)(39850400002)(39410400002)(39860400002)(39840400002)(39450400003)(39400400002)(2980300002)(438002)(199003)(189002)(9170700003)(5660300001)(189998001)(47776003)(86362001)(575784001)(356003)(77096006)(33646002)(48376002)(5003940100001)(4326008)(54906002)(76176999)(2950100002)(1076002)(38730400002)(2906002)(81166006)(106466001)(53936002)(8676002)(6666003)(50226002)(8936002)(36756003)(305945005)(50986999); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR04MB893; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT047; 1:YL/wSt7wmpZajfe6rKVQuMSImlj/y8nyZJeGy8/yEultM7KxTreunzvCPCGpRt9FtwgGrLPrJN4IlpXeKzP0jEocWi6qotv1DKMIq7Mfwgu3u13GPH5auwJRwiDgB/Lw6MDhahjHs4S++56zdbjbxnbebZqmVgiUIwEKX5CpfCuKidazbf584dbTP6hE0p7HI8mIxgAcz9H+tJV1KJkePfxU7TWdatKmt2XtVZVIW82nlNGqjdQSASjtjMt2/02vUdOzRyzRSEG37EXhp5WyrMr0QUKsU/WuOcOqYxR+NFqajjPOePAEbX0URnMv6OJOQZwvsAMmdH4m7MODfUdq8xb5WeLXJhH2NVI9jkaL05X51jN3GT8EzTzvZJEiL1yA9cB2GZ5EQfdxOUdPavwSDd8CkHXnxi/+pDljCzAaoVS1RUKu/8buEjX57/whlBV2GQoNsv1qukgz0CJbsrzr8P0yGOzXsWCCK4a488nd/Nlg8Ii8ia8o9sKYpU9ukETBwE0oLh4LsFy8B1OyaznmtChDMHHqyZZlwosEJAEm6fzzW6E7C5rcq8HTODJIfZOv X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 35eb20e2-4e78-4282-4489-08d488fd1b34 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:DM2PR04MB893; X-Microsoft-Exchange-Diagnostics: 1; DM2PR04MB893; 3:hYeRBJPlxwVx4ZcLLs/wqbJQ0xQIYQmg/SZVrbsYKXky5InFzN3wd+Cyn79qI80oYoMQ6lxbw0jlHqF4UTqEZX82dbOCJrjuFgkKsCSJjhLIEisM68mGzJcsdczne8IsFoHEixkf3mPke9wkJxnPO9GA4AQWq+qrqOUO3gWsTWe8frxDsvyHy7D/T2gTUFB9+ql0ChKJAk8/2GivJIv/aDYbfIVRY7zJElmbG9nuv3tnk4oczpUCUb+rSpwleV4DB27h4SbwMM5DAkVAcEYXJhKLpYCgoztDug4PvRG3yHnTMCWjw83B5kdAIK0e2fSQZ/GMbfGMImw/8FgVyOuYXg1WQX8SujRPLlwSpUG68oCprb6T5bB8JEC0ZGAQzmC8xdT/8fpgjSmqcTrX+IC+UHxi0IXZp3dGkJyQ1Q/ts5hxWQVJpxe19/zYRN1xC23iXTE8raRGBn9ABzxD2AQfxSOpZnUuSWwPF0hpqms7JpnfyrfNzupxWb1P8K3cyCjaJqg4HUsDuQ+SUWMogjO+RQ== X-Microsoft-Exchange-Diagnostics: 1; DM2PR04MB893; 25:zWIL7dstQjn9mNIXYqZGXueWKdgsle3oKHJdZVNTK/0RmNyLS/AjqNJrEkxr0VWGEGj1EFDRTFuM0S0lnY4rbcweiEI1cinebf/0YOgXX4tcTBFZKlsrtYWomKgAeoTv1I2hNyaewxxcrxhqw9+jWyLV5EwGRa/BhqwSKzcoYRxtB8LQFVP3JkOTJ7CA82tC0b81meEhc8egTTzbaGGfaKLPslq0Ml2SIAYcUURSqad1O3GlbvqOHAjDuF7lGob3IRu6h6jq+cDf232pEMmJLraZZ0P+PJyhLnYMnIkgGiFggdI0WCUhYU2kdhRwj7HREmjxSxw2EoErvzsnZOKzK36mVFRVzXgJ+yn9OstaWXLDDm6ByrdKCsIbXxpJTrUV7hQysYbenrl/EBzePQBrcwcci7rLt4C3gytHsJ7lhWQb0+lHtr7BaTxniVi/CPMaWl4C//MbboharnPnWA/hAA==; 31:e/3e+Q5VYtAbiWcLgJ75TETBzk4aW79r52nfgHJRTwWVH9MB3ZxuTIfS+3RoRpgeW2Ws4moGTtk2tOL09lNhaNIHe8KCOMt7z95Br5XF6QvzrVGXq9mIbsZ+XJBT/McyTopuYbUqgQ0DON0vah4ApcBVuRQFChSpytVuy0rYQyXJC5sSlt1v4nz5LE1zxJlgz3tH3Hu76p+uoyri7xcJbO9RAH2Z8L9dHt60HA4ujEN42QPpjW8tv1g05OGDl5A4QwFvbxzw7+igvViUpdjzNg== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; DM2PR04MB893; 20:lKxuJjdeDqB0JdEiRybcI8y5bqDG350MGa/o6r9+tK++SCNJSd0Dj47T2sWRyCQLmwkAEfTRc47dBjUg3nxMKEziuDMaW8+3FqXcqmkNIcah/ZEwBwhgZfuB3HJagwuZwcDkzahRet/i0ggX52NAK763fsByE3TGVplFZIEib9CgThROasO0Xums8J7e1OrQ9Cab3WgIUlPtuYw7OSscd8BZSot1ydWSfsoIxyG/axr9oIstRHNlZ61IigH5zoGiI0q797bOvK/Ns+8xTslW2qBXOVFWwhrDbFI4jzDNrVdxNTnCWxJPEUansRW+TjBgbyrdaZQ7N6IpIfTEIJmBYCSe1Px0V8/LHhj9V/9vRSDIZBIVz2zQW/pWNrMywDBkk9EvDnR7ADW64hU3nYWqGSwiCRR19IJB8rdEF6f9j5Hwc5/GbRAbKM6wxNLjbFf1e2P3VyfePI3gRAnDQFZbGcyHkMqdNg1YBX6m/u4aIGWfw07eEhgbG6iNMx0Oa6g6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(104084551191319)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(13016025)(8121501046)(13018025)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041248)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(20161123555025)(20161123564025)(6072148); SRVR:DM2PR04MB893; BCL:0; PCL:0; RULEID:; SRVR:DM2PR04MB893; X-Microsoft-Exchange-Diagnostics: 1; DM2PR04MB893; 4:Hq9rTcfkLTJw7d6XmwiacgU+QSlQ/P4/MnDD5BnA4jso5IXN9cazOvnrNSxhEpZB7/ye9To5cgeGqr8Lcbu4NHMq4uv0v6TWspDIIMpvylO9JwGYy9W1rlAUdA+jDphkWAj9Bxwa8g7aBzGFiX+YNT3hqiOcvdmJs6pUyiKUUl9d8Aopvp7az+kh7vF9ZZG+QRp/qo2ywWfG/nALX98VaarEkrA6fd7RIomFRBpTyKuRRgN2ozSEgpADTdBKxuroo4ar5dyc6q7knF2P8Qx7Y8SIPgj2DcDrgnKAdcIrCci7oc5SEDiKpK7c4K3qQBvV5y6ThtjNpUcS+8klP2UKxvSTh4XEz8clGw71mxMgcoNHMVYPXMd5VyudEPke2IcZis83Q54cqwuGEsQCB8Ft+D417Tumi/FPkZJudphdpogBzFpA0GJoc7qLsfljOWY15Ox3KZuLdOO0xVzhkwtUUgAmIoxDixEcxMGDGSVNp09xbIaY1lXshBH3RB5BWut+hjyyYwT5PLAGB89LlKC6OTiFx6v1Jq6h4gIrR0VW0AEio1MoaAdVR0povg3imYsRQin4uXEaNxqvkaIz9GTewdjqiBRT9BeA1z5J3fIjTE3RpFO/oWUlc9bbrMdmxJlYi6e/USRiFk+sAjABDMcF21k7oRKQ1xA8H6HsGjk1GJkh7qdT4G8tYYHnKN/tJcie/JahQ32gmdVW730hF4ajDbQ6KFFUo8khy+SFsyODNJRJyw7iFjU6M0srLwW+uSXEpSxskZY4MQAVjlVUvqU71EAu1MzsxTN/u4xP20TsPTSS3P+aXMsFmZOkEYiz2OyJkjTvG2a1Msex+FzWLuJt2fXmiIoFy+5xruOgCKbPzHDGFFUPKJqmxj/N+9TppFoz X-Forefront-PRVS: 02843AA9E0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR04MB893; 23:FiCbC+pQPyzUYheI/6jLhIkaiY2qg3Y1PUACBXgX70?= =?us-ascii?Q?l2Xx5HYICFiR+f+AcvtYkOrvoIf/bdb2AOR9iiBzFCcJ5XSRCWEA5ptVVLx6?= =?us-ascii?Q?fF3hjC0j0lHoSG3DfrHIesORGvJ7n1nhLC5W5vmnvoOZIWBQJGM7VmHk/adG?= =?us-ascii?Q?nON6X1It8klJy6//Ia7pIs1A4oEyqONRLgZa9mqurC/+g8lpWdRCtJAEkyhU?= =?us-ascii?Q?ilAGw+MddeYaJtL0SebDwfiPXzCX0MJwqYOlW8kNuuWnEbdRztCyEKxkdlCi?= =?us-ascii?Q?YtN1cVkrILgHJSh0ezZ3DzKdW6wf2tnvZZlWE00nnEOwV/Q1B5Kr1xiorsmn?= =?us-ascii?Q?BHBhq9kQsd1JPCpGyUMEiiQM3V2mQbZNAP4kkqJGLFoXF5z+IQGsGbJv6kP6?= =?us-ascii?Q?hCZJb+udc3MRSfoOKsPJBY4mLbX/kGg3v4/3dB5nUJ77VkOjExgI1FFmqE0V?= =?us-ascii?Q?5pksUbfqxVzqxlq7oOq/nVLwbxqtmLtM+A0nopeUrf7A/4j96aMYBreFjlpt?= =?us-ascii?Q?zvg8DU3Ofdafr1vUHZjIL8o89f2FUvdHvyS2ubjlfyHPm9oMSVpsgWOdGe8d?= =?us-ascii?Q?zJ0+KXBAFdpKqYVtBe5gSxGoi0UOBJ8QBOMtimPWohnAg5iI5nmDcklLZWBp?= =?us-ascii?Q?64resjAuXzChLe1p11il/46eZSP6vBSSTrWe259BtpYJoouWcPTeh1U+jFyu?= =?us-ascii?Q?kPmsXA+r2EdeRgXtphU9on4npcbObCujGrofnBi1ShklYxTKaZ2e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uxcldlPOcyMQwhsL2fA==; 24:xcb7Hrr3m2lrj5keya8wl6W+ES8f4KHuMYAQyjw5CowRZ5PhRuD4mMgNTkxhMdg0NrKpfwPVYO3yS+GpIfnTjRLVJYVE7rcWKwS9rD4UX/4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR04MB893; 7:z3zxPmM4Ood3M9eJjcWqWhdfHIv266kU/Htkr4XFU+SjUPvdf+HEIDffPgE/eZoHkjgb/lRmZZk208nAfgNt+fIeGUDkKVx3RkwnH6mVBPi1hrbCPQ9OjWlzLwHO4CdeL2BeNLXys5+I2iG+5ExUfUu1YNFAMxTHU6h7i1PchuGQu3ezJr67Il5L8Gk0gtXKier3+aOppuHdkotfkolpM8txPUrOOY/avqIZq7L9GqKU5cn4leOrXiSSfsHa3bUSe4rX2Tg+7cEciUFFtC5uOqq/UF8zaSIF6y8tf5RNqqNNk+fO4O4lmIVqipXddicmGKWwmhO/xoFokHxrypvIkw==; 20:2F6UAX/i9ZPLgykQzfjeIZbKd/3TpCh1VsqV7g2gGjXPNjihM7rR1xiPP2svYy6O9a/NLjVgPMsNXGBlQkhKw6ynyveUj/mOH2r/5mJ079e+gILRfiYMaAFDYeEJFeOXCIAKTHgujobzXL+XIAQzfYoyPthvTL5ufnbzdfIieMw= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2017 21:26:42.5752 (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: DM2PR04MB893 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 This patch avoids that sd_shutdown() hangs on the SYNCHRONIZE CACHE command if the block layer queue has been stopped by scsi_target_block(). Signed-off-by: Bart Van Assche Cc: Israel Rukshin Cc: Max Gurtovoy Cc: Hannes Reinecke Cc: Benjamin Block Cc: Song Liu --- drivers/scsi/sd.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index fe0f7997074e..354ec47584fe 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1489,6 +1489,27 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) return retval; } +static void sd_sync_cache_done(struct request *rq, int e) +{ + blk_put_request(rq); +} + +/* + * Issue a SYNCHRONIZE CACHE command asynchronously. Since blk_cleanup_queue() + * waits for all commands to finish, __scsi_remove_device() will wait for the + * SYNCHRONIZE CACHE command to finish. + */ +static int sd_sync_cache_async(struct scsi_disk *sdkp) +{ + const struct scsi_device *sdp = sdkp->device; + const int timeout = sdp->request_queue->rq_timeout * + SD_FLUSH_TIMEOUT_MULTIPLIER; + const unsigned char cmd[10] = { SYNCHRONIZE_CACHE }; + + return scsi_execute_async(sdp, NULL, cmd, DMA_NONE, NULL, 0, timeout, + SD_MAX_RETRIES, 0, 0, sd_sync_cache_done); +} + static int sd_sync_cache(struct scsi_disk *sdkp) { int retries, res; @@ -3349,13 +3370,15 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start) } /* - * Send a SYNCHRONIZE CACHE instruction down to the device through - * the normal SCSI command structure. Wait for the command to - * complete. + * Send a SYNCHRONIZE CACHE instruction down to the device through the normal + * SCSI command structure. When stopping the disk, wait for the command to + * complete. When not stopping the disk, the blk_cleanup_queue() call in + * __scsi_remove_device() will wait for this command to complete. */ static void sd_shutdown(struct device *dev) { struct scsi_disk *sdkp = dev_get_drvdata(dev); + bool stop_disk; if (!sdkp) return; /* this can happen */ @@ -3363,12 +3386,18 @@ static void sd_shutdown(struct device *dev) if (pm_runtime_suspended(dev)) return; + stop_disk = system_state != SYSTEM_RESTART && + sdkp->device->manage_start_stop; + if (sdkp->WCE && sdkp->media_present) { sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); - sd_sync_cache(sdkp); + if (stop_disk) + sd_sync_cache(sdkp); + else + sd_sync_cache_async(sdkp); } - if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) { + if (stop_disk) { sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); sd_start_stop_device(sdkp, 0); }