1 From 9b6ccb4512735cf5455a473f99a946371a466a3d 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/41] 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 29a33c0..9bb354c 100644
14 @@ -2912,6 +2912,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 @@ -2922,7 +2927,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 @@ -2930,17 +2934,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 @@ -3012,7 +3026,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);