diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 0bf0e366a..8c662f6b0 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -2497,11 +2497,12 @@ spa_livelist_delete_cb(void *arg, zthr_t *z) VERIFY0(dsl_get_next_livelist_obj(mos, zap_obj, &ll_obj)); VERIFY0(zap_count(mos, ll_obj, &count)); if (count > 0) { - dsl_deadlist_t ll = { 0 }; + dsl_deadlist_t *ll; dsl_deadlist_entry_t *dle; bplist_t to_free; - dsl_deadlist_open(&ll, mos, ll_obj); - dle = dsl_deadlist_first(&ll); + ll = kmem_zalloc(sizeof (dsl_deadlist_t), KM_SLEEP); + dsl_deadlist_open(ll, mos, ll_obj); + dle = dsl_deadlist_first(ll); ASSERT3P(dle, !=, NULL); bplist_create(&to_free); int err = dsl_process_sub_livelist(&dle->dle_bpobj, &to_free, @@ -2509,7 +2510,7 @@ spa_livelist_delete_cb(void *arg, zthr_t *z) if (err == 0) { sublist_delete_arg_t sync_arg = { .spa = spa, - .ll = &ll, + .ll = ll, .key = dle->dle_mintxg, .to_free = &to_free }; @@ -2524,7 +2525,8 @@ spa_livelist_delete_cb(void *arg, zthr_t *z) } bplist_clear(&to_free); bplist_destroy(&to_free); - dsl_deadlist_close(&ll); + dsl_deadlist_close(ll); + kmem_free(ll, sizeof (dsl_deadlist_t)); } else { livelist_delete_arg_t sync_arg = { .spa = spa,