[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180411212320.GA26747@gmail.com>
Date: Wed, 11 Apr 2018 23:23:20 +0200
From: Alexandru Moise <00moses.alexander00@...il.com>
To: Bart Van Assche <bart.vanassche@....com>
Cc: "tj@...nel.org" <tj@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"nborisov@...e.com" <nborisov@...e.com>,
"axboe@...nel.dk" <axboe@...nel.dk>, "shli@...com" <shli@...com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"joseph.qi@...ux.alibaba.com" <joseph.qi@...ux.alibaba.com>,
"arnd@...db.de" <arnd@...db.de>
Subject: Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue
release
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
Powered by blists - more mailing lists