Skip to content

Commit

Permalink
5562 ZFS sa_handle's violate kmem invariants, debug kernels panic on …
Browse files Browse the repository at this point in the history
…boot

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@omniti.com>
  • Loading branch information
Justin T. Gibbs authored and Dan McDonald committed Jan 27, 2015
1 parent f46abf1 commit 0fda3cc
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions usr/src/uts/common/fs/zfs/sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,6 @@ sa_cache_constructor(void *buf, void *unused, int kmflag)
{
sa_handle_t *hdl = buf;

hdl->sa_dbu.dbu_evict_func = NULL;
hdl->sa_bonus_tab = NULL;
hdl->sa_spill_tab = NULL;
hdl->sa_os = NULL;
hdl->sa_userp = NULL;
hdl->sa_bonus = NULL;
hdl->sa_spill = NULL;
mutex_init(&hdl->sa_lock, NULL, MUTEX_DEFAULT, NULL);
return (0);
}
Expand All @@ -227,7 +220,6 @@ static void
sa_cache_destructor(void *buf, void *unused)
{
sa_handle_t *hdl = buf;
hdl->sa_dbu.dbu_evict_func = NULL;
mutex_destroy(&hdl->sa_lock);
}

Expand Down Expand Up @@ -1351,14 +1343,11 @@ sa_handle_destroy(sa_handle_t *hdl)
mutex_enter(&hdl->sa_lock);
(void) dmu_buf_remove_user(db, &hdl->sa_dbu);

if (hdl->sa_bonus_tab) {
if (hdl->sa_bonus_tab)
sa_idx_tab_rele(hdl->sa_os, hdl->sa_bonus_tab);
hdl->sa_bonus_tab = NULL;
}
if (hdl->sa_spill_tab) {

if (hdl->sa_spill_tab)
sa_idx_tab_rele(hdl->sa_os, hdl->sa_spill_tab);
hdl->sa_spill_tab = NULL;
}

dmu_buf_rele(hdl->sa_bonus, NULL);

Expand Down Expand Up @@ -1392,10 +1381,13 @@ sa_handle_get_from_db(objset_t *os, dmu_buf_t *db, void *userp,
sa_handle_t *winner = NULL;

handle = kmem_cache_alloc(sa_cache, KM_SLEEP);
handle->sa_dbu.dbu_evict_func = NULL;
handle->sa_userp = userp;
handle->sa_bonus = db;
handle->sa_os = os;
handle->sa_spill = NULL;
handle->sa_bonus_tab = NULL;
handle->sa_spill_tab = NULL;

error = sa_build_index(handle, SA_BONUS);

Expand Down

0 comments on commit 0fda3cc

Please sign in to comment.