All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] blockdev: use drained_begin/end for qmp_block_resize
@ 2017-05-10 17:39 John Snow
  2017-05-10 18:32 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John Snow @ 2017-05-10 17:39 UTC (permalink / raw)
  To: qemu-block
  Cc: kwolf, qemu-devel, qemu-stable, stefanha, pbonzini, mreitz, John Snow

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.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
 blockdev.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 0b38c3d..9ff06f3 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);
-- 
2.9.3

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

* Re: [Qemu-devel] [PATCH] blockdev: use drained_begin/end for qmp_block_resize
  2017-05-10 17:39 [Qemu-devel] [PATCH] blockdev: use drained_begin/end for qmp_block_resize John Snow
@ 2017-05-10 18:32 ` Eric Blake
  2017-05-11  7:53 ` Paolo Bonzini
  2017-05-11  9:26 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2017-05-10 18:32 UTC (permalink / raw)
  To: John Snow, qemu-block
  Cc: kwolf, qemu-stable, qemu-devel, mreitz, stefanha, pbonzini

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

On 05/10/2017 12:39 PM, John Snow wrote:
> 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.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  blockdev.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

> diff --git a/blockdev.c b/blockdev.c
> index 0b38c3d..9ff06f3 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);
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


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

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

* Re: [Qemu-devel] [PATCH] blockdev: use drained_begin/end for qmp_block_resize
  2017-05-10 17:39 [Qemu-devel] [PATCH] blockdev: use drained_begin/end for qmp_block_resize John Snow
  2017-05-10 18:32 ` Eric Blake
@ 2017-05-11  7:53 ` Paolo Bonzini
  2017-05-11  9:26 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-05-11  7:53 UTC (permalink / raw)
  To: John Snow, qemu-block; +Cc: kwolf, qemu-devel, qemu-stable, stefanha, mreitz



On 10/05/2017 19:39, John Snow wrote:
> 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.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  blockdev.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index 0b38c3d..9ff06f3 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);
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

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

* Re: [Qemu-devel] [PATCH] blockdev: use drained_begin/end for qmp_block_resize
  2017-05-10 17:39 [Qemu-devel] [PATCH] blockdev: use drained_begin/end for qmp_block_resize John Snow
  2017-05-10 18:32 ` Eric Blake
  2017-05-11  7:53 ` Paolo Bonzini
@ 2017-05-11  9:26 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2017-05-11  9:26 UTC (permalink / raw)
  To: John Snow; +Cc: qemu-block, qemu-devel, qemu-stable, stefanha, pbonzini, mreitz

Am 10.05.2017 um 19:39 hat John Snow geschrieben:
> 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.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: John Snow <jsnow@redhat.com>

Thanks, applied to the block branch.

Kevin

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

end of thread, other threads:[~2017-05-11  9:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 17:39 [Qemu-devel] [PATCH] blockdev: use drained_begin/end for qmp_block_resize John Snow
2017-05-10 18:32 ` Eric Blake
2017-05-11  7:53 ` Paolo Bonzini
2017-05-11  9:26 ` Kevin Wolf

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.