block: fix bio_clone_blkg_association() to associate with proper blkcg_gq
Jan Kara authored
commit 22b106e5 upstream.

Commit d92c370a

 ("block: really clone the block cgroup in
bio_clone_blkg_association") changed bio_clone_blkg_association() to
just clone bio->bi_blkg reference from source to destination bio. This
is however wrong if the source and destination bios are against
different block devices because struct blkcg_gq is different for each
bdev-blkcg pair. This will result in IOs being accounted (and throttled
as a result) multiple times against the same device (src bdev) while
throttling of the other device (dst bdev) is ignored. In case of BFQ the
inconsistency can even result in crashes in bfq_bic_update_cgroup().
Fix the problem by looking up correct blkcg_gq for the cloned bio.
Reported-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Reported-and-tested-by: default avatarDonald Buczek <buczek@molgen.mpg.de>
Fixes: d92c370a ("block: really clone the block cgroup in bio_clone_blkg_association...
6b03dc67
Name Last commit Last update
..
partitions partitions: msdos: fix one-byte get_unaligned()
Kconfig blk-wbt: Remove obsolete multiqueue I/O scheduling comment
Kconfig.iosched treewide: replace '---help---' in Kconfig files with 'help'
Makefile blk-mq: merge blk-softirq.c into blk-mq.c
badblocks.c treewide: Use fallthrough pseudo-keyword
bfq-cgroup.c bfq: Make sure bfqg for which we are queueing requests is online
bfq-iosched.c bfq: Get rid of __bio_blkcg() usage
bfq-iosched.h bfq: Get rid of __bio_blkcg() usage
bfq-wf2q.c bfq: fix blkio cgroup leakage v4
bio-integrity.c block: bio-integrity: Advance seed correctly for larger interval sizes
bio.c block: Fix wrong offset in bio_truncate()
blk-cgroup-rwstat.c blk-cgroup: Fix the recursive blkg rwstat
blk-cgroup-rwstat.h blk-cgroup: separate out blkg_rwstat under CONFIG_BLK_CGROUP_RWSTAT
blk-cgroup.c block: fix bio_clone_blkg_association() to associate with proper blkcg_gq
blk-core.c blkcg: Remove extra blkcg_bio_issue_init
blk-crypto-fallback.c block: rename generic_make_request to submit_bio_noacct
blk-crypto-internal.h block: make blk_crypto_rq_bio_prep() able to fail
blk-crypto.c blk-crypto: fix check for too-large dun_bytes
blk-exec.c block: add a blk_account_io_merge_bio helper
blk-flush.c block: Fix fsync always failed if once failed
blk-integrity.c block: flush the integrity workqueue in blk_integrity_unregister
blk-ioc.c block: remove retry loop in ioc_release_fn()
blk-iocost.c iocost: don't reset the inuse weight of under-weighted debtors
blk-iolatency.c blk-iolatency: Fix inflight count imbalances and IO hangs on offline
blk-lib.c block: add a bdev_is_partition helper
blk-map.c
blk-merge.c
blk-mq-cpumap.c
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c
blk-mq-debugfs.h
blk-mq-pci.c
blk-mq-rdma.c
blk-mq-sched.c
blk-mq-sched.h
blk-mq-sysfs.c
blk-mq-tag.c
blk-mq-tag.h
blk-mq-virtio.c
blk-mq.c
blk-mq.h
blk-pm.c
blk-pm.h
blk-rq-qos.c
blk-rq-qos.h
blk-settings.c
blk-stat.c
blk-stat.h
blk-sysfs.c
blk-throttle.c
blk-timeout.c
blk-wbt.c
blk-wbt.h
blk-zoned.c
blk.h
bounce.c
bsg-lib.c
bsg.c
cmdline-parser.c
elevator.c
genhd.c
ioctl.c
ioprio.c
keyslot-manager.c
kyber-iosched.c
mq-deadline.c
opal_proto.h
scsi_ioctl.c
sed-opal.c
t10-pi.c