Re: [PATCH v2] blk-throttle: fix race between blkcg_bio_issue_check and cgroup_rmdir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, Joseph.

On Sat, Feb 24, 2018 at 09:45:49AM +0800, Joseph Qi wrote:
> > IIRC, as long as the blkcg and the device are there, the blkgs aren't
> > gonna be destroyed.  So, if you have a ref to the blkcg through
> > tryget, the blkg shouldn't go away.
> > 
> 
> Maybe we have misunderstanding here.
> 
> In this case, blkg doesn't go away as we have rcu protect, but
> blkg_destroy() can be called, in which blkg_put() will put the last
> refcnt and then schedule __blkg_release_rcu().
> 
> css refcnt can't prevent blkcg css from offlining, instead it is css
> online_cnt.
> 
> css_tryget() will only get a refcnt of blkcg css, but can't be
> guaranteed to fail when css is confirmed to kill.

Ah, you're right.  I was thinking we only destroy blkgs from blkcg
release path.  Given that we primarily use blkcg refcnting to pin
them, I believe that's what we should do - ie. only call
pd_offline_fn() from blkcg_css_offline() path and do the rest of
destruction from blkcg_css_free().  What do you think?

Thanks.

-- 
tejun



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux