[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bd60302129cb89bdc3b4f402ce4e061f41851729.camel@wdc.com>
Date: Wed, 11 Apr 2018 16:42:55 +0000
From: Bart Van Assche <Bart.VanAssche@....com>
To: "tj@...nel.org" <tj@...nel.org>,
"00moses.alexander00@...il.com" <00moses.alexander00@...il.com>,
"joseph.qi@...ux.alibaba.com" <joseph.qi@...ux.alibaba.com>
CC: "nborisov@...e.com" <nborisov@...e.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"arnd@...db.de" <arnd@...db.de>,
"axboe@...nel.dk" <axboe@...nel.dk>, "shli@...com" <shli@...com>
Subject: Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue
release
On Wed, 2018-04-11 at 07:56 -0700, Tejun Heo wrote:
> And looking at the change, it looks like the right thing we should
> have done is caching @lock on the print_blkg side and when switching
> locks make sure both locks are held. IOW, do the following in
> blk_cleanup_queue()
>
> spin_lock_irq(lock);
> if (q->queue_lock != &q->__queue_lock) {
> spin_lock(&q->__queue_lock);
> q->queue_lock = &q->__queue_lock;
> spin_unlock(&q->__queue_lock);
> }
> spin_unlock_irq(lock);
>
> Otherwise, there can be two lock holders thinking they have exclusive
> access to the request_queue.
I think that's a bad idea. A block driver is allowed to destroy the
spinlock it associated with the request queue as soon as blk_cleanup_queue()
has finished. If the block cgroup controller would cache a pointer to the
block driver spinlock then that could cause the cgroup code to attempt to
lock a spinlock after it has been destroyed. I don't think we need that kind
of race conditions.
Bart.
Powered by blists - more mailing lists