diff mbox series

[v2,12/33] block/copy-before-write: drop extra bdrv_unref on failure path

Message ID 20210520142205.607501-13-vsementsov@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series block: publish backup-top filter | expand

Commit Message

Vladimir Sementsov-Ogievskiy May 20, 2021, 2:21 p.m. UTC
bdrv_attach_child() do bdrv_unref() on failure, so we shouldn't do it
by hand here.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block/copy-before-write.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Max Reitz May 31, 2021, 4:19 p.m. UTC | #1
On 20.05.21 16:21, Vladimir Sementsov-Ogievskiy wrote:
> bdrv_attach_child() do bdrv_unref() on failure, so we shouldn't do it
> by hand here.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   block/copy-before-write.c | 1 -
>   1 file changed, 1 deletion(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>
diff mbox series

Patch

diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index 2a51cc64e4..945d9340f4 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -201,7 +201,6 @@  BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
     state->target = bdrv_attach_child(top, target, "target", &child_of_bds,
                                       BDRV_CHILD_DATA, errp);
     if (!state->target) {
-        bdrv_unref(target);
         bdrv_unref(top);
         return NULL;
     }