]> git.proxmox.com Git - pve-qemu-kvm.git/blob - debian/patches/pve/0045-qmp_delete_drive_snapshot-add-aiocontext.patch
fix backup jobs
[pve-qemu-kvm.git] / debian / patches / pve / 0045-qmp_delete_drive_snapshot-add-aiocontext.patch
1 From 6e77b017c725d2e42faa63228fa56c3b20e083c6 Mon Sep 17 00:00:00 2001
2 From: Alexandre Derumier <aderumier@odiso.com>
3 Date: Mon, 7 Nov 2016 11:47:50 +0100
4 Subject: [PATCH 45/47] qmp_delete_drive_snapshot : add aiocontext
5
6 this fix snapshot delete of qcow2 with iothread enabled
7
8 Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9 ---
10 savevm-async.c | 13 ++++++++++---
11 1 file changed, 10 insertions(+), 3 deletions(-)
12
13 diff --git a/savevm-async.c b/savevm-async.c
14 index 5913a90..3adf89f 100644
15 --- a/savevm-async.c
16 +++ b/savevm-async.c
17 @@ -427,6 +427,7 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
18 BlockDriverState *bs;
19 QEMUSnapshotInfo sn1, *sn = &sn1;
20 Error *local_err = NULL;
21 + AioContext *aio_context;
22
23 int ret;
24
25 @@ -443,22 +444,28 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
26 return;
27 }
28
29 + aio_context = bdrv_get_aio_context(bs);
30 + aio_context_acquire(aio_context);
31 +
32 if (!bdrv_can_snapshot(bs)) {
33 error_setg(errp, QERR_UNSUPPORTED);
34 - return;
35 + goto out;
36 }
37
38 if (bdrv_snapshot_find(bs, sn, name) < 0) {
39 /* return success if snapshot does not exists */
40 - return;
41 + goto out;
42 }
43
44 ret = bdrv_snapshot_delete(bs, NULL, name, &local_err);
45 if (ret < 0) {
46 error_set(errp, ERROR_CLASS_GENERIC_ERROR,
47 "Error while deleting snapshot on '%s'\n", device);
48 - return;
49 + goto out;
50 }
51 +
52 +out:
53 + aio_context_release(aio_context);
54 }
55
56 static ssize_t loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
57 --
58 2.1.4
59