Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Alexandru Moise
On Wed, Apr 11, 2018 at 09:28:30PM +, Bart Van Assche wrote: > On Wed, 2018-04-11 at 23:23 +0200, Alexandru Moise wrote: > > 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. > > Hello

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Bart Van Assche
On Wed, 2018-04-11 at 23:23 +0200, Alexandru Moise wrote: > 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. Hello Alex, If you can share the steps to follow to trigger the bug you reported t

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Alexandru Moise
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 t

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Bart Van Assche
On Wed, 2018-04-11 at 13:02 -0700, t...@kernel.org wrote: > On Wed, Apr 11, 2018 at 08:00:29PM +, Bart Van Assche wrote: > > On Wed, 2018-04-11 at 12:57 -0700, t...@kernel.org wrote: > > > On Wed, Apr 11, 2018 at 01:55:25PM -0600, Bart Van Assche wrote: > > > > On 04/11/18 13:00, Alexandru Mois

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread t...@kernel.org
On Wed, Apr 11, 2018 at 08:00:29PM +, Bart Van Assche wrote: > On Wed, 2018-04-11 at 12:57 -0700, t...@kernel.org wrote: > > 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()

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Bart Van Assche
On Wed, 2018-04-11 at 12:57 -0700, t...@kernel.org wrote: > 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

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread t...@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

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Bart Van Assche
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

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Alexandru Moise
On Wed, Apr 11, 2018 at 03:54:53PM +, Bart Van Assche wrote: > On Wed, 2018-04-11 at 16:28 +0200, Alexandru Moise wrote: > > [0.76] BUG: unable to handle kernel NULL pointer dereference at > > 01b4 > > [0.763350] Kernel panic - not syncing: Attempted to kill init! > >

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread t...@kernel.org
Hello, On Wed, Apr 11, 2018 at 05:26:12PM +, Bart Van Assche wrote: > Please explain what you wrote further. It's not clear to me why you think > that anything is broken nor what a "sever model" is. So, sever (or revoke) model is where you actively disconnect an object and ensuring that there

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Bart Van Assche
On Wed, 2018-04-11 at 10:15 -0700, t...@kernel.org wrote: > On Wed, Apr 11, 2018 at 05:06:41PM +, Bart Van Assche wrote: > > A simple and effective solution is to dissociate a request queue from the > > block cgroup controller before blk_cleanup_queue() returns. This is why > > commit > > a063

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread t...@kernel.org
Hello, On Wed, Apr 11, 2018 at 05:06:41PM +, Bart Van Assche wrote: > A simple and effective solution is to dissociate a request queue from the > block cgroup controller before blk_cleanup_queue() returns. This is why commit > a063057d7c73 ("block: Fix a race between request queue removal and

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Bart Van Assche
On Wed, 2018-04-11 at 10:00 -0700, t...@kernel.org wrote: > On Wed, Apr 11, 2018 at 04:42:55PM +, Bart Van Assche wrote: > > 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

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread t...@kernel.org
Hello, On Wed, Apr 11, 2018 at 04:42:55PM +, Bart Van Assche wrote: > 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 loc

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Bart Van Assche
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

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Bart Van Assche
On Wed, 2018-04-11 at 16:28 +0200, Alexandru Moise wrote: > [0.76] BUG: unable to handle kernel NULL pointer dereference at > 01b4 > [0.763350] Kernel panic - not syncing: Attempted to kill init! > exitcode=0x0009 > [0.763350] > [0.76] PGD 0 P4D 0 > [0.

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Tejun Heo
Hello, again. On Wed, Apr 11, 2018 at 07:51:23AM -0700, Tejun Heo wrote: > Oh, it wasn't Joseph's change. It was Bart's fix for a problem > reported by Joseph. Bart, a063057d7c73 ("block: Fix a race between > request queue removal and the block cgroup controller") created a > regression where a

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Tejun Heo
Hello, (cc'ing Bart) On Wed, Apr 11, 2018 at 07:46:16AM -0700, Tejun Heo wrote: > Hello, > > On Wed, Apr 11, 2018 at 04:28:59PM +0200, Alexandru Moise wrote: > > > Ah, that changed recently. Can you please check out the current > > > upstream git master? > > > > > Just did, without my patch I

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Tejun Heo
Hello, On Wed, Apr 11, 2018 at 04:28:59PM +0200, Alexandru Moise wrote: > > Ah, that changed recently. Can you please check out the current > > upstream git master? > > > Just did, without my patch I see this crash: lol I was looking at the old tree, so this is the fix for the new breakage intr

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Alexandru Moise
On Wed, Apr 11, 2018 at 07:20:19AM -0700, Tejun Heo wrote: > Hello, > > On Wed, Apr 11, 2018 at 12:12:56PM +0200, Alexandru Moise wrote: > > > But we already do this through calling blkcg_exit_queue() from > > > __blk_release_queue(). What's missing? > > > > Hi, > > > > It might be the jetlag b

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Tejun Heo
Hello, On Wed, Apr 11, 2018 at 12:12:56PM +0200, Alexandru Moise wrote: > > But we already do this through calling blkcg_exit_queue() from > > __blk_release_queue(). What's missing? > > Hi, > > It might be the jetlag but I can't see how you end up calling > blkcg_exit_queue() from __blk_release

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-11 Thread Alexandru Moise
On Mon, Apr 09, 2018 at 03:09:38PM -0700, Tejun Heo wrote: > (cc'ing Joseph as he worked on the area recently, hi!) > > Hello, > > On Sat, Apr 07, 2018 at 12:21:48PM +0200, Alexandru Moise wrote: > > The q->id is used as an index within the blkg_tree radix tree. > > > > If the entry is not relea

Re: [PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-09 Thread Tejun Heo
(cc'ing Joseph as he worked on the area recently, hi!) Hello, On Sat, Apr 07, 2018 at 12:21:48PM +0200, Alexandru Moise wrote: > The q->id is used as an index within the blkg_tree radix tree. > > If the entry is not released before reclaiming the blk_queue_ida's id > blkcg_init_queue() within a

[PATCH v2] blk-cgroup: remove entries in blkg_tree before queue release

2018-04-07 Thread Alexandru Moise
The q->id is used as an index within the blkg_tree radix tree. If the entry is not released before reclaiming the blk_queue_ida's id blkcg_init_queue() within a different driver from which this id was originally for can fail due to the entry at that index within the radix tree already existing. S