diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index b04b220c76..d6e3c58069 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -7509,6 +7509,19 @@ mos_leak_log_spacemaps(spa_t *spa) mos_obj_refd(sls->sls_sm_obj); } +static void +errorlog_count_refd(objset_t *mos, uint64_t errlog) +{ + zap_cursor_t zc; + zap_attribute_t za; + for (zap_cursor_init(&zc, mos, errlog); + zap_cursor_retrieve(&zc, &za) == 0; + zap_cursor_advance(&zc)) { + mos_obj_refd(za.za_first_integer); + } + zap_cursor_fini(&zc); +} + static int dump_mos_leaks(spa_t *spa) { @@ -7529,6 +7542,12 @@ dump_mos_leaks(spa_t *spa) mos_obj_refd(spa->spa_history); mos_obj_refd(spa->spa_errlog_last); mos_obj_refd(spa->spa_errlog_scrub); + + if (!spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) { + errorlog_count_refd(mos, spa->spa_errlog_last); + errorlog_count_refd(mos, spa->spa_errlog_scrub); + } + mos_obj_refd(spa->spa_all_vdev_zaps); mos_obj_refd(spa->spa_dsl_pool->dp_bptree_obj); mos_obj_refd(spa->spa_dsl_pool->dp_tmp_userrefs_obj);