update to 2.7
[pve-qemu-kvm.git] / debian / patches / pve / 0018-backup-vma-correctly-propagate-error.patch
blob033bebcc23286b1b7b34e40cb3defc9bc091363d
1 From 7f74494cc36b70074bbdf8aaaca7eb7d0ad6c5e5 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Wed, 9 Dec 2015 15:39:36 +0100
4 Subject: [PATCH 18/41] backup: vma: correctly propagate error
6 ---
7 blockdev.c | 2 +-
8 vma-writer.c | 7 +++++++
9 vma.h | 1 +
10 3 files changed, 9 insertions(+), 1 deletion(-)
12 diff --git a/blockdev.c b/blockdev.c
13 index fb71cdc..2e51913 100644
14 --- a/blockdev.c
15 +++ b/blockdev.c
16 @@ -3037,7 +3037,7 @@ static int pvebackup_dump_cb(void *opaque, BlockBackend *target,
17 buf, &zero_bytes);
18 if (ret < 0) {
19 if (!backup_state.error) {
20 - error_setg(&backup_state.error, "vma_writer_write error %d", ret);
21 + vma_writer_error_propagate(backup_state.vmaw, &backup_state.error);
23 if (di->bs && di->bs->job) {
24 block_job_cancel(di->bs->job);
25 diff --git a/vma-writer.c b/vma-writer.c
26 index b0cf529..689e988 100644
27 --- a/vma-writer.c
28 +++ b/vma-writer.c
29 @@ -792,6 +792,13 @@ vma_writer_write(VmaWriter *vmaw, uint8_t dev_id, int64_t cluster_num,
30 return transferred;
33 +void vma_writer_error_propagate(VmaWriter *vmaw, Error **errp)
35 + if (vmaw->status < 0 && *errp == NULL) {
36 + error_setg(errp, "%s", vmaw->errmsg);
37 + }
40 int vma_writer_close(VmaWriter *vmaw, Error **errp)
42 g_assert(vmaw != NULL);
43 diff --git a/vma.h b/vma.h
44 index 9bb6ea4..98377e4 100644
45 --- a/vma.h
46 +++ b/vma.h
47 @@ -116,6 +116,7 @@ typedef struct VmaDeviceInfo {
49 VmaWriter *vma_writer_create(const char *filename, uuid_t uuid, Error **errp);
50 int vma_writer_close(VmaWriter *vmaw, Error **errp);
51 +void vma_writer_error_propagate(VmaWriter *vmaw, Error **errp);
52 void vma_writer_destroy(VmaWriter *vmaw);
53 int vma_writer_add_config(VmaWriter *vmaw, const char *name, gpointer data,
54 size_t len);
55 --
56 2.1.4