From 7b8c12d8ceced498a71afd373f679dacc9f5b87e Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 23 Feb 2015 19:00:57 +0100 Subject: [PATCH] bridge_driver: Don't check network active unlocked 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 --- 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 5f02f7fa39..eb42620cca 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: