Skip to content

Fix reads for blocks freed after being cloned#18724

Open
amotin wants to merge 1 commit into
openzfs:masterfrom
amotin:clone_trunc
Open

Fix reads for blocks freed after being cloned#18724
amotin wants to merge 1 commit into
openzfs:masterfrom
amotin:clone_trunc

Conversation

@amotin

@amotin amotin commented Jul 1, 2026

Copy link
Copy Markdown
Member

PR #18421 fixed a case when reads for blocks cloned after being freed could return zeroes. But it created an opposite problem, when reads for blocks freed after being cloned could return non- zero content from the cloning.

This patch should fix the problem by creating a more specialized form of dnode_block_freed(), taking into account the TXG when the cloning has happened and checking frees only in TXGs after.

Fixes: #18421

How Has This Been Tested?

Not really.

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:

@amotin amotin added the Status: Code Review Needed Ready for review and testing label Jul 1, 2026
Comment thread module/zfs/dbuf.c Outdated
PR openzfs#18421 fixed a case when reads for blocks cloned after being
freed could return zeroes.  But it created an opposite problem,
when reads for blocks freed after being cloned could return non-
zero content from the cloning.

This patch should fix the problem by creating a more specialized
form of dnode_block_freed(), taking into account the TXG when
the cloning has happened and checking frees only in TXGs after.

Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com>
Fixes: openzfs#18421
@nbdd0121

nbdd0121 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Do you have a test program so that I can run some red/green testing?

@behlendorf behlendorf self-requested a review July 2, 2026 16:35
@amotin

amotin commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Do you have a test program so that I can run some red/green testing?

No, I don't. I wonder if you could invert your test or make it bidirectional.

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

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants