[PATCH 7/8] network: Separate cleanup from networkRemoveInactive

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

 



The new function (networkCleanupInactive) can be called from an iterator
over the list of networks without the risk of deadlock.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/network/bridge_driver.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 3ef3444da241..0e8057e24aed 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -325,10 +325,10 @@ networkDnsmasqConfigFileName(virNetworkDriverConfig *cfg,
 }
 
 
-/* do needed cleanup steps and remove the network from the list */
+/* do needed cleanup steps */
 static int
-networkRemoveInactive(virNetworkDriverState *driver,
-                      virNetworkObj *obj)
+networkCleanupInactive(virNetworkDriverState *driver,
+                       virNetworkObj *obj)
 {
     g_autoptr(virNetworkDriverConfig) cfg = virNetworkDriverGetConfig(driver);
     g_autofree char *leasefile = NULL;
@@ -372,6 +372,18 @@ networkRemoveInactive(virNetworkDriverState *driver,
     /* remove status file */
     unlink(statusfile);
 
+    return 0;
+}
+
+
+/* do needed cleanup steps and remove the network from the list */
+static int
+networkRemoveInactive(virNetworkDriverState *driver,
+                      virNetworkObj *obj)
+{
+    if (networkCleanupInactive(driver, obj) < 0)
+        return -1;
+
     /* remove the network definition */
     virNetworkObjRemoveInactive(driver->networks, obj);
 
-- 
2.46.0




[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