pve-qemu/debian/patches/pve/0020-block-snapshot-qmp_del...

60 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alexandre Derumier <aderumier@odiso.com>
Date: Mon, 7 Nov 2016 11:47:50 +0100
Subject: [PATCH] block: snapshot: qmp_delete_drive_snapshot : add aiocontext
this fix snapshot delete of qcow2 with iothread enabled
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
savevm-async.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/savevm-async.c b/savevm-async.c
index 06dcd29fc7..e6f86ef865 100644
--- a/savevm-async.c
+++ b/savevm-async.c
@@ -459,6 +459,7 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
BlockDriverState *bs;
QEMUSnapshotInfo sn1, *sn = &sn1;
Error *local_err = NULL;
+ AioContext *aio_context;
int ret;
@@ -475,22 +476,28 @@ void qmp_delete_drive_snapshot(const char *device, const char *name,
return;
}
+ aio_context = bdrv_get_aio_context(bs);
+ aio_context_acquire(aio_context);
+
if (!bdrv_can_snapshot(bs)) {
error_setg(errp, QERR_UNSUPPORTED);
- return;
+ goto out;
}
if (bdrv_snapshot_find(bs, sn, name) < 0) {
/* return success if snapshot does not exists */
- return;
+ goto out;
}
ret = bdrv_snapshot_delete(bs, NULL, name, &local_err);
if (ret < 0) {
error_set(errp, ERROR_CLASS_GENERIC_ERROR,
"Error while deleting snapshot on '%s'\n", device);
- return;
+ goto out;
}
+
+out:
+ aio_context_release(aio_context);
}
static ssize_t loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
--
2.11.0