Received: by 10.192.165.156 with SMTP id m28csp1204248imm; Wed, 11 Apr 2018 14:31:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/89clBGaxj9dTVLwPmJXs7WQoGVMVAIFJExScEJepl0avoVC6HX4REkmYJhzS8OEHnbu+T X-Received: by 2002:a17:902:8a82:: with SMTP id p2-v6mr6167443plo.91.1523482283084; Wed, 11 Apr 2018 14:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523482283; cv=none; d=google.com; s=arc-20160816; b=exHSY9Fr7/JyRH0NGKVF07rHphY9l/HVZVhXKiVz3fDFyf0y7ICKyWIu5FJTedBYvJ vYC2Hisn3k3JAJu5YMLImbqpm+McTYV1rUtnUh5kjt08lAOX0HbGCBwAFsOfFQxvUXiv Q7QP/7vgVAzopkkozt8XhThArd5Z4E9tmG8gdVcNQgS7OXCWjec61/g0Uvl2xC43V80K Dza5Qu8WEjD2J0w9tiYO3zORGge/HBLGh5iu26hcypYiATMYH6CwvE4b+Iln7b08l1e8 RFebAtSQyICxizisiO/GVacx6d1YqP4j8ljZK9EyHCfLdQvQqmnt9k4GSKgyBFRdc7Nb mr2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=JOQDX8WRv7v14SdosB/VhCb2duqMtTX3MX+PzKu77cE=; b=xVJCLZdOKcHTGZOMhubAMCb9B/yfWExWnrGNcq9N+yIMo1I7AKL5XGH+icd9pW4dZq 8EXMmo+K9J6+VkNqqRNii+y+EWx3THxGNS8KMz8uz9F1X9NasCsjSlmLxq9egvAoHl4+ rMIQPywarpvbqE9KVABslkSjioEHeXNwImGp/nnMfSAklavNSu1Mbda+Qkn/t1G5Fy48 lvg11HoCElW0M94VqzSU3eV0jKtxCjWmmxhSGcFQ+BB67EcPC+dDbhq5GV9wB3svJGS/ ujmLg6stBFB/3hs7nDpwKhr8BRIzBHkdz+wr1k57YxZm9xSz2JC6QxuHEOFJ9hJV1d7t 6C5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r3At8w4S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1-v6si1874789plr.410.2018.04.11.14.30.46; Wed, 11 Apr 2018 14:31:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r3At8w4S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754693AbeDKVXc (ORCPT + 99 others); Wed, 11 Apr 2018 17:23:32 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35233 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754495AbeDKVX3 (ORCPT ); Wed, 11 Apr 2018 17:23:29 -0400 Received: by mail-wm0-f67.google.com with SMTP id r82so6254169wme.0; Wed, 11 Apr 2018 14:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JOQDX8WRv7v14SdosB/VhCb2duqMtTX3MX+PzKu77cE=; b=r3At8w4SmksUypmFyERL5uONNhML2ypMXNiSqap2TujHCTZPWEO5GSJctlnAn2dE62 jy4zerwoLSCDL7mgEk1tm9h63QjztZya/SseoMZRp2LVL+P/vT0NyqbRQHq+WQowspFb beLWdt0C9aqESImv9/e0H+AehW8vcS91WjVj/zahsfOmVqvRtipsDJOt6xJlKBJCtxVZ V2nz/tUyJjwQOsHKnFgURVtBSh3ufS6A6b0OSm8GVyu4jF17D3jzYDZHYRc1OiJAq6DD tpTeVnYqhXitWVxmbwDc+YiVBVxr0QnESgfJpzIIEOwZI0V3U0acoc5f9kdHyM2Z0Ecn LrdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JOQDX8WRv7v14SdosB/VhCb2duqMtTX3MX+PzKu77cE=; b=cgKiIaQH3C+Oi+s2jenZtdqHGRQKIxhZJTwbxXOmtMhBfT5xxtR8HtrWLd88a6kvef v8z3HS1JGYNowWOIz3SZvbN4e6YGKN/a1reGAtC/ukKcALqf7c7YotilFEEo3PXBvt9x q48660l8ez9Muu9xYBc5KdGOcWptgUsI+Y896A1f4Rt1AFeZryuO7GZ1r8oRDLh/QXE/ BOXLxcXdAKDvw0itAF/Qupqbvricr2uuxtMXOGTA+G8NvmSjcVZLiwlJ0XZ1AbCYnpXr tDT2PkGLEU22NjzbdvioGtUIhpxsIqMPPfsn7eW7JlZ5dc/dxpZmL5YzBnS5x78x6mRP ar2g== X-Gm-Message-State: ALQs6tB/KvabCLEw832bjWbtMS0mpI6+p4vsPxx2E+PhLHXyzzQgOi5P cibclYAVScVcO3rHHUW5Sv0= X-Received: by 10.28.72.7 with SMTP id v7mr3478326wma.155.1523481808195; Wed, 11 Apr 2018 14:23:28 -0700 (PDT) Received: from gmail.com (51B6C0F5.dsl.pool.telekom.hu. [81.182.192.245]) by smtp.gmail.com with ESMTPSA id w69sm2153559wrb.94.2018.04.11.14.23.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Apr 2018 14:23:27 -0700 (PDT) Date: Wed, 11 Apr 2018 23:23:20 +0200 From: Alexandru Moise <00moses.alexander00@gmail.com> To: Bart Van Assche 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" Subject: Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release Message-ID: <20180411212320.GA26747@gmail.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 11, 2018 at 01:55:25PM -0600, Bart Van Assche wrote: > 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); > Hi, I tested it, it doesn't solve the problem. By the time you get here it's already too late, my patch prevents this from failing in the first place. I would have liked this more than my solution though. ../Alex