Patchwork [RFC,1/4] block/backup: delete target after completion callback

login
register
mail settings
Submitter Fam Zheng
Date July 29, 2013, 4:25 a.m.
Message ID <1375071932-31627-2-git-send-email-famz@redhat.com>
Download mbox | patch
Permalink /patch/262663/
State New
Headers show

Comments

Fam Zheng - July 29, 2013, 4:25 a.m.
Move bdrv_delete(target) one line down to give block job caller a chance
to handle target on completion before deleting it.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/backup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Eric Blake - Aug. 21, 2013, 6:37 p.m.
On 07/28/2013 10:25 PM, Fam Zheng wrote:
> Move bdrv_delete(target) one line down to give block job caller a chance
> to handle target on completion before deleting it.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/backup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

Patch

diff --git a/block/backup.c b/block/backup.c
index 6ae8a05..d80341c 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -338,9 +338,9 @@  static void coroutine_fn backup_run(void *opaque)
     hbitmap_free(job->bitmap);
 
     bdrv_iostatus_disable(target);
-    bdrv_delete(target);
 
     block_job_completed(&job->common, ret);
+    bdrv_delete(target);
 }
 
 void backup_start(BlockDriverState *bs, BlockDriverState *target,