]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
bridge_driver: Don't check network active unlocked
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 23 Feb 2015 18:00:57 +0000 (19:00 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 4 Mar 2015 09:08:07 +0000 (10:08 +0100)
Okay, this is mainly for educational purposes since is called
from single point only with all the possible locks held. So
there's no way for other thread to hop in and do something wrong.
Nevertheless, we should not give bad example.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/network/bridge_driver.c

index 5f02f7fa39023df2fc8c4cef22d25ab21ba35c34..eb42620ccae548c754ea6ed7ee214cbfa28c2ef6 100644 (file)
@@ -353,10 +353,11 @@ networkUpdateAllState(void)
     for (i = 0; i < driver->networks.count; i++) {
         virNetworkObjPtr obj = driver->networks.objs[i];
 
-        if (!obj->active)
-            continue;
-
         virNetworkObjLock(obj);
+        if (!virNetworkObjIsActive(obj)) {
+            virNetworkObjUnlock(obj);
+            continue;
+        }
 
         switch (obj->def->forward.type) {
         case VIR_NETWORK_FORWARD_NONE: