]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Removing mutex locking in initialization and cleanup
authorTim Wiederhake <twiederh@redhat.com>
Fri, 4 Mar 2022 12:58:44 +0000 (13:58 +0100)
committerTim Wiederhake <twiederh@redhat.com>
Wed, 16 Mar 2022 09:54:39 +0000 (10:54 +0100)
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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/storage/storage_driver.c

index 97e0d9b3a0a1e6e038c67802d2919bacbf069d0a..ee710f6b76de1bbea490a11615d66dcee94afe71 100644 (file)
@@ -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);