Call shutdown functions for all subcompontents in nwfilterDriverShutdown. Make sure that this shutdown functions can safely be called multiple times and independent from the actual subcompontents state. --- src/conf/nwfilter_conf.c | 8 ++++++++ src/nwfilter/nwfilter_driver.c | 2 ++ src/nwfilter/nwfilter_learnipaddr.c | 5 ++++- 3 files changed, 14 insertions(+), 1 deletions(-) diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 09dc32b..615c0f1 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -125,6 +125,7 @@ struct int_map { * only one filter update allowed */ static virMutex updateMutex; +static bool initialized = false; void virNWFilterLockFilterUpdates(void) { @@ -2971,6 +2972,8 @@ int virNWFilterConfLayerInit(virHashIterator domUpdateCB) { virNWFilterDomainFWUpdateCB = domUpdateCB; + initialized = true; + if (virMutexInitRecursive(&updateMutex)) return 1; @@ -2980,7 +2983,12 @@ int virNWFilterConfLayerInit(virHashIterator domUpdateCB) void virNWFilterConfLayerShutdown(void) { + if (!initialized) + return; + virMutexDestroy(&updateMutex); + + initialized = false; } diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index a579306..8af3f8a 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -199,6 +199,8 @@ nwfilterDriverShutdown(void) { if (!driverState) return -1; + virNWFilterConfLayerShutdown(); + virNWFilterTechDriversShutdown(); virNWFilterLearnShutdown(); nwfilterDriverLock(driverState); diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 9ee439a..96d2a55 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -873,7 +873,10 @@ virNWFilterLearnThreadsTerminate(bool allowNewThreads) { * Shutdown of this layer */ void -virNWFilterLearnShutdown(void) { +virNWFilterLearnShutdown(void) +{ + if (!pendingLearnReq) + return; virNWFilterLearnThreadsTerminate(false); -- 1.7.0.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list