Skip to content

Commit 63b33e8

Browse files
Justin T. Gibbsbehlendorf
authored andcommitted
Illumos 5562 - ZFS sa_handle's violate kmem invariants, debug kernels panic on boot
5562 ZFS sa_handle's violate kmem invariants, debug kernels panic on 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> References: https://www.illumos.org/issues/5562 illumos/illumos-gate@0fda3cc5 Ported-by: DHE <git@dehacked.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3388
1 parent 252e1a5 commit 63b33e8

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

module/zfs/sa.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,6 @@ sa_cache_constructor(void *buf, void *unused, int kmflag)
210210
{
211211
sa_handle_t *hdl = buf;
212212

213-
hdl->sa_dbu.dbu_evict_func = NULL;
214-
hdl->sa_bonus_tab = NULL;
215-
hdl->sa_spill_tab = NULL;
216-
hdl->sa_os = NULL;
217-
hdl->sa_userp = NULL;
218-
hdl->sa_bonus = NULL;
219-
hdl->sa_spill = NULL;
220213
mutex_init(&hdl->sa_lock, NULL, MUTEX_DEFAULT, NULL);
221214
return (0);
222215
}
@@ -226,7 +219,6 @@ static void
226219
sa_cache_destructor(void *buf, void *unused)
227220
{
228221
sa_handle_t *hdl = buf;
229-
hdl->sa_dbu.dbu_evict_func = NULL;
230222
mutex_destroy(&hdl->sa_lock);
231223
}
232224

@@ -1369,14 +1361,11 @@ sa_handle_destroy(sa_handle_t *hdl)
13691361
mutex_enter(&hdl->sa_lock);
13701362
(void) dmu_buf_remove_user(db, &hdl->sa_dbu);
13711363

1372-
if (hdl->sa_bonus_tab) {
1364+
if (hdl->sa_bonus_tab)
13731365
sa_idx_tab_rele(hdl->sa_os, hdl->sa_bonus_tab);
1374-
hdl->sa_bonus_tab = NULL;
1375-
}
1376-
if (hdl->sa_spill_tab) {
1366+
1367+
if (hdl->sa_spill_tab)
13771368
sa_idx_tab_rele(hdl->sa_os, hdl->sa_spill_tab);
1378-
hdl->sa_spill_tab = NULL;
1379-
}
13801369

13811370
dmu_buf_rele(hdl->sa_bonus, NULL);
13821371

@@ -1410,10 +1399,13 @@ sa_handle_get_from_db(objset_t *os, dmu_buf_t *db, void *userp,
14101399
sa_handle_t *winner = NULL;
14111400

14121401
handle = kmem_cache_alloc(sa_cache, KM_SLEEP);
1402+
handle->sa_dbu.dbu_evict_func = NULL;
14131403
handle->sa_userp = userp;
14141404
handle->sa_bonus = db;
14151405
handle->sa_os = os;
14161406
handle->sa_spill = NULL;
1407+
handle->sa_bonus_tab = NULL;
1408+
handle->sa_spill_tab = NULL;
14171409

14181410
error = sa_build_index(handle, SA_BONUS);
14191411

0 commit comments

Comments
 (0)