summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Beutner <[email protected]>2011-10-11 09:59:02 -0700
committerBrian Behlendorf <[email protected]>2011-10-11 09:59:19 -0700
commit64c075c3f4381df02d206008b94498248cc49324 (patch)
tree3da8bdf5d574f1086273da179b4d40810f9005bd
parent763b2f3b57af1febb0fd72c4976992e672a350b4 (diff)
Properly destroy work items in spl_kmem_cache_destroy()
In a non-debug build the ASSERT() would be optimized away which could cause pending work items to not be cancelled. We must also use cancel_delayed_work_sync() rather than just cancel_delayed_work() to actually wait until work items have completed. Otherwise they might accidentally access free'd memory. Signed-off-by: Brian Behlendorf <[email protected]> Closes ZFS bugs #279, #62, #363, #418
-rw-r--r--module/spl/spl-kmem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
index d71ab11bb..a916f7ef0 100644
--- a/module/spl/spl-kmem.c
+++ b/module/spl/spl-kmem.c
@@ -1491,10 +1491,10 @@ spl_kmem_cache_destroy(spl_kmem_cache_t *skc)
up_write(&spl_kmem_cache_sem);
/* Cancel any and wait for any pending delayed work */
- ASSERT(!test_and_set_bit(KMC_BIT_DESTROY, &skc->skc_flags));
- cancel_delayed_work(&skc->skc_work);
+ VERIFY(!test_and_set_bit(KMC_BIT_DESTROY, &skc->skc_flags));
+ cancel_delayed_work_sync(&skc->skc_work);
for_each_online_cpu(i)
- cancel_delayed_work(&skc->skc_mag[i]->skm_work);
+ cancel_delayed_work_sync(&skc->skc_mag[i]->skm_work);
flush_scheduled_work();