[PATCH 2/4] admin: Remove unnecessary @conn object locking

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

 



The only place we change the @conn object is actually virAdmConnectOpen
routine, thus at the moment we don't really need to lock it, given the fact that
what we're trying to do here is to change the closeCallback object which is a
lockable object itself, so that should be enough to avoid races.

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 src/libvirt-admin.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
index 88eef54..1b5fd44 100644
--- a/src/libvirt-admin.c
+++ b/src/libvirt-admin.c
@@ -465,7 +465,6 @@ int virAdmConnectRegisterCloseCallback(virAdmConnectPtr conn,
 
     virObjectRef(conn);
 
-    virObjectLock(conn);
     virObjectLock(conn->closeCallback);
 
     virCheckNonNullArgGoto(cb, error);
@@ -482,13 +481,11 @@ int virAdmConnectRegisterCloseCallback(virAdmConnectPtr conn,
     conn->closeCallback->freeCallback = freecb;
 
     virObjectUnlock(conn->closeCallback);
-    virObjectUnlock(conn);
 
     return 0;
 
  error:
     virObjectUnlock(conn->closeCallback);
-    virObjectUnlock(conn);
     virDispatchError(NULL);
     virObjectUnref(conn);
     return -1;
@@ -517,7 +514,6 @@ int virAdmConnectUnregisterCloseCallback(virAdmConnectPtr conn,
 
     virCheckAdmConnectReturn(conn, -1);
 
-    virObjectLock(conn);
     virObjectLock(conn->closeCallback);
 
     virCheckNonNullArgGoto(cb, error);
@@ -534,14 +530,12 @@ int virAdmConnectUnregisterCloseCallback(virAdmConnectPtr conn,
     conn->closeCallback->freeCallback = NULL;
 
     virObjectUnlock(conn->closeCallback);
-    virObjectUnlock(conn);
     virObjectUnref(conn);
 
     return 0;
 
  error:
     virObjectUnlock(conn->closeCallback);
-    virObjectUnlock(conn);
     virDispatchError(NULL);
     return -1;
 }
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]