From: Dietmar Maurer Date: Mon, 2 Dec 2013 11:10:22 +0000 (+0100) Subject: backup: call backup_cancel inside coroutine X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=0c5f6a919618f19ae871bd83389a54451897756b;p=pve-qemu-kvm.git backup: call backup_cancel inside coroutine Because vma_writer can yield due to outstanding io. --- diff --git a/debian/patches/backup-add-pve-monitor-commands.patch b/debian/patches/backup-add-pve-monitor-commands.patch index 3955237..ba15ff8 100644 --- a/debian/patches/backup-add-pve-monitor-commands.patch +++ b/debian/patches/backup-add-pve-monitor-commands.patch @@ -1,7 +1,7 @@ Index: new/blockdev.c =================================================================== ---- new.orig/blockdev.c 2013-12-02 07:42:33.000000000 +0100 -+++ new/blockdev.c 2013-12-02 08:40:19.000000000 +0100 +--- new.orig/blockdev.c 2013-12-02 11:40:36.000000000 +0100 ++++ new/blockdev.c 2013-12-02 12:07:54.000000000 +0100 @@ -45,6 +45,7 @@ #include "qmp-commands.h" #include "trace.h" @@ -10,7 +10,7 @@ Index: new/blockdev.c static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives); -@@ -1438,6 +1439,412 @@ +@@ -1438,6 +1439,417 @@ } } @@ -117,7 +117,7 @@ Index: new/blockdev.c + } +} + -+static void pvebackup_cancel(void) ++static void pvebackup_cancel(void *opaque) +{ + backup_state.cancel = true; + @@ -147,7 +147,12 @@ Index: new/blockdev.c + +void qmp_backup_cancel(Error **errp) +{ -+ pvebackup_cancel(); ++ Coroutine *co = qemu_coroutine_create(pvebackup_cancel); ++ qemu_coroutine_enter(co, NULL); ++ ++ while (backup_state.vmaw) { ++ qemu_aio_wait(); ++ } +} + +static void pvebackup_run_next_job(void) @@ -340,7 +345,7 @@ Index: new/blockdev.c + pvebackup_dump_cb, pvebackup_complete_cb, di, &local_err); + if (local_err != NULL) { + error_setg(&backup_state.error, "backup_job_create failed"); -+ pvebackup_cancel(); ++ pvebackup_cancel(NULL); + } + } + @@ -425,8 +430,8 @@ Index: new/blockdev.c { Index: new/hmp-commands.hx =================================================================== ---- new.orig/hmp-commands.hx 2013-12-02 07:39:56.000000000 +0100 -+++ new/hmp-commands.hx 2013-12-02 08:19:27.000000000 +0100 +--- new.orig/hmp-commands.hx 2013-11-27 10:51:33.000000000 +0100 ++++ new/hmp-commands.hx 2013-12-02 11:40:36.000000000 +0100 @@ -83,6 +83,35 @@ Copy data from a backing file into a block device. ETEXI @@ -474,8 +479,8 @@ Index: new/hmp-commands.hx @item info migrate_capabilities Index: new/hmp.c =================================================================== ---- new.orig/hmp.c 2013-12-02 07:39:56.000000000 +0100 -+++ new/hmp.c 2013-12-02 08:21:00.000000000 +0100 +--- new.orig/hmp.c 2013-12-02 11:40:35.000000000 +0100 ++++ new/hmp.c 2013-12-02 11:40:36.000000000 +0100 @@ -133,6 +133,38 @@ qapi_free_MouseInfoList(mice_list); } @@ -555,8 +560,8 @@ Index: new/hmp.c Error *error = NULL; Index: new/hmp.h =================================================================== ---- new.orig/hmp.h 2013-12-02 07:39:56.000000000 +0100 -+++ new/hmp.h 2013-12-02 08:22:00.000000000 +0100 +--- new.orig/hmp.h 2013-11-27 10:51:33.000000000 +0100 ++++ new/hmp.h 2013-12-02 11:40:36.000000000 +0100 @@ -28,6 +28,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict); void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict); @@ -576,8 +581,8 @@ Index: new/hmp.h void hmp_block_job_pause(Monitor *mon, const QDict *qdict); Index: new/monitor.c =================================================================== ---- new.orig/monitor.c 2013-12-02 07:39:56.000000000 +0100 -+++ new/monitor.c 2013-12-02 08:22:29.000000000 +0100 +--- new.orig/monitor.c 2013-11-27 10:51:33.000000000 +0100 ++++ new/monitor.c 2013-12-02 11:40:36.000000000 +0100 @@ -2880,6 +2880,13 @@ }, #endif @@ -594,8 +599,8 @@ Index: new/monitor.c .params = "", Index: new/qapi-schema.json =================================================================== ---- new.orig/qapi-schema.json 2013-12-02 07:39:56.000000000 +0100 -+++ new/qapi-schema.json 2013-12-02 08:16:27.000000000 +0100 +--- new.orig/qapi-schema.json 2013-12-02 11:40:35.000000000 +0100 ++++ new/qapi-schema.json 2013-12-02 11:40:36.000000000 +0100 @@ -547,6 +547,95 @@ ## { 'command': 'query-events', 'returns': ['EventInfo'] } @@ -694,8 +699,8 @@ Index: new/qapi-schema.json # Index: new/qmp-commands.hx =================================================================== ---- new.orig/qmp-commands.hx 2013-12-02 07:39:56.000000000 +0100 -+++ new/qmp-commands.hx 2013-12-02 08:19:45.000000000 +0100 +--- new.orig/qmp-commands.hx 2013-12-02 11:40:35.000000000 +0100 ++++ new/qmp-commands.hx 2013-12-02 11:40:36.000000000 +0100 @@ -966,6 +966,24 @@ EQMP