[libvirt] [PATCH 9/9] storage: Fix deadlock when cloning across pools.

Cole Robinson crobinso at redhat.com
Fri Jul 10 20:47:06 UTC 2009


We need to unlock the first pool before looking up the second, since the
search locks every pool it checks.
---
 src/storage_driver.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/storage_driver.c b/src/storage_driver.c
index c27534c..e9ecb20 100644
--- a/src/storage_driver.c
+++ b/src/storage_driver.c
@@ -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);
 
-- 
1.6.0.6




More information about the libvir-list mailing list