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

Alexandre Derumier aderumier at odiso.com
Thu Sep 15 11:40:11 CEST 2016


This fix internal snapshot for drive with iothread enabled

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

diff --git a/debian/patches/pve/0056-qmp_snapshot_drive-add-aiocontext.patch b/debian/patches/pve/0056-qmp_snapshot_drive-add-aiocontext.patch
new file mode 100644
index 0000000..8c2d9c9
--- /dev/null
+++ b/debian/patches/pve/0056-qmp_snapshot_drive-add-aiocontext.patch
@@ -0,0 +1,65 @@
+From 61164c3693415d6dce39a7b0cbde43b184081243 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Tue, 13 Sep 2016 01:57:56 +0200
+Subject: [PATCH] qmp_snapshot_drive:  add aiocontext
+
+Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
+---
+ savevm-async.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/savevm-async.c b/savevm-async.c
+index 6a2266c..308ac61 100644
+--- a/savevm-async.c
++++ b/savevm-async.c
+@@ -345,6 +345,7 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
+     BlockBackend *blk;
+     BlockDriverState *bs;
+     QEMUSnapshotInfo sn1, *sn = &sn1;
++    AioContext *aio_context;
+     int ret;
+ #ifdef _WIN32
+     struct _timeb tb;
+@@ -371,20 +372,23 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
+         return;
+     }
+ 
++    aio_context = bdrv_get_aio_context(bs);
++    aio_context_acquire(aio_context);
++
+     if (bdrv_is_read_only(bs)) {
+         error_setg(errp, "Node '%s' is read only", device);
+-        return;
++        goto out;
+     }
+ 
+     if (!bdrv_can_snapshot(bs)) {
+         error_setg(errp, QERR_UNSUPPORTED);
+-        return;
++        goto out;
+     }
+ 
+     if (bdrv_snapshot_find(bs, sn, name) >= 0) {
+         error_set(errp, ERROR_CLASS_GENERIC_ERROR,
+                   "snapshot '%s' already exists", name);
+-        return;
++        goto out;
+     }
+ 
+     sn = &sn1;
+@@ -409,8 +413,11 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
+     if (ret < 0) {
+         error_set(errp, ERROR_CLASS_GENERIC_ERROR,
+                   "Error while creating snapshot on '%s'\n", device);
+-        return;
++        goto out;
+     }
++
++out:
++    aio_context_release(aio_context);
+ }
+ 
+ void qmp_delete_drive_snapshot(const char *device, const char *name,
+-- 
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 5ad7435..d1470ba 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -53,6 +53,7 @@ pve/0052-vnc-refactor-to-QIOChannelSocket.patch
 pve/0053-vma-use-BlockBackend-on-extract.patch
 pve/0054-rbd-disable-rbd_cache_writethrough_until_flush-with-.patch
 pve/0055-enable-cache-unsafe-for-vma-extract_content-and-qmp_.patch
+pve/0056-qmp_snapshot_drive-add-aiocontext.patch
 #see https://bugs.launchpad.net/qemu/+bug/1488363?comments=all
 extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch
 extra/0002-scsi-esp-fix-migration.patch
-- 
2.1.4




More information about the pve-devel mailing list