diff options
author | Tejun Heo <tj@kernel.org> | 2019-11-05 19:09:51 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-11-07 03:08:38 +0300 |
commit | b0814361a25cba73a224548843ed92d8ea78715a (patch) | |
tree | 9c9c269d564efa33f2d3a6eebfd6f5a51db2e970 /block/elevator.c | |
parent | 0473976c3568cbe7ef4b4af5c134960cb7bb2779 (diff) | |
download | linux-b0814361a25cba73a224548843ed92d8ea78715a.tar.xz |
blkcg: make blkcg_print_stat() print stats only for online blkgs
blkcg_print_stat() iterates blkgs under RCU and doesn't test whether
the blkg is online. This can call into pd_stat_fn() on a pd which is
still being initialized leading to an oops.
The heaviest operation - recursively summing up rwstat counters - is
already done while holding the queue_lock. Expand queue_lock to cover
the other operations and skip the blkg if it isn't online yet. The
online state is protected by both blkcg and queue locks, so this
guarantees that only online blkgs are processed.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Roman Gushchin <guro@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Fixes: 903d23f0a354 ("blk-cgroup: allow controllers to output their own stats")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/elevator.c')
0 files changed, 0 insertions, 0 deletions