Skip to content

Commit

Permalink
4975 missing mutex_destroy() calls in zfs
Browse files Browse the repository at this point in the history
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: Rich Lowe <[email protected]>
Reviewed by: Seth Nimbosa <[email protected]>
Reviewed by: Dan McDonald <[email protected]>
Reviewed by: Don Brady <[email protected]>
Approved by: Dan McDonald <[email protected]>
  • Loading branch information
lundman authored and Christopher Siden committed Jul 15, 2014
1 parent 05b5eb9 commit d2b3cbb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions usr/src/uts/common/fs/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,12 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
if (dr->dt.dl.dr_data != db->db_buf)
VERIFY(arc_buf_remove_ref(dr->dt.dl.dr_data, db));
}

if (db->db_level != 0) {
mutex_destroy(&dr->dt.di.dr_mtx);
list_destroy(&dr->dt.di.dr_children);
}

kmem_free(dr, sizeof (dbuf_dirty_record_t));

ASSERT(db->db_dirtycnt > 0);
Expand Down
5 changes: 5 additions & 0 deletions usr/src/uts/common/fs/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,11 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag,
}
if (winner = dmu_buf_set_user(&db->db, children_dnodes, NULL,
dnode_buf_pageout)) {

for (i = 0; i < epb; i++) {
zrl_destroy(&dnh[i].dnh_zrlock);
}

kmem_free(children_dnodes, sizeof (dnode_children_t) +
(epb - 1) * sizeof (dnode_handle_t));
children_dnodes = winner;
Expand Down
3 changes: 3 additions & 0 deletions usr/src/uts/common/fs/zfs/dnode_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@ dnode_undirty_dbufs(list_t *list)
ASSERT(db->db_blkid == DMU_BONUS_BLKID ||
dr->dt.dl.dr_data == db->db_buf);
dbuf_unoverride(dr);
} else {
mutex_destroy(&dr->dt.di.dr_mtx);
list_destroy(&dr->dt.di.dr_children);
}
kmem_free(dr, sizeof (dbuf_dirty_record_t));
dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg);
Expand Down
3 changes: 3 additions & 0 deletions usr/src/uts/common/fs/zfs/dsl_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ dsl_dataset_evict(dmu_buf_t *db, void *dsv)

mutex_destroy(&ds->ds_lock);
mutex_destroy(&ds->ds_opening_lock);
mutex_destroy(&ds->ds_sendstream_lock);
refcount_destroy(&ds->ds_longholds);

kmem_free(ds, sizeof (dsl_dataset_t));
Expand Down Expand Up @@ -393,6 +394,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, void *tag,
if (err != 0) {
mutex_destroy(&ds->ds_lock);
mutex_destroy(&ds->ds_opening_lock);
mutex_destroy(&ds->ds_sendstream_lock);
refcount_destroy(&ds->ds_longholds);
bplist_destroy(&ds->ds_pending_deadlist);
dsl_deadlist_close(&ds->ds_deadlist);
Expand Down Expand Up @@ -449,6 +451,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, void *tag,
dsl_dir_rele(ds->ds_dir, ds);
mutex_destroy(&ds->ds_lock);
mutex_destroy(&ds->ds_opening_lock);
mutex_destroy(&ds->ds_sendstream_lock);
refcount_destroy(&ds->ds_longholds);
kmem_free(ds, sizeof (dsl_dataset_t));
if (err != 0) {
Expand Down
4 changes: 4 additions & 0 deletions usr/src/uts/common/fs/zfs/sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,9 @@ sa_setup(objset_t *os, uint64_t sa_obj, sa_attr_reg_t *reg_attrs, int count,
if (sa->sa_user_table)
kmem_free(sa->sa_user_table, sa->sa_user_table_sz);
mutex_exit(&sa->sa_lock);
avl_destroy(&sa->sa_layout_hash_tree);
avl_destroy(&sa->sa_layout_num_tree);
mutex_destroy(&sa->sa_lock);
kmem_free(sa, sizeof (sa_os_t));
return ((error == ECKSUM) ? EIO : error);
}
Expand Down Expand Up @@ -1143,6 +1146,7 @@ sa_tear_down(objset_t *os)

avl_destroy(&sa->sa_layout_hash_tree);
avl_destroy(&sa->sa_layout_num_tree);
mutex_destroy(&sa->sa_lock);

kmem_free(sa, sizeof (sa_os_t));
os->os_sa = NULL;
Expand Down

0 comments on commit d2b3cbb

Please sign in to comment.