diff options
author | Tejun Heo <tj@kernel.org> | 2019-07-24 20:37:55 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-04-01 23:56:44 +0300 |
commit | 4308a434e5e08c78676aa66bc626ef78cbef0883 (patch) | |
tree | a6617ca3addbb90cc2be00a78a8d22e3da725d48 /include/linux/blk-cgroup.h | |
parent | d866dbf6178713e37d2fec2870af00b345684e1a (diff) | |
download | linux-4308a434e5e08c78676aa66bc626ef78cbef0883.tar.xz |
blkcg: don't offline parent blkcg first
blkcg->cgwb_refcnt is used to delay blkcg offlining so that blkgs
don't get offlined while there are active cgwbs on them. However, it
ends up making offlining unordered sometimes causing parents to be
offlined before children.
Let's fix this by making child blkcgs pin the parents' online states.
Note that pin/unpin names are chosen over get/put intentionally
because css uses get/put online for something different.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blk-cgroup.h')
-rw-r--r-- | include/linux/blk-cgroup.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 7fb7caa55a3d..35f8ffe92b70 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -436,8 +436,12 @@ static inline void blkcg_pin_online(struct blkcg *blkcg) */ static inline void blkcg_unpin_online(struct blkcg *blkcg) { - if (refcount_dec_and_test(&blkcg->online_pin)) + do { + if (!refcount_dec_and_test(&blkcg->online_pin)) + break; blkcg_destroy_blkgs(blkcg); + blkcg = blkcg_parent(blkcg); + } while (blkcg); } /** |