diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 8d1b7757f1e4..7c91d9195da8 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -93,8 +93,6 @@ static void blkg_free_workfn(struct work_struct *work) if (blkg->pd[i]) blkcg_policy[i]->pd_free_fn(blkg->pd[i]); - if (blkg->parent) - blkg_put(blkg->parent); if (blkg->q) blk_put_queue(blkg->q); free_percpu(blkg->iostat_cpu); @@ -129,6 +127,8 @@ static void __blkg_release(struct rcu_head *rcu) /* release the blkcg and parent blkg refs this blkg has been holding */ css_put(&blkg->blkcg->css); + if (blkg->parent) + blkg_put(blkg->parent); blkg_free(blkg); }