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(a)redhat.com>
---
src/network/bridge_driver.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 522ccc2..f2026fb 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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:
--
2.0.5