Skip to content

Commit b9d0dff

Browse files
committed
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. Signed-off-by: Chunwei Chen <[email protected]> Fixes #17982
1 parent 7f7d493 commit b9d0dff

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

module/zfs/zio.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4111,6 +4111,17 @@ zio_ddt_free(zio_t *zio)
41114111
ddt_phys_variant_t v = ddt_phys_select(ddt, dde, bp);
41124112
if (v != DDT_PHYS_NONE)
41134113
ddt_phys_decref(dde->dde_phys, v);
4114+
else
4115+
/*
4116+
* If the entry was found but the phys was not, then
4117+
* this block must have been pruned from the dedup
4118+
* table, and the entry refers to a later version of
4119+
* this data. Therefore, the caller is trying to delete
4120+
* the only stored instance of this block, and so we
4121+
* need to do a normal (not dedup) free. Clear dde so
4122+
* we fall into the block below.
4123+
*/
4124+
dde = NULL;
41144125
}
41154126
ddt_exit(ddt);
41164127

0 commit comments

Comments
 (0)