[libvirt] [PATCH v3 1/5] nwfilter: Add update locking to Initialization

John Ferlan jferlan at redhat.com
Thu Oct 5 23:32:27 UTC 2017


If libvirtd is restarted, let's be sure to block any odd attempts to
update the nwfilters or allow any sort of callbacks from running guests
until all the objects are populated.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/nwfilter/nwfilter_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 2f9a51c405..06d5847ca7 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -244,18 +244,24 @@ nwfilterStateInitialize(bool privileged,
         goto error;
     }
 
+    virNWFilterWriteLockFilterUpdates();
+    virNWFilterCallbackDriversLock();
     if (!(driver->nwfilters = virNWFilterObjListNew()))
         goto error;
 
     if (virNWFilterObjListLoadAllConfigs(driver->nwfilters, driver->configDir) < 0)
         goto error;
 
+    virNWFilterCallbackDriversUnlock();
+    virNWFilterUnlockFilterUpdates();
     nwfilterDriverUnlock();
 
     return 0;
 
  error:
     VIR_FREE(base);
+    virNWFilterCallbackDriversUnlock();
+    virNWFilterUnlockFilterUpdates();
     nwfilterDriverUnlock();
     nwfilterStateCleanup();
 
-- 
2.13.6




More information about the libvir-list mailing list