]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Fix deadlock when cloning across pools.
authorCole Robinson <crobinso@redhat.com>
Fri, 10 Jul 2009 16:56:12 +0000 (12:56 -0400)
committerCole Robinson <crobinso@redhat.com>
Thu, 16 Jul 2009 16:52:52 +0000 (12:52 -0400)
We need to unlock the first pool before looking up the second, since the
search locks every pool it checks.

src/storage_driver.c

index c27534c9865279bc403c7339b1a3bad8930d7c5c..e9ecb20413fe1da0aa42ba79c95c30342c6a1171 100644 (file)
@@ -1327,9 +1327,11 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
 
     storageDriverLock(driver);
     pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
-    if (diffpool)
+    if (diffpool) {
+        virStoragePoolObjUnlock(pool);
         origpool = virStoragePoolObjFindByName(&driver->pools, vobj->pool);
-    else
+        virStoragePoolObjLock(pool);
+    } else
         origpool = pool;
     storageDriverUnlock(driver);