[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Fix some locking issues



* src/conf/domain_conf.c: don't call virDomainObjUnlock twice
* src/qemu/qemu_driver.c: relock driver lock if an error occurs in
  qemuDomainObjBeginJobWithDriver, enter/exit monitor with driver
  in qemudDomainSave
---
 src/conf/domain_conf.c |    1 -
 src/qemu/qemu_driver.c |    9 +++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e9f79b7..21d509d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5230,7 +5230,6 @@ virDomainObjIsDuplicate(virDomainObjListPtr doms,
         }
 
         dupVM = 1;
-        virDomainObjUnlock(vm);
     } else {
         /* UUID does not match, but if a name matches, refuse it */
         vm = virDomainFindByName(doms, def->name);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bf4557e..2a63de9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -353,6 +353,7 @@ static int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
             else
                 virReportSystemError(NULL, errno,
                                      "%s", _("cannot acquire job mutex"));
+            qemuDriverLock(driver);
             return -1;
         }
     }
@@ -3612,9 +3613,9 @@ static int qemudDomainSave(virDomainPtr dom,
     if (header.compressed == QEMUD_SAVE_FORMAT_RAW) {
         const char *args[] = { "cat", NULL };
         qemuDomainObjPrivatePtr priv = vm->privateData;
-        qemuDomainObjEnterMonitor(vm);
+        qemuDomainObjEnterMonitorWithDriver(driver, vm);
         rc = qemuMonitorMigrateToCommand(priv->mon, 0, args, path);
-        qemuDomainObjExitMonitor(vm);
+        qemuDomainObjExitMonitorWithDriver(driver, vm);
     } else {
         const char *prog = qemudSaveCompressionTypeToString(header.compressed);
         qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -3623,9 +3624,9 @@ static int qemudDomainSave(virDomainPtr dom,
             "-c",
             NULL
         };
-        qemuDomainObjEnterMonitor(vm);
+        qemuDomainObjEnterMonitorWithDriver(driver, vm);
         rc = qemuMonitorMigrateToCommand(priv->mon, 0, args, path);
-        qemuDomainObjExitMonitor(vm);
+        qemuDomainObjExitMonitorWithDriver(driver, vm);
     }
 
     if (rc < 0)
-- 
1.6.0.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]