From: John Snow Date: Wed, 10 May 2017 17:39:45 +0000 (-0400) Subject: blockdev: use drained_begin/end for qmp_block_resize X-Git-Tag: v2.9.1~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af8ca55a6b74f9907c33c72412ef7cb0fb256fc3;p=thirdparty%2Fqemu.git blockdev: use drained_begin/end for qmp_block_resize 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: qemu-stable@nongnu.org Suggested-by: Paolo Bonzini Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Paolo Bonzini Signed-off-by: Kevin Wolf (cherry picked from commit 698bdfa07d66b5ec218a60229e58eae1dcde00e5) Signed-off-by: Michael Roth --- diff --git a/blockdev.c b/blockdev.c index 78e12040658..e8a9a651670 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);