summary refs log tree commit diff stats
path: root/hw/core
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2018-06-08 18:15:36 +0300
committerMax Reitz <mreitz@redhat.com>2018-06-11 16:18:45 +0200
commitbc33c047d1ec0b35c9cd8be62bcefae2da28654f (patch)
tree6f0c6ed98ef12c13c66d80bb9d7374925a2540c2 /hw/core
parent7eb24009dbf8102fc27d5459bec1cb8a932540c4 (diff)
downloadfocaccia-qemu-bc33c047d1ec0b35c9cd8be62bcefae2da28654f.tar.gz
focaccia-qemu-bc33c047d1ec0b35c9cd8be62bcefae2da28654f.zip
throttle: Fix crash on reopen
The throttle block filter can be reopened, and with this it is
possible to change the throttle group that the filter belongs to.

The way the code does that is the following:

  - On throttle_reopen_prepare(): create a new ThrottleGroupMember
    and attach it to the new throttle group.

  - On throttle_reopen_commit(): detach the old ThrottleGroupMember,
    delete it and replace it with the new one.

The problem with this is that by replacing the ThrottleGroupMember the
previous value of io_limits_disabled is lost, causing an assertion
failure in throttle_co_drain_end().

This problem can be reproduced by reopening a throttle node:

   $QEMU -monitor stdio
   -object throttle-group,id=tg0,x-iops-total=1000 \
   -blockdev node-name=hd0,driver=qcow2,file.driver=file,file.filename=hd.qcow2 \
   -blockdev node-name=root,driver=throttle,throttle-group=tg0,file=hd0,read-only=on

   (qemu) block_stream root
   block/throttle.c:214: throttle_co_drain_end: Assertion `tgm->io_limits_disabled' failed.

Since we only want to change the throttle group on reopen there's no
need to create a ThrottleGroupMember and discard the old one. It's
easier if we simply detach it from its current group and attach it to
the new one.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 20180608151536.7378-1-berto@igalia.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'hw/core')
0 files changed, 0 insertions, 0 deletions