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

John Ferlan posted 5 patches 8 years, 4 months ago
There is a newer version of this series
[libvirt] [PATCH v3 1/5] nwfilter: Add update locking to Initialization
Posted by John Ferlan 8 years, 4 months ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list