58 lines
1.9 KiB
Diff
58 lines
1.9 KiB
Diff
From 95ae3ad5710a4128f27e53d4fd926aa8fe596459 Mon Sep 17 00:00:00 2001
|
|
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
|
Date: Wed, 9 Dec 2015 15:39:36 +0100
|
|
Subject: [PATCH 18/49] backup: vma: correctly propagate error
|
|
|
|
---
|
|
blockdev.c | 2 +-
|
|
vma-writer.c | 7 +++++++
|
|
vma.h | 1 +
|
|
3 files changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/blockdev.c b/blockdev.c
|
|
index 5017c276e6..d3aef2cc83 100644
|
|
--- a/blockdev.c
|
|
+++ b/blockdev.c
|
|
@@ -3043,7 +3043,7 @@ static int pvebackup_dump_cb(void *opaque, BlockBackend *target,
|
|
buf, &zero_bytes);
|
|
if (ret < 0) {
|
|
if (!backup_state.error) {
|
|
- error_setg(&backup_state.error, "vma_writer_write error %d", ret);
|
|
+ vma_writer_error_propagate(backup_state.vmaw, &backup_state.error);
|
|
}
|
|
if (di->bs && di->bs->job) {
|
|
block_job_cancel(di->bs->job);
|
|
diff --git a/vma-writer.c b/vma-writer.c
|
|
index b0cf529125..689e988423 100644
|
|
--- a/vma-writer.c
|
|
+++ b/vma-writer.c
|
|
@@ -792,6 +792,13 @@ vma_writer_write(VmaWriter *vmaw, uint8_t dev_id, int64_t cluster_num,
|
|
return transferred;
|
|
}
|
|
|
|
+void vma_writer_error_propagate(VmaWriter *vmaw, Error **errp)
|
|
+{
|
|
+ if (vmaw->status < 0 && *errp == NULL) {
|
|
+ error_setg(errp, "%s", vmaw->errmsg);
|
|
+ }
|
|
+}
|
|
+
|
|
int vma_writer_close(VmaWriter *vmaw, Error **errp)
|
|
{
|
|
g_assert(vmaw != NULL);
|
|
diff --git a/vma.h b/vma.h
|
|
index 9bb6ea4f69..98377e473e 100644
|
|
--- a/vma.h
|
|
+++ b/vma.h
|
|
@@ -116,6 +116,7 @@ typedef struct VmaDeviceInfo {
|
|
|
|
VmaWriter *vma_writer_create(const char *filename, uuid_t uuid, Error **errp);
|
|
int vma_writer_close(VmaWriter *vmaw, Error **errp);
|
|
+void vma_writer_error_propagate(VmaWriter *vmaw, Error **errp);
|
|
void vma_writer_destroy(VmaWriter *vmaw);
|
|
int vma_writer_add_config(VmaWriter *vmaw, const char *name, gpointer data,
|
|
size_t len);
|
|
--
|
|
2.11.0
|
|
|