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

[libvirt] [PATCH v2] nwfilter: grab driver lock earlier during init (bz96649)



This patch is in _relation_ to Bug 966449:

https://bugzilla.redhat.com/show_bug.cgi?id=966449

Below is a possible patch addressing the coredump.

Thread 1 must be calling  nwfilterDriverRemoveDBusMatches(). It does so with
nwfilterDriverLock held. In the patch below I am now moving the
nwfilterDriverLock(driverState) further up so that the initialization, which
seems to either take a long time or is entirely stuck, occurs with the lock
held and the shutdown cannot occur at the same time. 

Remove the lock in virNWFilterDriverIsWatchingFirewallD to avoid trying to
lock the same lock again.

---
 src/nwfilter/nwfilter_driver.c |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Index: libvirt/src/nwfilter/nwfilter_driver.c
===================================================================
--- libvirt.orig/src/nwfilter/nwfilter_driver.c
+++ libvirt/src/nwfilter/nwfilter_driver.c
@@ -191,6 +191,8 @@ nwfilterStateInitialize(bool privileged,
     if (!privileged)
         return 0;
 
+    nwfilterDriverLock(driverState);
+
     if (virNWFilterIPAddrMapInit() < 0)
         goto err_free_driverstate;
     if (virNWFilterLearnInit() < 0)
@@ -203,8 +205,6 @@ nwfilterStateInitialize(bool privileged,
     if (virNWFilterConfLayerInit(virNWFilterDomainFWUpdateCB) < 0)
         goto err_techdrivers_shutdown;
 
-    nwfilterDriverLock(driverState);
-
     /*
      * startup the DBus late so we don't get a reload signal while
      * initializing
@@ -316,16 +316,10 @@ nwfilterStateReload(void) {
 bool
 virNWFilterDriverIsWatchingFirewallD(void)
 {
-    bool ret;
-
     if (!driverState)
         return false;
 
-    nwfilterDriverLock(driverState);
-    ret = driverState->watchingFirewallD;
-    nwfilterDriverUnlock(driverState);
-
-    return ret;
+    return driverState->watchingFirewallD;
 }
 
 /**


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