From patchwork Mon Apr 17 17:34: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: 9684005 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 13C7F60326 for ; Mon, 17 Apr 2017 17:35:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06040228C9 for ; Mon, 17 Apr 2017 17:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE9D62522B; Mon, 17 Apr 2017 17:35:15 +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 4160C26247 for ; Mon, 17 Apr 2017 17:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754821AbdDQRfN (ORCPT ); Mon, 17 Apr 2017 13:35:13 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:14425 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754627AbdDQRfD (ORCPT ); Mon, 17 Apr 2017 13:35:03 -0400 X-IronPort-AV: E=Sophos;i="5.37,215,1488816000"; d="scan'208";a="11724342" Received: from mail-co1nam03lp0017.outbound.protection.outlook.com (HELO NAM03-CO1-obe.outbound.protection.outlook.com) ([216.32.181.17]) by ob1.hgst.iphmx.com with ESMTP; 18 Apr 2017 01:34:51 +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=gtiDNSweLXx6mhodk2yrim6CEY+OtJ/OzAl6u1qeKSU=; b=W8+x7yIlwUCWtlDAkp7Va8tMs+rE9c9Q6eOy92pZAaDE2CslO4CiL/umjNc4o/YGdD/KDjnzXaljQY2gwu5vqDPDghLgW0KEwDAlmhdn9ya0SkH5RsUW+xOsW9L0uAiH5qrrzXwLbpkFwyGcBa3BpN7FRHrcFz/f9RmdhGxni5E= Received: from BY2PR04CA041.namprd04.prod.outlook.com (10.141.249.159) by CO2PR04MB2229.namprd04.prod.outlook.com (10.166.94.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Mon, 17 Apr 2017 17:34:43 +0000 Received: from CO1NAM04FT021.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::206) by BY2PR04CA041.outlook.office365.com (2a01:111:e400:2c5e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10 via Frontend Transport; Mon, 17 Apr 2017 17:34:43 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; suse.de; dkim=none (message not signed) header.d=none;suse.de; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by CO1NAM04FT021.mail.protection.outlook.com (10.152.90.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1019.14 via Frontend Transport; Mon, 17 Apr 2017 17:34:42 +0000 Received: from MILHUBIP04.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 EA.9E.19026.1BCF4F85; Mon, 17 Apr 2017 10:34:42 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Mon, 17 Apr 2017 10:34:39 -0700 X-AuditID: 0ac94371-41ba798000004a52-f8-58f4fcb1b6ba Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id FC.7A.11415.FACF4F85; Mon, 17 Apr 2017 10:34: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 Subject: [PATCH v3 3/4] sd: Make synchronize cache upon shutdown asynchronous Date: Mon, 17 Apr 2017 10:34:35 -0700 Message-ID: <20170417173436.15555-4-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170417173436.15555-1-bart.vanassche@sandisk.com> References: <20170417173436.15555-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsXCddJ5ke6mP18iDLbv4bf4cvMKs8WeRZOY LG4sXstisbGfw6L7+g42i+XH/zFZnH50gN2B3WPapFNsHg8ObWbxeDb9MJPHx6e3WDw2n672 +LxJLoAtissmJTUnsyy1SN8ugStj+4M7jAVzJCpabl1mamB8KdzFyMkhIWAisX3jRNYuRi4O IYGlTBKvFy5jhnB2MEps2/udHabq5YmF7BCJjYwSLYvusIIk2ASMJL69n8kCYosIFEpc2tbB CFLELPCSUWJBbwdTFyMHh7CAr8TrrTIgNSwCqhJH774AG8orYC/xpWsVI8QCeYmzW3Yyg9ic Ag4Sp47dB5sp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MB/ygfYtABAAA= MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39850400002)(39400400002)(39860400002)(39840400002)(39450400003)(2980300002)(438002)(189002)(199003)(9170700003)(8936002)(8676002)(81166006)(5660300001)(356003)(2906002)(50226002)(50466002)(189998001)(48376002)(4326008)(47776003)(50986999)(106466001)(53936002)(33646002)(77096006)(54906002)(76176999)(6666003)(305945005)(575784001)(38730400002)(36756003)(1076002)(2950100002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR04MB2229; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT021; 1:fXib4Zbqn721ddA7c22XSnAKUPew/bFxUjqVNzHKIZEPnYGyH2TgHLDzVjSnYQ9GBT6GI1HsT9hBoYYd1ZjeJfo7h9NNXzMKcXgbN9bjT1zzpm/LWGgxNk/OmYWj7rxZC5CD+fX9uCyrvD1W69GuUTN6tH7uxeNM/HFl4CtGJSYdTNAbJJkXDSl3kycQouAzyu9LLPxPCtWahTBABZKY2NkgxlkusxZFO2vISNvVZv+oWI2yHWEUaXFjzGcIbkjvf3tW24OqtiZaEuLnRDN7nRles0N9rxBNG//YxBry+Z7cGJDzFh+02ug8XRWySXYPwds7N8pBJn2AjgvONpPxt4h2UXCAX2z6xrlNvhUPwsZ3a4AJqmnJ1JihdmH9kgaJwoxtUB8icp76khDkmIW9ksSBAIVQjcg8MVta1MPHooGdWLLti88bLfZXxtf6eJ293A262POcm8CV1+XgSAV6nRmS6y3yI0uGXpR2ve14Vxt01idUW6/k1g3PVMkALp5uIers4agGqB2qtyL/uH9UuKenOPhEJIZi5mHDZ0jtPsrvXkCzBq9lt7fTzJswZoB6 X-MS-Office365-Filtering-Correlation-Id: 4c292691-3b9e-4b19-03c6-08d485b808c7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:CO2PR04MB2229; X-Microsoft-Exchange-Diagnostics: 1; CO2PR04MB2229; 3:kEDrS/jRAy+y5iqfswvQqxoz/fGZEV88kbUghbzzP1SnAAzY3FEQBo7EJj7ohTV1R7PK5ae5Uw57SJbIHsD4Uq9hzGpNM/9wIJrAT6veJVXvYyHpSGSumtc8ykPs1BYI7VjSmQquDzR4TmgPQf3c/kFT8vv+jR/Ajw+Jv3c2UM+jW7oj4bNWbx4TLLbfbunYI/Qkf5atai7lCq1BGkkamYivXb/+Uv9orywoNe48DsHbkBzL9vFEYxDYCdXcFJqHKBtGUyjtFPY+oBuI7HDkcW2xiU3H3R7oQpm1Nr7gZnLclMchkVCcZb2/4tVR+FaF7v0JPowpfel4brPzgwcbYIig7Ht6wd+WuS7fTOXmEAtsgyhsPcladu+tSJmK7PSKWhRan43gAvUcgYpobcYuxCQhl4exLPTP48UamFWkQLr6aFUetLWs9920p84AtCJNu+AqLff6GyoN4MzK3JMgM0RBkD4te8ONaNDCYF0IpHhbQFDUfAz212u8ltZQV+n6 X-Microsoft-Exchange-Diagnostics: 1; CO2PR04MB2229; 25:gamatX/l/JX2G5KFEx+dkx/G3ywl3vqUtlQF69XSLhqqZ56UzeIDtRWxD135SOsG4jfzB5LIE83mW7QC/kUnnnd09NixlYa/P5CpEvCvU6BmPDsxsz2nXjukpK6d+3YK3nuhNH19xT+hMlg54C+6sS/XHr7D8A6YYB9t222YUvCrrhrDQvMnOxxOyHw3efi94bke3iWakePyGuj6W4ygTL2d5CzgeGANBFvOiV0T3Ep021Nh9wqNVhZRjWV3GuYScc+mAFsVTCHnRLGl8j/JuwLNun1tmzPUg57FdyG+PfUoSqu1t076MDZGk4PjoZSE2pa89Ng2WkZJzQWOV/TFsUHnQU7KLKSFiCg26jsXyHta4CDVbDFTlyCIAJydXBm4PbMY+ASHw8WMQlHHv6OcSTL2aN1FoIt1kjLtfjjY1oWfLpAgAPS/eMn81S9UeHv4HCYnJ3L1PpbE132eORKBCQ==; 31:Z0si04rnI9GgTLHR9sluyMzUKEw98S3VvSKCViHUslCZG5j3GxgG3+3zSpiLFd7qR273GO2cHKpLjjnx4Q16SKCsM9AFy3Zu84OGKKpjExXNbarPkA4aFGoY/zLP5QYMqY00ol9ptugrgDMNL+y2OCjcjzxYL1qFQEjNBh78NsCgREBR8QAYxcdevF+Vyh2rRN0/I59n/3c+3w2QbmWMjyXqMRQJC1MrvpuWMUNO5fy6EQk7DfdSJ7srXwyiGcdsA8QS/WYeBWHpZqv2r9AGsxSMvrhFi948gV92eRsLlfM= WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; CO2PR04MB2229; 20:FV7u7T9hihGk+dl+wOBwK/lD18+YhmDwCFNUVxWdQwdmlNg7ZaXhwM/JodD919pDfJgXpRD4aPj/qZZQFskbgYcB5yzANuctoiyXj3DJVYN3kRZJNNNicobnRJThViTsYjVwZv7FRatRRExeRSaybI7zOKMdGVjpb2S8U+9kM9mA/GMGQs6oZSOfepY6IRF0WgOPOHYddT9XgETDIjJb4XWZoFRVJvX28juVE54FQw1gsPn9eCNSO3bIlkz7KXnnCNG84xGs/XwzZKWYhzsaff+V6CWTCSecwl/8nH3nqFOiRiUOldOMP14mSZLBqN4zhGkz0Y1nX0VjNBsRdnDLfsiCb8pDH78deLogy7U/hpvOGEFrXIrn8AxgsmpCTl7dItIGWWiYya3oF/6lv2jOYkRxSKZfJnlTE1ZnPJBHTP+zk+zomVe2sv054QOC8aNXXwj2xEK3AiZXwuo5rS4xwQsgqz0gxeE3h4nCE0vj5AyQbFs/PJR7La/H2JLg0Px6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(104084551191319)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13018025)(13016025)(5005006)(8121501046)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(20161123555025)(20161123564025)(20161123562025)(6072148); SRVR:CO2PR04MB2229; BCL:0; PCL:0; RULEID:; SRVR:CO2PR04MB2229; X-Microsoft-Exchange-Diagnostics: 1; CO2PR04MB2229; 4:xd8lX0vwScmWjzu3OVnwJxSzbE1hRpADdPhcRrZYEsefVLNV7Bv9+udBjZmVR49iIBnJnKuqrn5BK7KNHmDjiaMiQ51YJ9ldPNk44R1k9lVjX7L0IUYHIrPCIl/fw6wiMeAZvFhEEyZ2MkPAC+jGAZqtX6T6K/iGTE6yubWOjFh8u3mlhxjF5kLz+W2JYu3YinRSrpSQqwQxFsjSs2on939tle8gYyeBgeML3ZXsYD0gMBWCpJDX8n9nnr7Py9odRRr9/cBfpe6dipzCDTkxtQtiUGGdcCXfrZ+ePaEBNu/4ZWyZtNb/hJQxHTEgzRH5ku0Mv605PIIBOhG0Q+MWaTvzymn7g27bZnRrDql4mv6ktP6m0rHxvlh0FB1F3VeTqpxbdNZYFhje0LM8xfL0g4D3e7wAXW6UMIM32oTCkAWYsJm9Jv7xr+LsT+gJhiV7TZKhIApplaUR4QjKR1DJ3cD+N5PmRlXm8ar7557GUp/K1JUB6Q4EFMsFck8bRtQKoIdbx/wfvrRHOTJg9FLFj2y/oWCxwf+vsEclygv5nxIulUmgD1LHRvTfoGd0pJ+Ag5xbkMnF/K3brJN7SnH4sAeNb3p2Em3yk3uoBtVFQL3CjDZYVPUNGD0ulkRpDlAC8v6u0nrRgT4gMoWaejoKwob6I6E9H4ZQOuswuHtJzBZQTfQm64ABN8jLua/3vCGiSP9zA/r/fjKzJmwH7L93r5a4fkaEbhfNYF8qX3bO+ArtNP4VOEE6rQkmPZWZ0ze0uKLBEbw2/1ObPHYM7m6JkprinJvIk6CJ/xVRieoduFoKTMUSwyEYLD6nudQHimetaFtQw3/fdGulRpVOLjOXZVS8P6QoTIqfktd1yslnv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hZq27iCbO?= =?us-ascii?Q?4zcinzyOCu5TIfrCxVEpfiizaO8BTlSX01hLrPbcb4p590i8nDbiq785eqIO?= =?us-ascii?Q?5h3ZKUm5QjgO9W0VWlkIN+DWYFCdP0m+lsbk971FWOJfD4MXKzLXk2IC8t08?= =?us-ascii?Q?3U+MAuQIt5trXBqBZZ+QQ0j+U9TTj0mAhuo0X1wXg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR04MB2229; 6:4OCGWt3997suHz+5IbvkM6rDIakU91a6vu66Wf/w1F2SltOpqMIsMVhiEd5WacVFHi4p0xWMIXwsEEn5kXoCN084G0o5rOJnZdMUS90Q34HnZE/Q4hAoRTo95XO11yZjeDhhG3kyqoqEJ/v2N5atW5B3Y4FMC0fRXyI7MhxzQGRFqiyqQdzlYgRV3MWgIMUvFGcJta4nthmEBYznac1SveCOOLMFnGrmck6rjWx56b9+IXzcuNwjOKaEjleUtN0QnizgaL11GOIBCPgr5tLuVfrgX+M3Ax9YalgVQfrvHRBm7WQZajYWy3K1nre7rtzTu+gPmp0QzC1E46A23pmccc0Mjh5Wyam3sCSEqaox5V/1gm6X8Oe51gpv/wnF005pCaqPBOZKiS/PeYMEbL0XnKg/UeYmfd/LPYcJ4NMwpbIJ3J4i5Q+XBVc7sFUhb0Sfz+lDcHRELY5FaJSG/hbCmKnPmIj/3QJmnv/ygx5Q+bc=; 5:QkskkLpbj85saZcQPgnYM+0SGMb6kFmKAwgRNiURvSEmxcVKBaaEYPLu3i8pCTHwlvHRnLSESsO6K4CdHRYPXHhiL5EgfaoFUOFcoWtovfyzHpcg7QOOc2TdRismC/z1iaOCKYqAebxr2LG59aRFhg==; 24:iv06xQKyJKKg1yCOw5a16SZmXyczmXWMrALvpmlnSB6TKaTyuRxChsp+pqAH5CfnTLYPD6Ydr57pQO+Z7i/n+OdNYlikv2Gnw6GuFLeHtWo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR04MB2229; 7:iMBRCjQivM/x9rkhV5gfz2wwjc4PhJdLOqXVkOSlhsnx7VhqEAKG8yqQyqox/hB5vhZh6xNEMBVrWp1BzRBfkTDRoildvo1Bc7ksOrbCXE6i6uWNYNfcsnL1y9/mJrk8xZZ8Sl3Gj7AMUCOQOqoTa+0UdQgjt1QluD+zMjQVSG0nwDk5Eaqc5Nf+iL4qL4L1v3tLMOekGWq9jYZ56X7mhTNewHOw32Vh720uDsA2vNkyR55nutLCCrjv6PXA6cUdyDMLCqllFSiOXSMwJ//ZVltl/UZKeKEJdrhvfbr42DLjZw6saL9fPihur3xj7ifPHt+wScyprPCES4ErlnX+bA==; 20:2IvaqbWEqEuj7g7712OJ5KIrJhn1oYTk5CpCpNo7DrQ9+CwIJWC1Dmb7zIZWc+hAOoSjcZaqj/ZYgmf6+cWbKZ5f27It81yoiNf3xBYQsUvEOSYVP0vvT/qMkg74W3Av5G2NuAog7l3o4YUWv1lZqAYsvzlu+kbhlZra2K6Ijr4= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2017 17:34:42.9288 (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.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR04MB2229 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 --- drivers/scsi/sd.c | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index fe0f7997074e..deff564fe649 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1489,6 +1489,33 @@ 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) +{ + struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); + + sd_printk(KERN_DEBUG, sdkp, "%s\n", __func__); + + 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 }; + + sd_printk(KERN_DEBUG, sdkp, "%s\n", __func__); + return scsi_execute_async(sdp, sdkp->disk, 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 +3376,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 +3392,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); }