[libvirt] [PATCH] Fix locking in qemudDomainCoreDump

The hang fix in d376b7d63ec1ef24ba4c812d58b9a414ddb561f8 was incomplete since it left quite a few {Enter,Exit}Monitor calls which require driver to be unlocked. Since the driver is locked throughout the whole function, {Enter,Exit}MonitorWithDriver need to be used instead to ensure driver is not locked when issuing monitor commands. --- src/qemu/qemu_driver.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4afed2f..0a0d9bc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5165,18 +5165,18 @@ static int qemudDomainCoreDump(virDomainPtr dom, /* Pause domain for non-live dump */ if (!(flags & VIR_DUMP_LIVE) && vm->state == VIR_DOMAIN_RUNNING) { - qemuDomainObjEnterMonitor(vm); + qemuDomainObjEnterMonitorWithDriver(driver, vm); if (qemuMonitorStopCPUs(priv->mon) < 0) { - qemuDomainObjExitMonitor(vm); + qemuDomainObjExitMonitorWithDriver(driver, vm); goto endjob; } - qemuDomainObjExitMonitor(vm); + qemuDomainObjExitMonitorWithDriver(driver, vm); paused = 1; } - qemuDomainObjEnterMonitor(vm); + qemuDomainObjEnterMonitorWithDriver(driver, vm); ret = qemuMonitorMigrateToCommand(priv->mon, 1, args, path); - qemuDomainObjExitMonitor(vm); + qemuDomainObjExitMonitorWithDriver(driver, vm); if (ret < 0) goto endjob; @@ -5205,13 +5205,13 @@ endjob: will support synchronous operations so we always get here after the migration is complete. */ else if (resume && paused) { - qemuDomainObjEnterMonitor(vm); + qemuDomainObjEnterMonitorWithDriver(driver, vm); if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) { if (virGetLastError() == NULL) qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", _("resuming after dump failed")); } - qemuDomainObjExitMonitor(vm); + qemuDomainObjExitMonitorWithDriver(driver, vm); } if (qemuDomainObjEndJob(vm) == 0) -- 1.7.0.4

On Thu, Apr 22, 2010 at 06:37:55PM +0200, Jiri Denemark wrote:
The hang fix in d376b7d63ec1ef24ba4c812d58b9a414ddb561f8 was incomplete since it left quite a few {Enter,Exit}Monitor calls which require driver to be unlocked. Since the driver is locked throughout the whole function, {Enter,Exit}MonitorWithDriver need to be used instead to ensure driver is not locked when issuing monitor commands. --- src/qemu/qemu_driver.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4afed2f..0a0d9bc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5165,18 +5165,18 @@ static int qemudDomainCoreDump(virDomainPtr dom,
/* Pause domain for non-live dump */ if (!(flags & VIR_DUMP_LIVE) && vm->state == VIR_DOMAIN_RUNNING) { - qemuDomainObjEnterMonitor(vm); + qemuDomainObjEnterMonitorWithDriver(driver, vm); if (qemuMonitorStopCPUs(priv->mon) < 0) { - qemuDomainObjExitMonitor(vm); + qemuDomainObjExitMonitorWithDriver(driver, vm); goto endjob; } - qemuDomainObjExitMonitor(vm); + qemuDomainObjExitMonitorWithDriver(driver, vm); paused = 1; }
- qemuDomainObjEnterMonitor(vm); + qemuDomainObjEnterMonitorWithDriver(driver, vm); ret = qemuMonitorMigrateToCommand(priv->mon, 1, args, path); - qemuDomainObjExitMonitor(vm); + qemuDomainObjExitMonitorWithDriver(driver, vm);
if (ret < 0) goto endjob; @@ -5205,13 +5205,13 @@ endjob: will support synchronous operations so we always get here after the migration is complete. */ else if (resume && paused) { - qemuDomainObjEnterMonitor(vm); + qemuDomainObjEnterMonitorWithDriver(driver, vm); if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) { if (virGetLastError() == NULL) qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", _("resuming after dump failed")); } - qemuDomainObjExitMonitor(vm); + qemuDomainObjExitMonitorWithDriver(driver, vm); }
if (qemuDomainObjEndJob(vm) == 0)
Hum, that's the same than Dan already ACK'ed, right ;-) ? Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

The hang fix in d376b7d63ec1ef24ba4c812d58b9a414ddb561f8 was incomplete since it left quite a few {Enter,Exit}Monitor calls which require driver to be unlocked. Since the driver is locked throughout the whole function, {Enter,Exit}MonitorWithDriver need to be used instead to ensure driver is not locked when issuing monitor commands.
Hum, that's the same than Dan already ACK'ed, right ;-) ?
Yeah, sorry about the mess with this patch. I hit 'y' when git send-email asked me to confirm my email address and than got confused and thought the mail didn't make it into the list so I resent it and saw the ack for the original version :-) I'm studying git send-email configuration to avoid this in the future. Jirka
participants (2)
-
Daniel Veillard
-
Jiri Denemark