All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.9] throttle: Remove block from group on hot-unplug
@ 2017-04-06 19:08 Eric Blake
  2017-04-07 14:19 ` Max Reitz
  2017-04-07 14:52 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Blake @ 2017-04-06 19:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, berto, Kevin Wolf, Max Reitz

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>
---
 block/block-backend.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/block-backend.c b/block/block-backend.c
index 0b63773..d27c3a3 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -230,6 +230,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);
     }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.9] throttle: Remove block from group on hot-unplug
  2017-04-06 19:08 [Qemu-devel] [PATCH for-2.9] throttle: Remove block from group on hot-unplug Eric Blake
@ 2017-04-07 14:19 ` Max Reitz
  2017-04-07 14:52 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Max Reitz @ 2017-04-07 14:19 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-block, berto, Kevin Wolf

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

On 06.04.2017 21:08, Eric Blake wrote:
> 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>
> ---
>  block/block-backend.c | 3 +++
>  1 file changed, 3 insertions(+)

Thanks, applied to my block branch:

https://github.com/XanClic/qemu/commits/block

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH for-2.9] throttle: Remove block from group on hot-unplug
  2017-04-06 19:08 [Qemu-devel] [PATCH for-2.9] throttle: Remove block from group on hot-unplug Eric Blake
  2017-04-07 14:19 ` Max Reitz
@ 2017-04-07 14:52 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2017-04-07 14:52 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, Kevin Wolf, qemu-block, Max Reitz

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

On Thu, Apr 06, 2017 at 02:08:47PM -0500, Eric Blake wrote:
> 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>
> ---
>  block/block-backend.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-07 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06 19:08 [Qemu-devel] [PATCH for-2.9] throttle: Remove block from group on hot-unplug Eric Blake
2017-04-07 14:19 ` Max Reitz
2017-04-07 14:52 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.