From: Jiri Denemark Date: Tue, 23 Feb 2016 09:47:01 +0000 (+0100) Subject: qemu: Fix a race when computing migration downtime X-Git-Tag: v1.3.3-rc1~260 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb483a68fdc3503efc9b0996570e58aaf0c11c17;p=thirdparty%2Flibvirt.git qemu: Fix a race when computing migration downtime Computing a total downtime during a migration requires us to store a time stamp when guest CPUs get stopped. The value (and all other statistics) is then transferred to the destination to compute the downtime. Because the stopped time stamp is stored by a STOP event handler while the statistics which will be sent over to the destination are copied synchronously within qemuMigrationWaitForCompletion. Depending on the timing of STOP and MIGRATION events, we may end up copying (and transferring) statistics without the stopped time stamp set. Let's make sure we always use the correct time stamp. https://bugzilla.redhat.com/show_bug.cgi?id=1282744 Signed-off-by: Jiri Denemark --- diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index c9f8422dab..7cbb228dd3 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4510,6 +4510,8 @@ qemuMigrationRun(virQEMUDriverPtr driver, priv->job.current->type = VIR_DOMAIN_JOB_FAILED; goto cleanup; } + if (priv->job.completed) + priv->job.completed->stopped = priv->job.current->stopped; ret = 0;