Skip to content

Conversation

@tuxoko
Copy link
Contributor

@tuxoko tuxoko commented Nov 27, 2025

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

Fixes #17982

Motivation and Context

Description

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

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 <david.chen@nutanix.com>
Fixes openzfs#17982
Copy link
Member

@robn robn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, very subtle. Took me a while to remember it and understand what was happening, so I've suggested a bit more commentary to explain it. Thank you!

if (v != DDT_PHYS_NONE)
ddt_phys_decref(dde->dde_phys, v);
else
/* dde was pruned */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* dde was pruned */
/*
* 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.
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ddtprune seems to cause space leak

3 participants