From: Tim Wiederhake Date: Fri, 4 Mar 2022 12:58:44 +0000 (+0100) Subject: storage: Removing mutex locking in initialization and cleanup X-Git-Tag: v8.2.0-rc1~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69d793a0bce9f838fa3f2b3d3abcc379070c96cd;p=thirdparty%2Flibvirt.git storage: Removing mutex locking in initialization and cleanup 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 Reviewed-by: Michal Privoznik --- 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);