]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0021-block-snapshot-qmp_delete_drive_snapshot-add-aiocont.patch
bump version to 2.9.1-9
[pve-qemu.git] / debian / patches / pve / 0021-block-snapshot-qmp_delete_drive_snapshot-add-aiocont.patch
CommitLineData
23102ed6 1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
95259824
WB
2From: Alexandre Derumier <aderumier@odiso.com>
3Date: Mon, 7 Nov 2016 11:47:50 +0100
23102ed6 4Subject: [PATCH] block: snapshot: qmp_delete_drive_snapshot : add aiocontext
95259824
WB
5
6this fix snapshot delete of qcow2 with iothread enabled
7
8Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9---
10 savevm-async.c | 13 ++++++++++---
11 1 file changed, 10 insertions(+), 3 deletions(-)
12
13diff --git a/savevm-async.c b/savevm-async.c
ddbcf45e 14index ece193a065..716dd2d7a1 100644
95259824
WB
15--- a/savevm-async.c
16+++ b/savevm-async.c
67af0fa4 17@@ -459,6 +459,7 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
95259824
WB
18 BlockDriverState *bs;
19 QEMUSnapshotInfo sn1, *sn = &sn1;
20 Error *local_err = NULL;
21+ AioContext *aio_context;
22
23 int ret;
24
67af0fa4 25@@ -475,22 +476,28 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
95259824
WB
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--
45169293 582.11.0
95259824 59