Fix wrong dedup_table_size for legacy dedup

If we call ddt_log_load() for legacy ddt, we will end up going into
ddt_log_update_stats() and filling uninitialized value into ddo_dspace.
This value will then get added to dedup_table_size during
ddt_get_dedup_object_stats().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Closes #17019
Closes #17699

Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Co-authored-by: Chunwei Chen <david.chen@nutanix.com>
This commit is contained in:
Chunwei Chen
2025-09-08 14:02:51 -07:00
committed by Brian Behlendorf
parent 34ca2b8392
commit c755aa486d
2 changed files with 12 additions and 8 deletions
+5 -3
View File
@@ -1701,9 +1701,11 @@ ddt_load(spa_t *spa)
}
}
error = ddt_log_load(ddt);
if (error != 0 && error != ENOENT)
return (error);
if (ddt->ddt_flags & DDT_FLAG_LOG) {
error = ddt_log_load(ddt);
if (error != 0 && error != ENOENT)
return (error);
}
DDT_KSTAT_SET(ddt, dds_log_active_entries,
avl_numnodes(&ddt->ddt_log_active->ddl_tree));