]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
block: don't merge across cgroup boundaries if blkcg is enabled
authorTejun Heo <tj@kernel.org>
Tue, 15 Mar 2022 00:30:11 +0000 (14:30 -1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 11:57:26 +0000 (13:57 +0200)
commitf1959f39df7fb02db8e9662f0db34f5d1472d9ba
tree5ec57f781b9ded3d31a550410debf8e18d0ef543
parent072fee9f96324e7d4cf0bba1e2793f2dc8642900
block: don't merge across cgroup boundaries if blkcg is enabled

commit 6b2b04590b51aa4cf395fcd185ce439cab5961dc upstream.

blk-iocost and iolatency are cgroup aware rq-qos policies but they didn't
disable merges across different cgroups. This obviously can lead to
accounting and control errors but more importantly to priority inversions -
e.g. an IO which belongs to a higher priority cgroup or IO class may end up
getting throttled incorrectly because it gets merged to an IO issued from a
low priority cgroup.

Fix it by adding blk_cgroup_mergeable() which is called from merge paths and
rejects cross-cgroup and cross-issue_as_root merges.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: d70675121546 ("block: introduce blk-iolatency io controller")
Cc: stable@vger.kernel.org # v4.19+
Cc: Josef Bacik <jbacik@fb.com>
Link: https://lore.kernel.org/r/Yi/eE/6zFNyWJ+qd@slm.duckdns.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-merge.c
include/linux/blk-cgroup.h