blk-cgroup: don't update io stat for root cgroup
authorMing Lei <ming.lei@redhat.com>
Thu, 2 Feb 2023 02:18:04 +0000 (10:18 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 2 Feb 2023 02:26:41 +0000 (19:26 -0700)
commit0416f3be58c6b1ea066cd52e354b857693feb01e
tree4c92b2739ef71e6f525743a9bb5f5e1c2dda61e8
parent81ea42b9c3d61ea34d82d900ed93f4b4851f13b0
blk-cgroup: don't update io stat for root cgroup

We source root cgroup stats from the system-wide stats, see blkcg_print_stat
and blkcg_rstat_flush, so don't update io state for root cgroup.

Fixes blkg leak issue introduced in commit 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
which starts to grab blkg's reference when adding iostat_cpu into percpu
blkcg list, but this state won't be consumed by blkcg_rstat_flush() where
the blkg reference is dropped.

Tested-by: Bart van Assche <bvanassche@acm.org>
Reported-by: Bart van Assche <bvanassche@acm.org>
Fixes: 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
Cc: Tejun Heo <tj@kernel.org>
Cc: Waiman Long <longman@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230202021804.278582-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c