From ac2038a19c3b7e9ba913a850e05ba773725bd25d Mon Sep 17 00:00:00 2001 From: George Amanakis Date: Fri, 3 Feb 2023 00:17:37 +0100 Subject: [PATCH] Teach zdb about DMU_OT_ERROR_LOG objects With the persistent error log feature we need to account for spa_errlog_{scrub, last} containing mappings to other error log objects, which need to be marked as in-use as well. Reviewed-by: Matthew Ahrens Reviewed-by: Brian Behlendorf Signed-off-by: George Amanakis Closes #14442 Closes #14434 --- cmd/zdb/zdb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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);