[PATCH 2/6] ch_driver: Don't lock driver when looking up domains

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

 



There is no need to lock whole driver when accessing
virDomainObjList. Those APIs were specifically tailored to be
thread safe (when we were dropping QEMU driver lock). Don't
resurrect old history.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/ch/ch_driver.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 7c3b45ca2f..2ed33c3446 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -363,11 +363,9 @@ chDomainUndefine(virDomainPtr dom)
 
 static int chDomainIsActive(virDomainPtr dom)
 {
-    virCHDriver *driver = dom->conn->privateData;
     virDomainObj *vm;
     int ret = -1;
 
-    chDriverLock(driver);
     if (!(vm = virCHDomainObjFromDomain(dom)))
         goto cleanup;
 
@@ -378,7 +376,6 @@ static int chDomainIsActive(virDomainPtr dom)
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    chDriverUnlock(driver);
     return ret;
 }
 
@@ -636,9 +633,7 @@ static virDomainPtr chDomainLookupByID(virConnectPtr conn,
     virDomainObj *vm;
     virDomainPtr dom = NULL;
 
-    chDriverLock(driver);
     vm = virDomainObjListFindByID(driver->domains, id);
-    chDriverUnlock(driver);
 
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -663,9 +658,7 @@ static virDomainPtr chDomainLookupByName(virConnectPtr conn,
     virDomainObj *vm;
     virDomainPtr dom = NULL;
 
-    chDriverLock(driver);
     vm = virDomainObjListFindByName(driver->domains, name);
-    chDriverUnlock(driver);
 
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -690,9 +683,7 @@ static virDomainPtr chDomainLookupByUUID(virConnectPtr conn,
     virDomainObj *vm;
     virDomainPtr dom = NULL;
 
-    chDriverLock(driver);
     vm = virDomainObjListFindByUUID(driver->domains, uuid);
-    chDriverUnlock(driver);
 
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
-- 
2.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux