From patchwork Fri Nov 20 22:11:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 7671661 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 776B9BF90C for ; Fri, 20 Nov 2015 22:11:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8090F203EC for ; Fri, 20 Nov 2015 22:11:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 05D61203C4 for ; Fri, 20 Nov 2015 22:11:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934877AbbKTWLI (ORCPT ); Fri, 20 Nov 2015 17:11:08 -0500 Received: from mail-bn1on0056.outbound.protection.outlook.com ([157.56.110.56]:17136 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932986AbbKTWLF (ORCPT ); Fri, 20 Nov 2015 17:11:05 -0500 Received: from CY1PR0201CA0001.namprd02.prod.outlook.com (10.163.30.139) by DM2PR0201MB0829.namprd02.prod.outlook.com (10.160.95.150) with Microsoft SMTP Server (TLS) id 15.1.325.17; Fri, 20 Nov 2015 22:11:03 +0000 Received: from BY2FFO11FD030.protection.gbl (2a01:111:f400:7c0c::148) by CY1PR0201CA0001.outlook.office365.com (2a01:111:e400:58b9::11) with Microsoft SMTP Server (TLS) id 15.1.331.20 via Frontend Transport; Fri, 20 Nov 2015 22:11:02 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; iki.fi; dkim=none (message not signed) header.d=none;iki.fi; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BY2FFO11FD030.mail.protection.outlook.com (10.1.14.211) with Microsoft SMTP Server id 15.1.331.11 via Frontend Transport; Fri, 20 Nov 2015 22:11:02 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id D0.CF.32178.67A9F465; Fri, 20 Nov 2015 14:11:02 -0800 (PST) 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.248.2; Fri, 20 Nov 2015 14:11:01 -0800 X-AuditID: ac160a69-f79f76d000007db2-a8-564f9a76c657 Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id D0.8C.03643.57A9F465; Fri, 20 Nov 2015 14:11:01 -0800 (PST) To: James Bottomley CC: "Martin K. Petersen" , Aaro Koskinen , Hannes Reinecke , "linux-scsi@vger.kernel.org" From: Bart Van Assche Subject: [PATCH] Revert "scsi: Fix a bdi reregistration race" Message-ID: <564F9A75.7000208@sandisk.com> Date: Fri, 20 Nov 2015 14:11:01 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsWyRoxnkW7ZLP8wg/MHmS3WvHCw2LNoEpPF xn4Oi+7rO9gslh//x+TA6jFt0ik2j8NfF7J4fHx6i8Vj8+lqj8+b5AJYo7hsUlJzMstSi/Tt ErgyLv06yVSwirfi3vXaBsb53F2MnBwSAiYSJ/s+sEHYYhIX7q0Hsrk4hAROMEpcOd/ACOHs YJR4vPI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73TP8 VXT5XNaL7ge6H+qFLVzMPY2ajD6mBxTGvnlZWmt3RKJevaT/gfiNcMuNrE8eKN55ujr+Efu2 vc4sX9YuVo7/9XWhdNivntlKLMUZiYZazEXFiQC6Ms0E8QEAAA== X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD030; 1:rXznb9uuA6S/h2bos/2zRdEJCyqJgSI4UR5vkpiU5gC1W5blE3Sq+MGeQ/xNAeQaZlQTDZnAUxzPOcQm/Ae8pnjAcU0cqBYNO+9w1joal7z62liwgw86Wf46+yUBdDKW9BWb0n8DTDjJzryzmWa3AeN8r6dGNqOszMa4nf8NM82exZWLSg00ptLRXMoE2ETkdSwVgJsXUPINesMTze2fatnde7+FlvpkyoiGGrZQT7fBdMnXdlS0KxUcOD/Hebv06fgKA7Eki0ezw69vKmAGHsIs8b0NdkbZpyVFGhkRlzepQCER9CPO0aNddbPZFXkvntORypSqBqF7FLsUNP6MixOAw2d5jKXWIqMPTRm00jNQLzH6rxF5lCMdGLFZHzZf+dyZlwkLW0nshsae5AsrHg== X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(2980300002)(438002)(199003)(189002)(59896002)(81156007)(65956001)(77096005)(230700001)(47776003)(92566002)(64126003)(5007970100001)(110136002)(11100500001)(4001350100001)(586003)(5001920100001)(86362001)(229853001)(5008740100001)(97736004)(50466002)(33656002)(106466001)(19580405001)(19580395003)(23676002)(36756003)(189998001)(5001960100002)(87936001)(80316001)(65806001)(65816999)(83506001)(69596002)(50986999)(54356999)(87266999)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0201MB0829; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0829; 2:zT2iYC9Qi9APnOYK5EixpN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z51g3v33k9H0sckF20zQujbekBcKxvzxL5+at+kIdz5o8/IPzMzxNR7sg69roP4CNnh0oZnBCbrWdp7LCw3oCt9WdKAF5EdNPSsetf/cKZOytk+K4HW/XD8pxFFHKkxHsRzJwj0/JsZ7/K5FIu7vWtx8hhN9Dz/o0qN21KuPU13SkE588gqs9ZEy26uNz3sYUo80mV02k9AtdFx9JQJ1qN6SmntU5uhfk53IXQ0MphnhtENCSgx4WtZ3praEKYB1jd; 4:TmiZQA6NlHtNwxZhIizpvxafqHWvav5+BtboQtuLILoe8pCj4fq9axeBBgaQZlWCaOH5rFc+aZDG2E2RefKfbD9u4sNXLZ9QGXjKxNLYScIsa2nKG/pC0dkONnW3MmrsIcSRaoCbyZR38opR5cYggH9vgrtcsZhmRaZS/i3kvbDBokokuWWCj3fw9+3Xs9sGcWYVm82FkUYuQVeERoV0gq56uiTEBfFhISkm53B0o5au5tcskdq2gY5dN9hWJGS13KNLyG+4H4uBMQin82vmNrl2LFMwdDQuyw27yiOHiZ1ZaGsxxvn5bxfq6+9nqZsmI5VU2RqMlD0VTgqMUJ2A9RoduJEWlqnzrfpfQq2l5NG8WcAPAImgQnN6cgIqeH3+wg8C7ePR7KDA3/FCfdROew== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001); SRVR:DM2PR0201MB0829; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0201MB0829; X-Forefront-PRVS: 07665BE9D1 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTJQUjAyMDFNQjA4Mjk7MjM6VW00OTVZRnlnRWpISmRnRHpmbWNXVHFQ?= =?utf-8?B?T1dRcUtQUmFHaTloNFVGQ2ZHUy9nZ3FLS29rV1lMQURtTHF4VnZyMk9Qb2lm?= =?utf-8?B?LzNkSXN1cGlubWVaeTBRVGFTYmtQa2xw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Qg30DIefL8AKAVqBLWZi6pYrf9Z4OAII3EsImkZgecVkGmv6zHt0k6vklg1E+tOd750zc3rP6GuekeZbEhTUdrKvVH6YfmTl3MduJ0I9VJfJQkyo3ADgyfhJcwfWj+/ZSM2AyLn8PkLBWoyh3N39LR8HNKmULa3IDzqHEOl9SNTRK4wrybOnN/780dBviJlZR/dnLjWONkmulHWVLus2w02brq05IyDjceY1p3NV4zmDgbBAp SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2015 22:11:02.1990 (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.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0201MB0829 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The SCSI sd driver probes SCSI devices asynchronously. The sd_remove() function, called indirectly by device_del(), waits until asynchronous probing has finished. Since the block layer queue must only be cleaned up after probing has finished, device_del() has to be called before blk_cleanup_queue(). Hence revert commit bf2cf3baa20b. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Aaro Koskinen Cc: --- drivers/scsi/scsi_sysfs.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 8d23122..f5ace2b 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -1110,7 +1110,9 @@ void __scsi_remove_device(struct scsi_device *sdev) device_unregister(&sdev->sdev_dev); transport_remove_device(dev); scsi_dh_remove_device(sdev); - } + device_del(dev); + } else + put_device(&sdev->sdev_dev); /* * Stop accepting new requests and wait until all queuecommand() and @@ -1121,16 +1123,6 @@ void __scsi_remove_device(struct scsi_device *sdev) blk_cleanup_queue(sdev->request_queue); cancel_work_sync(&sdev->requeue_work); - /* - * Remove the device after blk_cleanup_queue() has been called such - * a possible bdi_register() call with the same name occurs after - * blk_cleanup_queue() has called bdi_destroy(). - */ - if (sdev->is_visible) - device_del(dev); - else - put_device(&sdev->sdev_dev); - if (sdev->host->hostt->slave_destroy) sdev->host->hostt->slave_destroy(sdev); transport_destroy_device(dev);