Add missing *_destroy/*_fini calls

The proposed debugging enhancements in zfsonlinux/spl#587
identified the following missing *_destroy/*_fini calls.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Gvozden Neskovic <neskovic@gmail.com>
Closes #5428
This commit is contained in:
Gvozden Neskovic
2016-11-26 21:30:44 +01:00
committed by Brian Behlendorf
parent 8fa5250f5d
commit c17486b217
13 changed files with 68 additions and 11 deletions
+15 -1
View File
@@ -140,7 +140,21 @@ kcf_mech_hash_find(char *mechname)
void
kcf_destroy_mech_tabs(void)
{
if (kcf_mech_hash) mod_hash_destroy_hash(kcf_mech_hash);
int i, max;
kcf_ops_class_t class;
kcf_mech_entry_t *me_tab;
if (kcf_mech_hash)
mod_hash_destroy_hash(kcf_mech_hash);
mutex_destroy(&kcf_mech_tabs_lock);
for (class = KCF_FIRST_OPSCLASS; class <= KCF_LAST_OPSCLASS; class++) {
max = kcf_mech_tabs_tab[class].met_size;
me_tab = kcf_mech_tabs_tab[class].met_tab;
for (i = 0; i < max; i++)
mutex_destroy(&(me_tab[i].me_mutex));
}
}
/*
+6
View File
@@ -67,6 +67,8 @@ static uint_t prov_tab_max = KCF_MAX_PROVIDERS;
void
kcf_prov_tab_destroy(void)
{
mutex_destroy(&prov_tab_mutex);
if (prov_tab)
kmem_free(prov_tab, prov_tab_max *
sizeof (kcf_provider_desc_t *));
@@ -485,6 +487,10 @@ kcf_free_provider_desc(kcf_provider_desc_t *desc)
if (desc->pd_sched_info.ks_taskq != NULL)
taskq_destroy(desc->pd_sched_info.ks_taskq);
mutex_destroy(&desc->pd_lock);
cv_destroy(&desc->pd_resume_cv);
cv_destroy(&desc->pd_remove_cv);
kmem_free(desc, sizeof (kcf_provider_desc_t));
}
+21 -7
View File
@@ -1056,17 +1056,28 @@ kcf_sched_destroy(void)
if (kcf_misc_kstat)
kstat_delete(kcf_misc_kstat);
if (kcfpool)
kmem_free(kcfpool, sizeof (kcf_pool_t));
if (kcfpool) {
mutex_destroy(&kcfpool->kp_thread_lock);
cv_destroy(&kcfpool->kp_nothr_cv);
mutex_destroy(&kcfpool->kp_user_lock);
cv_destroy(&kcfpool->kp_user_cv);
for (i = 0; i < REQID_TABLES; i++) {
if (kcf_reqid_table[i])
kmem_free(kcf_reqid_table[i],
sizeof (kcf_reqid_table_t));
kmem_free(kcfpool, sizeof (kcf_pool_t));
}
if (gswq)
for (i = 0; i < REQID_TABLES; i++) {
if (kcf_reqid_table[i]) {
mutex_destroy(&(kcf_reqid_table[i]->rt_lock));
kmem_free(kcf_reqid_table[i],
sizeof (kcf_reqid_table_t));
}
}
if (gswq) {
mutex_destroy(&gswq->gs_lock);
cv_destroy(&gswq->gs_cv);
kmem_free(gswq, sizeof (kcf_global_swq_t));
}
if (kcf_context_cache)
kmem_cache_destroy(kcf_context_cache);
@@ -1074,6 +1085,9 @@ kcf_sched_destroy(void)
kmem_cache_destroy(kcf_areq_cache);
if (kcf_sreq_cache)
kmem_cache_destroy(kcf_sreq_cache);
mutex_destroy(&ntfy_list_lock);
cv_destroy(&ntfy_list_cv);
}
/*