From patchwork Wed Feb 15 18:04:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9574681 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 72DA86045F for ; Wed, 15 Feb 2017 18:04:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5854B2843E for ; Wed, 15 Feb 2017 18:04:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A88B284F7; Wed, 15 Feb 2017 18:04:49 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 963932843E for ; Wed, 15 Feb 2017 18:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751694AbdBOSEr (ORCPT ); Wed, 15 Feb 2017 13:04:47 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:46664 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbdBOSEq (ORCPT ); Wed, 15 Feb 2017 13:04:46 -0500 Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1FHxZJA010221; Wed, 15 Feb 2017 10:04:44 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=subject : to : references : cc : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=facebook; bh=Gu3BnA1HMLQLm1GkIqvDIah9uB2JINnAKInVKdqV7Cs=; b=Cmqv1aaTe3RywUISKlwczDklDCj+lGXisziCTQKp7AIE0G4dq10x5pbdgZLBMMgVvLzn 1tqiF77lhkTEYHAYxh+djfmzRi513DORESXPPRz2AieUFy3QxteGYfgekObWzTypWomK VOajQMlXk/0Hk9wCRk9qEceTshzzxRRjPf0= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 28murc01cc-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 15 Feb 2017 10:04:44 -0800 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.25) with Microsoft SMTP Server (TLS) id 14.3.294.0; Wed, 15 Feb 2017 13:04:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Gu3BnA1HMLQLm1GkIqvDIah9uB2JINnAKInVKdqV7Cs=; b=B0ifYjEc8A59j82hmaGY24+i95dqzxDtkd/rKvD0rvYtX8xGZVEr2n2h1lfV2YTApm+5cn0OD985ojR+aNJU9T6tGYoWohBKRrxJ/xQiwT0SZCyByD8mItXgnzJH87PGc6gSZ4SmP2d5dyi1ECh4+BEPzc553WSJJWijwL3iwWM= Received: from [192.168.1.154] (216.160.245.98) by MWHPR15MB1197.namprd15.prod.outlook.com (10.175.2.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 15 Feb 2017 18:04:21 +0000 Subject: Re: [PATCH] blk-mq-sched: don't hold queue_lock when calling exit_icq To: Paolo Valente , Omar Sandoval References: <73cd0cf484e8b75a771d908c172cd3a931dc00a3.1486751329.git.osandov@fb.com> CC: , From: Jens Axboe Message-ID: <9fe1b3a9-2a80-8891-1044-f83558e28d15@fb.com> Date: Wed, 15 Feb 2017 11:04:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [216.160.245.98] X-ClientProxiedBy: CY1PR18CA0025.namprd18.prod.outlook.com (10.163.31.35) To MWHPR15MB1197.namprd15.prod.outlook.com (10.175.2.139) X-MS-Office365-Filtering-Correlation-Id: cd14ba00-200a-4795-56dc-08d455cd11b2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:MWHPR15MB1197; X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1197; 3:0fzpw/yK+qKQU5xNWCMcS7z7m0eCtR0ODjQgrwAUJbAYFTEHXBSTA6FMzEC4ka+gZ1EB+04BNggYbL37Rjf1r4tqW74hK2USRl13cgBTn/cVvkC3y0PVO3Cu+FFtI2HOm6yzvL9ZmND9z9Gd3wVLvYO1vlTHX17/q1T4NTzAQLqUv01/aowoZeh5kHnG+ISOrq8vXHydvWkE5GgFKMQRXmLky77QVO0qna4qMHjs3Pp3mqHgiU7O/pnxTyZmu+orQoEbpRAPLKXz+ow6/uqA9g==; 25:TW8HHhKix1bXQLVJFc1GGAPwz4/DoRwjJANcA4wj+q1bncIujLzjY3E7vupxqmDgU5xE832AeQUw622Gek0ghQ+vM1YcYu8EFRWUXzO6T5nfEBbExNM+8sJ1kYtDH/k+2pErKXR33WzVvqqI8HR+Frm6asFLYbZ68gU/gBFoNr1xdTADQ0wPRWxTm/chnhknPE2Lw99lrLg99ApXsD87x8xPkV7jbM73GcACkaYZtoWs7is5Cwb7C7TDcAyhun4PzYTiGFpKGUDFVfwQitrFCUB8ndGJC0kQvxegIwGtK2rxamxu/JHFNZAiB5vGjLLOjW2tIUjXWA1MY7AveVJqRvJChZ+YXhry7BhTrgk663aqCKu4tY0nzKcu2hpqUUO6ZD7zsgfSS3xLYz7LCJdX5GX92CfQlztlIjj6osStpCN8S1CVq+4g9HjZo20NvwgC6M2xXtgocLo7gtI5/RC1MA== X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1197; 31:GB6B8Z8FLq172pkVkiBQ5BK5i+DlVP1984G9Yf5fnvJcWk3vE2y6sEMGGEBz1soh9wq1BaFn6u16r50Y3iUM1F72KPS9+dYm3MxTCfY53Jq6rzD384GCsS2LgJ7nmVQqXgwS/0usRJWQZRQvwG1ksFJ9Aa2FHzmQzVq1eiee4aXzDPV0qE9b6CR7GFc4z7wtprNA2FsArWKXuDNALSEzG5lvge+pRHepieb3Xu05B+M=; 20:DCZl9rxp39ZeRgJf5xXkoZEAj8E3cxzv/RCiFKyRNRIwBLqkFcyjzGim1UBUsmQ1LUBodq3aJEB+tgatbxznldute2VwcWdQARhom4iz0gs3dQnsUAfihRYnPN91P8WSQfoFx55orz2ZD5FkPCC0Qh8/ZE45lnLvEOgcciBFzAnnu8QIWftNGEufZd++glwg9D9NUDooiQFqubz5rDP/xDW0Q4iMkTa74/Qb7uVWa7R8SaGFug+2r+l5pIuJH3i9TC6BkTTaL/GvrkKsKEKCkyoQikA/6EZ9B92w1vLA4tl3OkliXpS+7f4LstCnuhkZ4Li0hmv8AWaQQOoXfp5VMMu2TLZOUxPNB7nJAz13Qfy+s8/FhxAQJktGKuoCdjOGBSq3bwkRT8P5AO3OOZxCCgqU8rimqNxgVS4gh4lGff8DzyIi2q5T+4jPTnwMk9VFTn6oJu0XPMWUwoUwaXf9zrypg3X1Cn7oOXv/sOo/ywHWIpoJppLtldKWMhFDPnik X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123555025)(20161123562025)(20161123558025)(20161123560025)(6072148); SRVR:MWHPR15MB1197; BCL:0; PCL:0; RULEID:; SRVR:MWHPR15MB1197; X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1197; 4:agQWWntH8HDr7PrvmfOtxyXW/rB+qZjCZdM/mIftosthv8nVivKcavz0oOXYD1xTvxufmnqBjy6WKm+JotMOU7qA3XeGt+UCbfOXJ3hhch6+qOg1t4wSM5UnI5qSSvukEkwBVekPj0Du3JAp3DDfDKghxEHsyrydkn7WVST94vN/qQa2qh/cZzPv0ZnNpxsNSSPx7I6w7z9epfVkAQonWSqAVyne14tIyuyj0SDQKohXI+6hPxCPzT3RWOC91sFBjBV7kYcdcvpdOumahWyFwV6vi9+AoBONbH7+kkbBWX+LlQZMoBs9VweVOVELy9IgzVYnDZJzBnfZnaWwnrznw5asFelo6A3Mlhw9qX4OzycNN0MHTvpXmHnTcOuujwUbKArJQQisr/rtloLvwMilzEROCKuoRxgjk1IRO6h/HcfdYxE4zgdXqNAJGeCgd508ubG1NLgDLhQu6avCZ+ztwUCpKdEVeG9Ip3UMimnEjS2U/sjQuxu1tDPu5g77eeXi+IYOS0ENdh32DgXhMXC10YVkCJwU56dgZmcV/D8n2AjDr6ZAVaTAfopmNn2Cv5vixE0uUYz+YQVG6thqlp5N9h2k9R8shkJZAfQMUGFSAPdrdx4DAv5NaTQPdTu+AtLPDd6CgBscVZupcWoxVG9pIq20nn8xOPP1/GxvEneCB6ghqK7pQHvbprsZl4uMI24J X-Forefront-PRVS: 021975AE46 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6049001)(7916002)(39450400003)(39830400002)(39410400002)(199003)(24454002)(377454003)(189002)(97736004)(81156014)(2906002)(106356001)(101416001)(189998001)(31696002)(105586002)(4326007)(4001350100001)(36756003)(54356999)(117156001)(92566002)(230783001)(50986999)(23746002)(76176999)(389900002)(33646002)(86362001)(50466002)(68736007)(38730400002)(42186005)(53936002)(8676002)(230700001)(53546003)(31686004)(3846002)(64126003)(5660300001)(65956001)(81166006)(47776003)(6116002)(66066001)(65806001)(7736002)(6666003)(83506001)(305945005)(77096006)(25786008)(6486002)(54906002)(2950100002)(229853002)(6246003)(90366009)(65826007); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR15MB1197; H:[192.168.1.154]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; MWHPR15MB1197; 23:6BmEhw8umkN3mSQHV19tJmis7AZguAdh+KZ/I?= =?Windows-1252?Q?qHBf5FoZW+ElAlgOdYCiRMZNf2IP+QTr3WgemqQHuaczu/KKpxzEtOiQ?= =?Windows-1252?Q?0mA2NHfDEqswdl7SKmPnpWQcz5n3H6BLusP3HgjVlAro8Mtiy0Wv6glm?= =?Windows-1252?Q?39HnwV+/yVVItrd2X54f+sZd5Wvx0lLCFW1nOHoVE28m/+1c1sUrCUef?= =?Windows-1252?Q?SKTF/OIYxc7F3pSouMCra+ylsX3Drw4f8+XdcFlx18bnc2IRaScHPxYX?= =?Windows-1252?Q?3pQoT5CBkDvrClukkqbE2EIUgKWOl6Oi9QgXW7cW7npFB0omqUGmGpPE?= =?Windows-1252?Q?0dSGcB4Ab34xNfaNEQt6glikj7z8MCN0lr+K2QV6Z5Pai4AO4jUvkgYs?= =?Windows-1252?Q?B0sAu/Kfqq56irFhIiwj4ccCv+vf+2PQcwW7Fb/N6WT2WDe73NqfQKIv?= =?Windows-1252?Q?88SNXuMFvLKYS8G39/rbeOPSGFqBrBpLcb5Z7A++VSCy//uH7ock7gnE?= =?Windows-1252?Q?yDXuajemlZDD8N410bFPhAHb8oP0lzxnJvBfjEjd1kKcQ4PA/sK6X5r9?= =?Windows-1252?Q?94aPBHPYOTdunQFbEcuAdC58ZW3V1bKsnPnjI90bCxFqBNf9zJmvBAuL?= =?Windows-1252?Q?vTjUOhq9kgWfsf2CbmE6WgQXOu6ApWMhRnpDnFXLh9lBpjpUK/eWDCk4?= =?Windows-1252?Q?XGCojcGG0b8WQjbAFy793jVVeSnPfoIlQ5tPgfHC7xHqJIan9zRItyLw?= =?Windows-1252?Q?Jc55F5xg0YVwqa+i02jAYJRezn6wKr7S408cC/OrMjD0PUCkD9LLaGB0?= =?Windows-1252?Q?npDXthyCHi1VrZG7sZV2CVyvn00Gzg/JLMfgKqP9mKf0EI+GWpg31X7v?= =?Windows-1252?Q?wIPloQJWFjLvoEA8QdT1FJIDE9D8Nj5+z8pxBipe6H3cEyFt1iFQ5wmg?= =?Windows-1252?Q?edZEtUAhtkQV388PMAKZTQg0EVtR1beJ01ymPygWmE+a5v0sNBIaJAnQ?= =?Windows-1252?Q?199wT15INEavhEMLYrpRrdBYN1tV2T9pKl8Sccz0UIolH7X+GNFuDYAt?= =?Windows-1252?Q?PRPo6W/uRz4nnxHv7DPJevBrVrnsdlgxlf5WVkFUUVDERsoe1edRHUCp?= =?Windows-1252?Q?0gt4yjlxi3c21FVdQKHancgTABgpvt0XvQKX61whd3dnNW9mn+N4EdRG?= =?Windows-1252?Q?HDi4H2a9fC5XgiPmsAAJ231Sl9804Lelt3nCjv3X18n8c8M2NPIUmUm6?= =?Windows-1252?Q?GYbCElpnBSdo6cBkVNrZ9nVchHIXINmjYsXMAqs7IBx/Fy9NbD17Uv4c?= =?Windows-1252?Q?nVoSKiPoTR9KPPp+yF8owGnRmibPY4dscSS2COpuQEEdQhxXwV0OZTTG?= =?Windows-1252?Q?eSJclWtDYWPmWlP7G6Q4bwcDdzLqOidjmfUGYWYpRRe9S3eo19iVHcC/?= =?Windows-1252?Q?XsfqaN5k/4bHbc8qSI2VOA382qlP7jJiKKzdG9IlT0n0tDprxknRNmBO?= =?Windows-1252?Q?kLTv0p5dufyTOv/WcYedu0rzByVGw+Lv8WGeITclDxxLP9f4yoNJrkTl?= =?Windows-1252?Q?QmNmqbDQ+98Oaa0DI+RI1iJnHcbb3+lTdLMK5Ip58uom5xhYa/Cy+Iq8?= =?Windows-1252?Q?ksDjwap7m5OK+QytGmGPlg=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1197; 6:cFLW7sGd3FT8JWE8bnKAPX7xDWv0QKgq3nD+awhPhao5nsW9suRLCTEEFn9bUAXrakZXbVNb/hNPbYodgIS67wR1g5n0a/yIAm0LpZ+9jgwZLRPSsa6DfOXEHxkmu7nr3OvZfbREGeD/M3eFhF4JAyAg+taKJkJ5iS+Ue6csloKZPAOa/NXxSKD5AYbkTs16IXZ4a37Qv1tWURShMRtH1KhkRcypmz4KO3h+rQv5FhqZmDzN7pmA4c8j8ALtfverzBUM6GOQYUS0bBqSyyamwObHB+GcpH11su9qNbP0guwSHQe9T99QSiM4Gl0YsNAQs2ltWsjjm6eYmw7/GzOtG0E9enW+AOOurdHkJWKqoE2Mu410yl24N7/iZoXlXnkQWgbklbCvubB6uDDIGAHKQw==; 5:cv1fpOMZ6U7S0ZVbvrqNmu+YLdjyAQ2prR9Yq/+E2O9ilX6/vkEYSQ5gmem6Hk2NLuupuO/48huKQWnt8VJJj3kSOVPli/uEKeWlRd3FjHvnjuQkK/NuhvE+CU7G2hLEFdu8ZGDzOjwoKUcxrZigOA==; 24:5qQi8GuIvZpSmJy96SFUdZ5fgMcjYE4lW/qeQy8eg5dabNjiSzXQDBt1yWcP1Huu03dHycIsfbmeSIxsIUf1AcXBCTRz8KXLb6WdC8oXXiw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1197; 7:0LUcTQssmnLGUQGj8JzkbZvxviciOwrve1gWw2x5jJtnvUPTIYRe5Rds3aLAJU2yfMitddkXKCQiUB3Fisq5Nx9toRTC7ITQcwP8Ez/BW1gCFHMNUjyu2E8OcjnHd8B5jl6y4BMU7G6SO3lNzxR0o14twm2f0ArSOvn3ZpFBTzuoDzzH5M4Dwj3NP9AUS9O4NPUobWJ3ahqjtHIlcsTHLDvUP7yS+/uc9eUWRV41bUrBR2TSUsfLwBNXET1ALn4TMnbtvQpVmYL+q4UFaIwDTxZ4LutbM4kNchdkbTwu63tfECu9e+QvzSNlzwnQ+QA/DuM4YxLVugzh/ZQv7rQ51UxWnVbxfrIe8bjo75DNfC335Q81sOaQZga+1q/iERfjVC7UtRYQ12fM85l3CVm1LR78GYAsSyi0LKxHDDFRPxsc+GkUkXxi4fctmnqSkK3BMk9naHqUCXKC4LWaAmoPyGGZ+1OMRzIjP+neFjwBAGWVOKgLGsj8uU1a99yjq3rdtE1DOkql7ZZIAAo5WpDDtg==; 20:gQ+EYPU8q01bTcqYhZTktQB/nIkhggpN+FiqvYg5IFKHzoLUx0eMT7kXXGpb1Wf7ns1qYELE5tCdUq4d3RMbJAUmy7ugBZYYygNotUEtdn5dT+uOCkBcRsD8sqP0390QtISAPvNzsZXFc0eB7dOntzJDMBM6wToo0YEUC6ykt2c= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2017 18:04:21.6897 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1197 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-15_09:, , signatures=0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 02/15/2017 10:58 AM, Jens Axboe wrote: > On 02/15/2017 10:24 AM, Paolo Valente wrote: >> >>> Il giorno 10 feb 2017, alle ore 19:32, Omar Sandoval ha scritto: >>> >>> From: Omar Sandoval >>> >>> None of the other blk-mq elevator hooks are called with this lock held. >>> Additionally, it can lead to circular locking dependencies between >>> queue_lock and the private scheduler lock. >>> >> >> Hi Omar, >> I'm sorry but it seems that a new potential deadlock has showed up. >> See lockdep splat below. >> >> I've tried to think about different solutions than turning back to >> deferring the body of exit_icq, but at no avail. > > Looks like a interaction between bfqd->lock and q->queue_lock. Since the > core has no notion of you bfqd->lock, the naturally dependency here > would be to nest bfqd->lock inside q->queue_lock. Is that possible for > you? > > Looking at the code a bit, maybe it'd just be simpler to get rid of > holding the queue lock for that spot. For the mq scheduler, we really > don't want places where we invoke with that held already. Does the below > work for you? Would need to remove one more lockdep assert. And only test this for the mq parts, we'd need to spread a bit of love on the classic scheduling icq exit path for this to work on that side. diff --git a/block/blk-ioc.c b/block/blk-ioc.c index b12f9c87b4c3..546ff8f81ede 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c @@ -54,7 +54,7 @@ static void ioc_exit_icq(struct io_cq *icq) icq->flags |= ICQ_EXITED; } -/* Release an icq. Called with both ioc and q locked. */ +/* Release an icq. Called with ioc locked. */ static void ioc_destroy_icq(struct io_cq *icq) { struct io_context *ioc = icq->ioc; @@ -62,7 +62,6 @@ static void ioc_destroy_icq(struct io_cq *icq) struct elevator_type *et = q->elevator->type; lockdep_assert_held(&ioc->lock); - lockdep_assert_held(q->queue_lock); radix_tree_delete(&ioc->icq_tree, icq->q->id); hlist_del_init(&icq->ioc_node); @@ -222,25 +221,34 @@ void exit_io_context(struct task_struct *task) put_io_context_active(ioc); } +static void __ioc_clear_queue(struct list_head *icq_list) +{ + while (!list_empty(icq_list)) { + struct io_cq *icq = list_entry(icq_list->next, + struct io_cq, q_node); + struct io_context *ioc = icq->ioc; + + spin_lock_irq(&ioc->lock); + ioc_destroy_icq(icq); + spin_unlock_irq(&ioc->lock); + } +} + /** * ioc_clear_queue - break any ioc association with the specified queue * @q: request_queue being cleared * - * Walk @q->icq_list and exit all io_cq's. Must be called with @q locked. + * Walk @q->icq_list and exit all io_cq's. */ void ioc_clear_queue(struct request_queue *q) { - lockdep_assert_held(q->queue_lock); + LIST_HEAD(icq_list); - while (!list_empty(&q->icq_list)) { - struct io_cq *icq = list_entry(q->icq_list.next, - struct io_cq, q_node); - struct io_context *ioc = icq->ioc; + spin_lock_irq(q->queue_lock); + list_splice_init(&q->icq_list, &icq_list); + spin_unlock_irq(q->queue_lock); - spin_lock(&ioc->lock); - ioc_destroy_icq(icq); - spin_unlock(&ioc->lock); - } + __ioc_clear_queue(&icq_list); } int create_task_io_context(struct task_struct *task, gfp_t gfp_flags, int node) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 070d81bae1d5..1944aa1cb899 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -815,9 +815,7 @@ static void blk_release_queue(struct kobject *kobj) blkcg_exit_queue(q); if (q->elevator) { - spin_lock_irq(q->queue_lock); ioc_clear_queue(q); - spin_unlock_irq(q->queue_lock); elevator_exit(q->elevator); } diff --git a/block/elevator.c b/block/elevator.c index a25bdd90b270..aaa1e9836512 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -985,9 +985,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) if (old_registered) elv_unregister_queue(q); - spin_lock_irq(q->queue_lock); ioc_clear_queue(q); - spin_unlock_irq(q->queue_lock); } /* allocate, init and register new elevator */