add the zeroinit block driver filter
[pve-qemu-kvm.git] / debian / patches / old / backup-do-not-return-errors-in-dump-callback.patch
blobd217968027dfc70e460af570d180780196745b43
1 The backup dump_cb should always return success. Else the original write
2 does not succeed and the VM gets notified.
4 We simply report success and cancel the backup job instead.
7 Index: new/blockdev.c
8 ===================================================================
9 --- new.orig/blockdev.c 2014-11-20 07:49:05.000000000 +0100
10 +++ new/blockdev.c 2014-11-20 07:49:14.000000000 +0100
11 @@ -1991,6 +1991,11 @@
13 PVEBackupDevInfo *di = opaque;
15 + int size = n_sectors * BDRV_SECTOR_SIZE;
16 + if (backup_state.cancel) {
17 + return size; // return success
18 + }
20 if (sector_num & 0x7f) {
21 if (!backup_state.error) {
22 error_setg(&backup_state.error,
23 @@ -2001,7 +2006,6 @@
26 int64_t cluster_num = sector_num >> 7;
27 - int size = n_sectors * BDRV_SECTOR_SIZE;
29 int ret = -1;
31 @@ -2009,17 +2013,27 @@
32 size_t zero_bytes = 0;
33 ret = vma_writer_write(backup_state.vmaw, di->dev_id, cluster_num,
34 buf, &zero_bytes);
35 - backup_state.zero_bytes += zero_bytes;
36 + if (ret < 0) {
37 + if (!backup_state.error) {
38 + error_setg(&backup_state.error, "vma_writer_write error %d", ret);
39 + }
40 + if (di->bs && di->bs->job) {
41 + block_job_cancel(di->bs->job);
42 + }
43 + } else {
44 + backup_state.zero_bytes += zero_bytes;
45 + backup_state.transferred += size;
46 + }
47 } else {
48 - ret = size;
49 if (!buf) {
50 backup_state.zero_bytes += size;
52 + backup_state.transferred += size;
55 - backup_state.transferred += size;
56 + // Note: always return success, because we want that writes succeed anyways.
58 - return ret;
59 + return size;
62 static void pvebackup_cleanup(void)
63 @@ -2091,7 +2105,7 @@
64 BlockJob *job = di->bs->job;
65 if (job) {
66 if (!di->completed) {
67 - block_job_cancel_sync(job);
68 + block_job_cancel_sync(job);