]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
blkcg: update blkcg_print_stat() to handle larger outputs
authorTejun Heo <tj@kernel.org>
Thu, 13 Jun 2019 22:30:38 +0000 (15:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:13:07 +0000 (09:13 +0200)
commit2bee53a06de245207d5ec9d20a9f09face83841d
treea8a3f1b11c99888001fbc786501daafd202903e2
parentbea58a0e6844f244d8d1789f08dab3678483f24c
blkcg: update blkcg_print_stat() to handle larger outputs

commit f539da82f2158916e154d206054e0efd5df7ab61 upstream.

Depending on the number of devices, blkcg stats can go over the
default seqfile buf size.  seqfile normally retries with a larger
buffer but since the ->pd_stat() addition, blkcg_print_stat() doesn't
tell seqfile that overflow has happened and the output gets printed
truncated.  Fix it by calling seq_commit() w/ -1 on possible
overflows.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 903d23f0a354 ("blk-cgroup: allow controllers to output their own stats")
Cc: stable@vger.kernel.org # v4.19+
Cc: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-cgroup.c