From: John Snow <[email protected]> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1447551
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. Cc: [email protected] Suggested-by: Paolo Bonzini <[email protected]> Signed-off-by: John Snow <[email protected]> Reviewed-by: Eric Blake <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Kevin Wolf <[email protected]> --- blockdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 0d3773b..c63f4e8 100644 --- a/blockdev.c +++ b/blockdev.c @@ -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); -- 1.8.3.1
