1 From 0db7b5b9c1799414788a43c3181c5b965d1b4be7 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Wed, 9 Dec 2015 15:22:19 +0100
4 Subject: [PATCH 18/55] backup: do not return errors in dump callback
7 blockdev.c | 26 ++++++++++++++++++++------
8 1 file changed, 20 insertions(+), 6 deletions(-)
10 diff --git a/blockdev.c b/blockdev.c
11 index 0537a53..157cc44 100644
14 @@ -3026,6 +3026,11 @@ static int pvebackup_dump_cb(void *opaque, BlockDriverState *target,
16 PVEBackupDevInfo *di = opaque;
18 + int size = n_sectors * BDRV_SECTOR_SIZE;
19 + if (backup_state.cancel) {
20 + return size; // return success
23 if (sector_num & 0x7f) {
24 if (!backup_state.error) {
25 error_setg(&backup_state.error,
26 @@ -3036,7 +3041,6 @@ static int pvebackup_dump_cb(void *opaque, BlockDriverState *target,
29 int64_t cluster_num = sector_num >> 7;
30 - int size = n_sectors * BDRV_SECTOR_SIZE;
34 @@ -3044,17 +3048,27 @@ static int pvebackup_dump_cb(void *opaque, BlockDriverState *target,
35 size_t zero_bytes = 0;
36 ret = vma_writer_write(backup_state.vmaw, di->dev_id, cluster_num,
38 - backup_state.zero_bytes += zero_bytes;
40 + if (!backup_state.error) {
41 + error_setg(&backup_state.error, "vma_writer_write error %d", ret);
43 + if (di->bs && di->bs->job) {
44 + block_job_cancel(di->bs->job);
47 + backup_state.zero_bytes += zero_bytes;
48 + backup_state.transferred += size;
53 backup_state.zero_bytes += size;
55 + backup_state.transferred += size;
58 - backup_state.transferred += size;
59 + // Note: always return success, because we want that writes succeed anyways.
65 static void pvebackup_cleanup(void)
66 @@ -3126,7 +3140,7 @@ static void pvebackup_cancel(void *opaque)
67 BlockJob *job = di->bs->job;
70 - block_job_cancel_sync(job);
71 + block_job_cancel_sync(job);