On 06.11.2014 14:46, Martin Kletzander wrote:
On Mon, Nov 03, 2014 at 01:22:07PM +0100, Michal Privoznik wrote:
> As of b6d4dad1 (1.2.5) libvirt keeps track if domain disks have been
> frozen. However, this falls into that set of information which don't
> survive domain restart. Therefore, we need to clear the flag upon some
> state transitions. Moreover, once we clear the flag we must update the
> status file too.
>
> Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
> ---
> src/qemu/qemu_driver.c | 10 +++++-----
> src/qemu/qemu_process.c | 10 ++++++++++
> 2 files changed, 15 insertions(+), 5 deletions(-)
>
[...]
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index ba8ba82..0df375c 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -536,12 +537,20 @@ qemuProcessHandleReset(qemuMonitorPtr mon
> ATTRIBUTE_UNUSED,
> priv = vm->privateData;
> if (priv->agent)
> qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET);
> + /* Clear some domain runtime information. For instance,
> + * fsfreeze won't survive domain reset. This, however,
> + * required the domain status file to be rewritten onto disk. */
> + priv->quiesced = false;
>
> virObjectUnlock(vm);
>
> + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
> + VIR_WARN("Failed to save status on vm %s", vm->def->name);
> +
The domain has to be locked when you're saving it, ACK if you move
these two lines before the virObjectUnlock(vm) call.
Yeah, I wanted to make the critical section as short as possible, but
hadn't realized VM definition can change once the domain's unlocked. So
SaveStatus() can access stale pointers then what can lead to SIGSEGV.
Fixed and pushed, thanks.
Michal