aboutsummaryrefslogtreecommitdiff
path: root/block/block-backend.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2017-04-06 14:08:47 -0500
committerMax Reitz <mreitz@redhat.com>2017-04-11 15:33:00 +0200
commit1606e4cf8a976513ecac70ad6642a7ec45744cf5 (patch)
treeb8703792758bb5ea05d7c153a568934e942945b2 /block/block-backend.c
parent7a9e51198c24a576275cf509a110d24d7c6ca664 (diff)
downloadqemu-1606e4cf8a976513ecac70ad6642a7ec45744cf5.zip
qemu-1606e4cf8a976513ecac70ad6642a7ec45744cf5.tar.gz
qemu-1606e4cf8a976513ecac70ad6642a7ec45744cf5.tar.bz2
throttle: Remove block from group on hot-unplug
When a block device that is part of a throttle group is hot-unplugged, we forgot to remove it from the throttle group. This leaves stale memory around, and causes an easily reproducible crash: $ ./x86_64-softmmu/qemu-system-x86_64 -nodefaults -nographic -qmp stdio \ -device virtio-scsi-pci,bus=pci.0 -drive \ id=drive_image2,if=none,format=raw,file=file2,bps=512000,iops=100,group=foo \ -device scsi-hd,id=image2,drive=drive_image2 -drive \ id=drive_image3,if=none,format=raw,file=file3,bps=512000,iops=100,group=foo \ -device scsi-hd,id=image3,drive=drive_image3 {'execute':'qmp_capabilities'} {'execute':'device_del','arguments':{'id':'image3'}} {'execute':'system_reset'} Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1428810 Suggested-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Eric Blake <eblake@redhat.com> Message-id: 20170406190847.29347-1-eblake@redhat.com Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r--block/block-backend.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index a8f2b34..7405024 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -231,6 +231,9 @@ static void blk_delete(BlockBackend *blk)
assert(!blk->refcnt);
assert(!blk->name);
assert(!blk->dev);
+ if (blk->public.throttle_state) {
+ blk_io_limits_disable(blk);
+ }
if (blk->root) {
blk_remove_bs(blk);
}