[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 03/28] blockdev: fix missed target unref for drive-ba
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 03/28] blockdev: fix missed target unref for drive-backup |
Date: |
Mon, 3 Jun 2019 17:02:08 +0200 |
From: John Snow <address@hidden>
If the bitmap can't be used for whatever reason, we skip putting down
the reference. Fix that.
In practice, this means that if you attempt to gracefully exit QEMU
after a backup command being rejected, bdrv_close_all will fail and
tell you some unpleasant things via assert().
Reported-by: aihua liang <address@hidden>
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1703916
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 17c2d801d7..d88dc115f2 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3546,8 +3546,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup,
JobTxn *txn,
if (set_backing_hd) {
bdrv_set_backing_hd(target_bs, source, &local_err);
if (local_err) {
- bdrv_unref(target_bs);
- goto out;
+ goto unref;
}
}
@@ -3555,11 +3554,10 @@ static BlockJob *do_drive_backup(DriveBackup *backup,
JobTxn *txn,
bmap = bdrv_find_dirty_bitmap(bs, backup->bitmap);
if (!bmap) {
error_setg(errp, "Bitmap '%s' could not be found", backup->bitmap);
- bdrv_unref(target_bs);
- goto out;
+ goto unref;
}
if (bdrv_dirty_bitmap_check(bmap, BDRV_BITMAP_DEFAULT, errp)) {
- goto out;
+ goto unref;
}
}
if (!backup->auto_finalize) {
@@ -3573,12 +3571,13 @@ static BlockJob *do_drive_backup(DriveBackup *backup,
JobTxn *txn,
backup->sync, bmap, backup->compress,
backup->on_source_error, backup->on_target_error,
job_flags, NULL, NULL, txn, &local_err);
- bdrv_unref(target_bs);
if (local_err != NULL) {
error_propagate(errp, local_err);
- goto out;
+ goto unref;
}
+unref:
+ bdrv_unref(target_bs);
out:
aio_context_release(aio_context);
return job;
--
2.20.1
- [Qemu-block] [PULL 00/28] Block layer patches, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 01/28] block: Drain source node in bdrv_replace_node(), Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 03/28] blockdev: fix missed target unref for drive-backup,
Kevin Wolf <=
- [Qemu-block] [PULL 04/28] tests/perf: Test lseek influence on qcow2 block-status, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 02/28] iotests: Test commit job start with concurrent I/O, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 05/28] block: avoid recursive block_status call if possible, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 06/28] block/io: Delay decrementing the quiesce_counter, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 08/28] block/linux-aio: Drop unused BlockAIOCB submission method, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 09/28] nvme: add Get/Set Feature Timestamp support, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 07/28] iotests: Test cancelling a job and closing the VM, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 10/28] test-block-iothread: Check filter node in test_propagate_mirror, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 12/28] block: Add Error to blk_set_aio_context(), Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 11/28] nbd-server: Call blk_set_allow_aio_context_change(), Kevin Wolf, 2019/06/03