[libvirt PATCH v2 09/10] storage: Removing mutex locking in initialization and cleanup

Tim Wiederhake twiederh at redhat.com
Fri Mar 4 17:28:39 UTC 2022


These functions are only ever called in a single threaded
environment and the mutex would not have prevented concurrent
access anyway.

Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/storage/storage_driver.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 97e0d9b3a0..ee710f6b76 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -274,7 +274,6 @@ storageStateInitialize(bool privileged,
         VIR_FREE(driver);
         return VIR_DRV_STATE_INIT_ERROR;
     }
-    storageDriverLock();
 
     if (!(driver->pools = virStoragePoolObjListNew()))
         goto error;
@@ -330,12 +329,9 @@ storageStateInitialize(bool privileged,
     if (!(driver->caps = virStorageBackendGetCapabilities()))
         goto error;
 
-    storageDriverUnlock();
-
     return VIR_DRV_STATE_INIT_COMPLETE;
 
  error:
-    storageDriverUnlock();
     storageStateCleanup();
     return VIR_DRV_STATE_INIT_ERROR;
 }
@@ -376,8 +372,6 @@ storageStateCleanup(void)
     if (!driver)
         return -1;
 
-    storageDriverLock();
-
     virObjectUnref(driver->caps);
     virObjectUnref(driver->storageEventState);
 
@@ -391,7 +385,6 @@ storageStateCleanup(void)
     VIR_FREE(driver->configDir);
     VIR_FREE(driver->autostartDir);
     VIR_FREE(driver->stateDir);
-    storageDriverUnlock();
     virMutexDestroy(&driver->lock);
     VIR_FREE(driver);
 
-- 
2.31.1




More information about the libvir-list mailing list