Fix ddtprune causing space leak

In zio_ddt_free, if a pruned dde is still in ddt, it would do nothing
and cause space leak.

Reviewed-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #17982
Closes #17983
This commit is contained in:
Chunwei Chen
2025-12-10 10:02:14 -08:00
committed by Brian Behlendorf
parent 206487b9b1
commit 028d66b9dd
4 changed files with 100 additions and 1 deletions
+11
View File
@@ -4157,6 +4157,17 @@ zio_ddt_free(zio_t *zio)
ddt_phys_variant_t v = ddt_phys_select(ddt, dde, bp);
if (v != DDT_PHYS_NONE)
ddt_phys_decref(dde->dde_phys, v);
else
/*
* If the entry was found but the phys was not, then
* this block must have been pruned from the dedup
* table, and the entry refers to a later version of
* this data. Therefore, the caller is trying to delete
* the only stored instance of this block, and so we
* need to do a normal (not dedup) free. Clear dde so
* we fall into the block below.
*/
dde = NULL;
}
ddt_exit(ddt);