From a0635ae731735d2ec383396ba57e79ee608f7a54 Mon Sep 17 00:00:00 2001 From: Bi11 Date: Tue, 13 Feb 2024 08:58:47 +0800 Subject: [PATCH] zdb: Fix false leak report for BRT objects Fix a misreport in 'zdb -d' where it falsely marked BRT objects as leaked. Reviewed-by: Brian Behlendorf Reviewed-by: Alexander Motin Signed-off-by: Yuxin Wang Closes #15882 --- cmd/zdb/zdb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index afdc5a2c8b..b857e61bd0 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -7952,6 +7952,17 @@ dump_mos_leaks(spa_t *spa) } } + if (spa->spa_brt != NULL) { + brt_t *brt = spa->spa_brt; + for (uint64_t vdevid = 0; vdevid < brt->brt_nvdevs; vdevid++) { + brt_vdev_t *brtvd = &brt->brt_vdevs[vdevid]; + if (brtvd != NULL && brtvd->bv_initiated) { + mos_obj_refd(brtvd->bv_mos_brtvdev); + mos_obj_refd(brtvd->bv_mos_entries); + } + } + } + /* * Visit all allocated objects and make sure they are referenced. */