From: Stefan Berger Date: Tue, 4 Jun 2013 18:50:20 +0000 (-0400) Subject: nwfilter: grab driver lock earlier during init (bz96649) X-Git-Tag: v1.0.5.2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12f18158c7b53bf4937ec4fae4877372ef6a9e5d;p=thirdparty%2Flibvirt.git 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 This is a 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 double-locking. (cherry picked from commit 0ec376c20a42b9eb365c1f9a5596366023c20c35) --- diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 789280785b..8f73d3b570 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -190,6 +190,8 @@ nwfilterStateInitialize(bool privileged, if (!privileged) return 0; + nwfilterDriverLock(driverState); + if (virNWFilterIPAddrMapInit() < 0) goto err_free_driverstate; if (virNWFilterLearnInit() < 0) @@ -202,8 +204,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 @@ -315,16 +315,10 @@ nwfilterStateReload(void) { bool virNWFilterDriverIsWatchingFirewallD(void) { - bool ret; - if (!driverState) return false; - nwfilterDriverLock(driverState); - ret = driverState->watchingFirewallD; - nwfilterDriverUnlock(driverState); - - return ret; + return driverState->watchingFirewallD; } /**