qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backup-top: Begin drain earlier
@ 2019-12-19 18:26 Max Reitz
  2019-12-20  9:12 ` Vladimir Sementsov-Ogievskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Max Reitz @ 2019-12-19 18:26 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, qemu-stable, Vladimir Sementsov-Ogievskiy, qemu-devel,
	Max Reitz

When dropping backup-top, we need to drain the node before freeing the
BlockCopyState.  Otherwise, requests may still be in flight and then the
assertion in shres_destroy() will fail.

(This becomes visible in intermittent failure of 056.)

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/backup-top.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/backup-top.c b/block/backup-top.c
index 7cdb1f8eba..818d3f26b4 100644
--- a/block/backup-top.c
+++ b/block/backup-top.c
@@ -257,12 +257,12 @@ void bdrv_backup_top_drop(BlockDriverState *bs)
     BDRVBackupTopState *s = bs->opaque;
     AioContext *aio_context = bdrv_get_aio_context(bs);
 
-    block_copy_state_free(s->bcs);
-
     aio_context_acquire(aio_context);
 
     bdrv_drained_begin(bs);
 
+    block_copy_state_free(s->bcs);
+
     s->active = false;
     bdrv_child_refresh_perms(bs, bs->backing, &error_abort);
     bdrv_replace_node(bs, backing_bs(bs), &error_abort);
-- 
2.23.0



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

* Re: [PATCH] backup-top: Begin drain earlier
  2019-12-19 18:26 [PATCH] backup-top: Begin drain earlier Max Reitz
@ 2019-12-20  9:12 ` Vladimir Sementsov-Ogievskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2019-12-20  9:12 UTC (permalink / raw)
  To: Max Reitz, qemu-block@nongnu.org
  Cc: Kevin Wolf, qemu-devel@nongnu.org, qemu-stable@nongnu.org

19.12.2019 21:26, Max Reitz wrote:
> When dropping backup-top, we need to drain the node before freeing the
> BlockCopyState.  Otherwise, requests may still be in flight and then the
> assertion in shres_destroy() will fail.
> 
> (This becomes visible in intermittent failure of 056.)
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Max Reitz <mreitz@redhat.com>

Good catch

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---
>   block/backup-top.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/backup-top.c b/block/backup-top.c
> index 7cdb1f8eba..818d3f26b4 100644
> --- a/block/backup-top.c
> +++ b/block/backup-top.c
> @@ -257,12 +257,12 @@ void bdrv_backup_top_drop(BlockDriverState *bs)
>       BDRVBackupTopState *s = bs->opaque;
>       AioContext *aio_context = bdrv_get_aio_context(bs);
>   
> -    block_copy_state_free(s->bcs);
> -
>       aio_context_acquire(aio_context);
>   
>       bdrv_drained_begin(bs);
>   
> +    block_copy_state_free(s->bcs);
> +
>       s->active = false;
>       bdrv_child_refresh_perms(bs, bs->backing, &error_abort);
>       bdrv_replace_node(bs, backing_bs(bs), &error_abort);
> 


-- 
Best regards,
Vladimir

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

end of thread, other threads:[~2019-12-20  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-19 18:26 [PATCH] backup-top: Begin drain earlier Max Reitz
2019-12-20  9:12 ` Vladimir Sementsov-Ogievskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).