[pve-devel] [PATCH] qmp_delete_drive_snapshot : add-aiocontext

Alexandre Derumier aderumier at odiso.com
Mon Nov 7 12:08:05 CET 2016


fix delete snapshot with qcow2 and iothread enabled

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 ...-qmp_delete_drive_snapshot-add-aiocontext.patch | 59 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 60 insertions(+)
 create mode 100644 debian/patches/pve/0045-qmp_delete_drive_snapshot-add-aiocontext.patch

diff --git a/debian/patches/pve/0045-qmp_delete_drive_snapshot-add-aiocontext.patch b/debian/patches/pve/0045-qmp_delete_drive_snapshot-add-aiocontext.patch
new file mode 100644
index 0000000..29c6d32
--- /dev/null
+++ b/debian/patches/pve/0045-qmp_delete_drive_snapshot-add-aiocontext.patch
@@ -0,0 +1,59 @@
+From b4f04c214d85b8570af61012a9f81ce037ccd81f Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Mon, 7 Nov 2016 11:47:50 +0100
+Subject: [PATCH] qmp_delete_drive_snapshot : add aiocontext
+
+this fix snapshot delete of qcow2 with iothread enabled
+
+Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
+---
+ savevm-async.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/savevm-async.c b/savevm-async.c
+index 2faaf7a..05b5b19 100644
+--- a/savevm-async.c
++++ b/savevm-async.c
+@@ -427,6 +427,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;
+ 
+@@ -443,22 +444,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.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index d025009..5213ee3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -42,6 +42,7 @@ pve/0041-savevm-async-updates.patch
 pve/0042-qmp_snapshot_drive-add-aiocontext.patch
 pve/0043-vma-sizes-passed-to-blk_co_preadv-should-be-bytes-no.patch
 pve/0044-glusterfs-daemonize.patch
+pve/0045-qmp_delete_drive_snapshot-add-aiocontext.patch
 #see https://bugs.launchpad.net/qemu/+bug/1488363?comments=all
 extra/x86-lapic-Load-LAPIC-state-at-post_load.patch
 extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch
-- 
2.1.4




More information about the pve-devel mailing list