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

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



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


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