blockdev: use drained_begin/end for qmp_block_resize
PATCH 1/1 blockdev: use drained_begin/end for qmp_block_resize
If one tries to issue a block_resize while a guest is busy accessing the disk, it is possible that qemu may deadlock when invoking aio_poll from both the main loop and the iothread.
Replace another instance of bdrv_drain_all that doesn't quite belong.
--- blockdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
blockdev.c +2 -3
@@ -2923,10 +2923,9 @@ void qmp_block_resize(bool has_device, const char *device, goto out; } -/* complete all in-flight operations before resizing the device */ -bdrv_drain_all (); - +bdrv_drained_begin (bs); ret =blk_truncate (blk, size, errp); +bdrv_drained_end (bs); out:blk_unref (blk);
Signature · 1 line
2.9.3
Quoted 6 lines · John Snow
If one tries to issue a
block_resizewhile a guest is busy accessing the disk, it is possible that qemu may deadlock when invokingaio_pollfrom both the main loop and the iothread.
Quoted 9 lines
Replace another instance of
bdrv_drain_allthat doesn't quite belong.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by John Snow <[email protected]>--- blockdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Quoted 18 lines
blockdev.c +2
-3@@ -2923,10 +2923,9 @@ void qmp_block_resize(bool has_device, const char *device, goto out; } -/* complete all in-flight operations before resizing the device */ -bdrv_drain_all (); - +bdrv_drained_begin (bs); ret =blk_truncate (blk, size, errp); +bdrv_drained_end (bs); out:blk_unref (blk);
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 23 lines · John Snow
If one tries to issue a
block_resizewhile a guest is busy accessing the disk, it is possible that qemu may deadlock when invokingaio_pollfrom both the main loop and the iothread.Replace another instance of
bdrv_drain_allthat doesn't quite belong.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by John Snow <[email protected]>--- blockdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)blockdev.c +0
-0@@ -2923,10 +2923,9 @@ void qmp_block_resize(bool has_device, const char *device, goto out; }
blockdev.c void qmp_block_resize(bool has_device, const char *device, · line 2931
Quoted 10 lines
blockdev.c +2
-3-/* complete all in-flight operations before resizing the device */ -bdrv_drain_all (); - +bdrv_drained_begin (bs); ret =blk_truncate (blk, size, errp); +bdrv_drained_end (bs); out:blk_unref (blk);
Kevin Wolf
AppliedAm 10.05.2017 um 19:39 hat John Snow geschrieben:
Quoted 11 lines
If one tries to issue a
block_resizewhile a guest is busy accessing the disk, it is possible that qemu may deadlock when invokingaio_pollfrom both the main loop and the iothread.Replace another instance of
bdrv_drain_allthat doesn't quite belong.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by John Snow <[email protected]>
Thanks, applied to the block branch.
Kevin