From a4978d260580d85491eee2ecb2435f56a7d4e50c 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 19b0d61f09..d81199765c 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -8041,6 +8041,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. */