]> git.proxmox.com Git - pve-qemu-kvm.git/blobdiff - debian/patches/pve/0017-backup-do-not-return-errors-in-dump-callback.patch
update to 2.7
[pve-qemu-kvm.git] / debian / patches / pve / 0017-backup-do-not-return-errors-in-dump-callback.patch
diff --git a/debian/patches/pve/0017-backup-do-not-return-errors-in-dump-callback.patch b/debian/patches/pve/0017-backup-do-not-return-errors-in-dump-callback.patch
new file mode 100644 (file)
index 0000000..5900420
--- /dev/null
@@ -0,0 +1,77 @@
+From 042b664cc0237d51f188f7feed962df1e8a26910 Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller@proxmox.com>
+Date: Wed, 9 Dec 2015 15:22:19 +0100
+Subject: [PATCH 17/41] backup: do not return errors in dump callback
+
+---
+ blockdev.c | 26 ++++++++++++++++++++------
+ 1 file changed, 20 insertions(+), 6 deletions(-)
+
+diff --git a/blockdev.c b/blockdev.c
+index d8b1db8..fb71cdc 100644
+--- a/blockdev.c
++++ b/blockdev.c
+@@ -3013,6 +3013,11 @@ static int pvebackup_dump_cb(void *opaque, BlockBackend *target,
+ {
+     PVEBackupDevInfo *di = opaque;
++    int size = n_sectors * BDRV_SECTOR_SIZE;
++    if (backup_state.cancel) {
++        return size; // return success
++    }
++
+     if (sector_num & 0x7f) {
+         if (!backup_state.error) {
+             error_setg(&backup_state.error,
+@@ -3023,7 +3028,6 @@ static int pvebackup_dump_cb(void *opaque, BlockBackend *target,
+     }
+     int64_t cluster_num = sector_num >> 7;
+-    int size = n_sectors * BDRV_SECTOR_SIZE;
+     int ret = -1;
+@@ -3031,17 +3035,27 @@ static int pvebackup_dump_cb(void *opaque, BlockBackend *target,
+         size_t zero_bytes = 0;
+         ret = vma_writer_write(backup_state.vmaw, di->dev_id, cluster_num,
+                                buf, &zero_bytes);
+-        backup_state.zero_bytes += zero_bytes;
++        if (ret < 0) {
++            if (!backup_state.error) {
++                error_setg(&backup_state.error, "vma_writer_write error %d", ret);
++            }
++            if (di->bs && di->bs->job) {
++                block_job_cancel(di->bs->job);
++            }
++        } else {
++            backup_state.zero_bytes += zero_bytes;
++            backup_state.transferred += size;
++        }
+     } else {
+-        ret = size;
+         if (!buf) {
+             backup_state.zero_bytes += size;
+         }
++        backup_state.transferred += size;
+     }
+-    backup_state.transferred += size;
++    // Note: always return success, because we want that writes succeed anyways.
+-    return ret;
++    return size;
+ }
+ static void pvebackup_cleanup(void)
+@@ -3113,7 +3127,7 @@ static void pvebackup_cancel(void *opaque)
+             BlockJob *job = di->bs->job;
+             if (job) {
+                 if (!di->completed) {
+-                    block_job_cancel_sync(job);
++                     block_job_cancel_sync(job);
+                 }
+             }
+         }
+-- 
+2.1.4
+