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