From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [PATCH v2] blk-throttle: fix race between blkcg_bio_issue_check and cgroup_rmdir To: Tejun Heo Cc: xuejiufei , Jens Axboe , Caspar Zhang , linux-block , cgroups@vger.kernel.org References: <20180208152307.GL695913@devbig577.frc2.facebook.com> <20180212171143.GY695913@devbig577.frc2.facebook.com> <19009bad-8429-c210-dd91-2b20771a66bd@linux.alibaba.com> <20180222151721.GA1641506@devbig577.frc2.facebook.com> <20180223142344.GC1641506@devbig577.frc2.facebook.com> <20180227183355.GG24003@devbig577.frc2.facebook.com> <20180304202317.GC231488@devbig577.frc2.facebook.com> From: Joseph Qi Message-ID: <4f282c16-d8ce-783e-b274-0dbf28cf340a@linux.alibaba.com> Date: Mon, 5 Mar 2018 09:17:27 +0800 MIME-Version: 1.0 In-Reply-To: <20180304202317.GC231488@devbig577.frc2.facebook.com> Content-Type: text/plain; charset=utf-8 List-ID: On 18/3/5 04:23, Tejun Heo wrote: > Hello, Joseph. > > Sorry about late reply. > > On Wed, Feb 28, 2018 at 02:52:10PM +0800, Joseph Qi wrote: >> In current code, I'm afraid pd_offline_fn() as well as the rest >> destruction have to be called together under the same blkcg->lock and >> q->queue_lock. >> For example, if we split the pd_offline_fn() and radix_tree_delete() >> into 2 phases, it may introduce a race between blkcg_deactivate_policy() >> when exit queue and blkcg_css_free(), which will result in >> pd_offline_fn() to be called twice. > > So, yeah, the sync scheme aroung blkg is pretty brittle and we'd need > some restructuring to separate out blkg offlining and release, but it > looks like that'd be the right thing to do, no? > Agree, except the restriction above, as of now I don't find any more. I'll try to fix in the way you suggested and post v3. Thanks, Joseph