From patchwork Wed Apr 11 19:55:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10337081 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 C20CF6053B for ; Wed, 11 Apr 2018 19:55:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B10A1281B7 for ; Wed, 11 Apr 2018 19:55:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A57D82821F; Wed, 11 Apr 2018 19:55:54 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable 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 2292E281B7 for ; Wed, 11 Apr 2018 19:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933499AbeDKTzh (ORCPT ); Wed, 11 Apr 2018 15:55:37 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:26526 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933362AbeDKTzb (ORCPT ); Wed, 11 Apr 2018 15:55:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1523476532; x=1555012532; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=BFK+z3YdEC5IbxhRNWzBsFobNuwtOpn0AGPgwa2fGSo=; b=He09vVLd43WCIsT4+5x+M8Jjfa7Cf9y/ZGpu+1VLxP5MMn7AbcDlJ828 FcmjAz6UMIlbsm2FQ3eZwDeuSFx2CndI/CMx9pKr21CQquvmOeAl8/X4M A4adWLh/aDuaiBwF50OhXd7CwirVfVayCXrPPhezP+f4Bq8ed8gl1KRhp 8rozGMRi6wVfdm/AIKaDmAIr/3NUoyyDuieERHJ+xExokAzsndwUryW/c kCUeK48M6Cr8wfBOxf6AU4BkUZcgHrG6A6yWmRa1UjdX2XL/eA01SJfoH dCuoj6jS7MTIyxEWXNJ67nvb6bkcyCwRmQQAV/IJa1LLnmA3RBWI6plvY Q==; X-IronPort-AV: E=Sophos;i="5.48,437,1517846400"; d="scan'208";a="75780835" Received: from mail-sn1nam01lp0119.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.119]) by ob1.hgst.iphmx.com with ESMTP; 12 Apr 2018 03:55:30 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7E8hU78FGCd5RpVVo1LjwMwKSr5DhKFjT0v+PxTZZrs=; b=L6GkcgzqizZlyoFi6/tYh8WUEVsyFiv9meO/KEHqtjPgJW73rf9SYEPOpTG+aY2si8q8k0VyoHo/SQiyfCNiPOsgXaaIUC8ebl/GPoYJTLWOoT4nZkjqLm6lg/RX8IIMZlOogmxV4Awf2MHRCxI0nfHfBOAlcigoeQxmzzlyFUI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; Received: from [172.21.0.229] (50.225.201.71) by DM5PR04MB1196.namprd04.prod.outlook.com (2603:10b6:3:a3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Wed, 11 Apr 2018 19:55:28 +0000 Subject: Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release To: Alexandru Moise <00moses.alexander00@gmail.com> Cc: "tj@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "nborisov@suse.com" , "axboe@kernel.dk" , "shli@fb.com" , "gregkh@linuxfoundation.org" , "joseph.qi@linux.alibaba.com" , "arnd@arndb.de" References: <20180407102148.GA9729@gmail.com> <20180409220938.GI3126663@devbig577.frc2.facebook.com> <20180411101242.GA2322@gmail.com> <20180411142019.GG793541@devbig577.frc2.facebook.com> <20180411142859.GB2322@gmail.com> <5fafe1cbf6b0111448a81005c1c16feee24a99ad.camel@wdc.com> <20180411190027.GA21274@gmail.com> From: Bart Van Assche Message-ID: Date: Wed, 11 Apr 2018 13:55:25 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180411190027.GA21274@gmail.com> Content-Language: en-US X-Originating-IP: [50.225.201.71] X-ClientProxiedBy: CY4PR0101CA0018.prod.exchangelabs.com (2603:10b6:910:3c::31) To DM5PR04MB1196.namprd04.prod.outlook.com (2603:10b6:3:a3::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DM5PR04MB1196; X-Microsoft-Exchange-Diagnostics: 1; DM5PR04MB1196; 3:YV07HYWnZuGGbbq+fiAmfkotF53JXMHHgAJFqBqCrZGWcosOfUZXki/qRPdPNQeA6vDkmOl0TNx2a+PmKRmTWIScXb2uGOz2XqtHqSWV+q2lLd39UAUwvffE3PYsXxpOjmD/ATPg9Prs383XHDJlUOBCiu+Qh3J8yUCQ2LpArQbMzMD5jOPzqPb1DtOu3Xk0RAwBiMjbKdDo3niwlilQb4s2+yhoi3K3x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MPuF06P16PWSrZjPNs1q2qGaermnLHpJxnGIBdLvAuoGoKGq7MBXWedP6TBm0H1jT8cX4clfEDMgyEQbL114OctxcO+8xfdGN0+KyeaNB8Mp7OmcLpxVSnD1vUpNrRBkn3JSVciwk/XsE; 4:Zn8zQ+gROl0kiRC4Z1oqYi1bMyeeSqdvOAm+o4aBACZlpfGhS9s4WnucmJr2H0zud4b2JctPN2GEpRNNPGD2GEiPLuwn+Rys7DJ7ouLesQdoYoYeZ8UlLL0Mp4M3qwxVw4x4/b0Uc8puEB6MDJEnyv4clNA1TMG3Ldi4VUnE2QR/XLqAKduuub3EgrKsIhSwShd/xpN1z2JGY6qGrL1DrvXze70P8VZSyVz8qizwAB8eVU128dVcexzIz7rR//vWBrqEkHa4F7tRowGeyycIVw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR04MB1196; BCL:0; PCL:0; RULEID:; SRVR:DM5PR04MB1196; X-Forefront-PRVS: 0639027A9E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6049001)(396003)(346002)(376002)(366004)(39380400002)(39860400002)(199004)(189003)(23676004)(486006)(54906003)(5660300001)(6916009)(53546011)(39060400002)(52116002)(956004)(316002)(50466002)(26005)(476003)(16576012)(64126003)(7736002)(6246003)(65826007)(2616005)(11346002)(386003)(16526019)(2486003)(105586002)(6666003)(106356001)(58126008)(31686004)(76176011)(6486002)(36756003)(186003)(59450400001)(93886005)(86362001)(52146003)(8936002)(2906002)(68736007)(4326008)(6116002)(3846002)(81156014)(81166006)(478600001)(230700001)(77096007)(446003)(47776003)(67846002)(305945005)(25786009)(53936002)(229853002)(7416002)(72206003)(8676002)(65806001)(31696002)(97736004)(65956001)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR04MB1196; H:[172.21.0.229]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjA0TUIxMTk2OzIzOnhJY2puL2xnclVpTjRvUURKZEVaWWtXeDM5?= =?utf-8?B?b3M2SzF3Z2JBU2cwdkVOVnRmYVJqSzVTdnl2Y0xvYnpkWjBwa0Frdm0xMktj?= =?utf-8?B?dXFOc2JQOElTWGtiSUs0VHFjQVo3OHpnclJ0eUtUTW9yWHM0aUtVQVNNd1RJ?= =?utf-8?B?K3Blc3IrcDZuM3hZWmIzNjllZzhxK0Zqd1FZZDczcnF6b1BPeTIwWmZlcVdJ?= =?utf-8?B?ai8xNFV1ek1jRlo3SlRHNlZxYVJITUxDd1JlckZIMGJFYkJaOUhCL1h4VDlT?= =?utf-8?B?MWFmZDg0WDNPZkkrcCtmYmNMY1N0MGNLNnFJaklTaEtBWHJYQ291L0lYN2FN?= =?utf-8?B?bE1tRjNWL2luZ0cxYzFyRVloSW81L0pGNlYzcGdNVFNjS0hzYU1VZnlNaVoz?= =?utf-8?B?Sk1ua1FZUW92aEx1NWdrQ2tnb2NSamE5WU9pMU5BVlptSkYwMHNiNGU3Rzha?= =?utf-8?B?R2VvamxiRzRQRVV5UDA1ei95OWlnc3VwQkRtRnR3dC9FOTZ6TnhJNEYvZUxJ?= =?utf-8?B?YzFrZjZOY3cyZFdFU21pTitSTVUrOHpTRHVRZjBUMVNRSm8zNHdRc3VSYXY0?= =?utf-8?B?VUVsUlBGRDZKOGxsWk9iTUhzNG1LUVhIMWI1bXB6VzRKS1pGKzREeVRIbnk4?= =?utf-8?B?dkpTcmx3SGpmOE1TMUNTUGtxSk04RFc2WlNlRENYckNsbWs2L0xsWFBObnM2?= =?utf-8?B?b0JpSlB4Ry9UWGRuSm9URU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eU+d03TRI9eGHAkoJdOS7vM+vGKfN9e2vs0Sy2ePe+2gmXHLiWM+3TVwbtlfe2OOnW/Tm0XGn0UHb/tLaTPDj5r/yBnuewRpmeeVOL4hH+FOQr+AIXUWHLzQtZZl7Cth4SuSV0awDqw1zjDfQOrIiUUGott3Bim2Sq7cPpRhMmuq60cA3j9UgB9kRpJhfxwgsM8eVCei0tfemWwWw4JgdFGAihsLJ+MJV3lTKrMqGLcYw==; 5:liSSUEieELv4K1cX0ENDciUr22ztiUcOMb/rO0Cz8WtvCL4lWwoKoq/UXr89lv9EIiPxPpfIm7ewcSt0n6fuHRlCVuXgCMhjqROtb/GqAgtC69tV7oXmJV97Lm2CoXE69FV0jgI3THKKZCjumLmyJMNKqjsQIKWniJJU1Y9R7Ls=; 24:pQuRLKgjaJIuffHgggQb/sLDggyzs133PCQJ244K8UPAFTrVRI+pkDc2RkQuocaIF1LWFIixOPnRizdtk1eiL3mh8A4D8HYzZjsFhQKvotE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR04MB1196; 7:WEyp3Xen8jbaLrYLc81FkEok6ilMuvGuljoIPAqMDWrdslP97VsEfeLDolmN0TIMR8ZeRGFRQASElvQxj2SRXpiD1ceELE3Hntrs6MNJMhwU4ol3Z/jTXqkiMxfj3spBTUXvyTAqUqmCAtoomq4H61sYneOoL90JpqWBFY2CggmMXa4nPHkAg9rx2pPx/6mB/FxadLz8mGwqvhq20vpjeldeQBuv+NJsjVFHArRi2DiJIaavg1DeWW9MYmgPYx3e; 20:rdYGef+4AvAJ6lnbHOkFUBhfAp5vd0eBz5vFINd3RyXdKobyL0lmPXJXJMg/Vl6OF0mn/Xm11Ahy+wKs6NdzjypSJlNV9PBm/bstf2L0Cdmde8Vy6rhVPyxA83hdh9BqsOs8D2/cPyruRZeV6luTKyWuECCBbZxgZdjFQjXLjJU= X-MS-Office365-Filtering-Correlation-Id: 2263faca-8889-4c8e-6701-08d59fe62ce1 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2018 19:55:28.3932 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2263faca-8889-4c8e-6701-08d59fe62ce1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR04MB1196 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 04/11/18 13:00, Alexandru Moise wrote: > But the root cause of it is in blkcg_init_queue() when blkg_create() returns > an ERR ptr, because it tries to insert into a populated index into blkcg->blkg_tree, > the entry that we fail to remove at __blk_release_queue(). Hello Alex, Had you considered something like the untested patch below? Thanks, Bart. diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 1c16694ae145..f2ced19e74b8 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1191,14 +1191,17 @@ int blkcg_init_queue(struct request_queue *q) if (preloaded) radix_tree_preload_end(); - if (IS_ERR(blkg)) - return PTR_ERR(blkg); + if (IS_ERR(blkg)) { + ret = PTR_ERR(blkg); + goto destroy_all; + } q->root_blkg = blkg; q->root_rl.blkg = blkg; ret = blk_throtl_init(q); if (ret) { +destroy_all: spin_lock_irq(q->queue_lock); blkg_destroy_all(q); spin_unlock_irq(q->queue_lock);