Skip to content

Fix false assertion in dmu_tx_dirty_buf() on cloning #16825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

amotin
Copy link
Member

@amotin amotin commented Dec 1, 2024

Same as writes block cloning can increase block size and number of indirection levels. That means it can dirty block 0 at level 0 or at new top indirection level without explicitly holding them.

How Has This Been Tested?

Thanks to @ixhamza this reproduction was found and now addressed:

truncate -s 1G /tmp/file_vdev
zpool create tank /tmp/file_vdev -O mountpoint=/mnt/tank
zfs create -o recordsize=128k tank/src
zfs create -o recordsize=128k tank/dst
# Write 1024 blocks
dd if=/dev/urandom of=/mnt/tank/src/f1 bs=128k count=1024 oflag=direct
zpool sync
# Clone 1024 blocks at 1024 block offset
/usr/share/zfs/zfs-tests/bin/clonefile -f /mnt/tank/src/f1 /mnt/tank/dst/f1_clone 0 134217728 134217728

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)
  • 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:

Same as writes block cloning can increase block size and number of
indirection levels.  That means it can dirty block 0 at level 0 or
at new top indirection level without explicitly holding them.

Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
@amotin amotin added the Status: Code Review Needed Ready for review and testing label Dec 1, 2024
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.

Oh, that's subtle. Nice.

Worth a test case, since you've got the steps right there?

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Ah, good find.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Dec 3, 2024
@amotin
Copy link
Member Author

amotin commented Dec 3, 2024

Thanks @ixhamza for the test. Included.

@github-actions github-actions bot removed the Status: Accepted Ready to integrate (reviewed, tested) label Dec 3, 2024
@amotin amotin added Status: Accepted Ready to integrate (reviewed, tested) Status: Work in Progress Not yet ready for general review labels Dec 3, 2024
@amotin amotin removed the Status: Work in Progress Not yet ready for general review label Dec 4, 2024
@github-actions github-actions bot removed the Status: Accepted Ready to integrate (reviewed, tested) label Dec 4, 2024
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Dec 4, 2024
@amotin amotin added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Dec 4, 2024
@behlendorf behlendorf merged commit e8b333e into openzfs:master Dec 5, 2024
24 checks passed
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Dec 5, 2024
Same as writes block cloning can increase block size and number of
indirection levels.  That means it can dirty block 0 at level 0 or
at new top indirection level without explicitly holding them.

A block cloning test case for large offsets has been added.

Reviewed-by: Rob Norris <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Co-authored-by: Ameer Hamza <[email protected]>
Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
Closes openzfs#16825
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Jan 26, 2025
Same as writes block cloning can increase block size and number of
indirection levels.  That means it can dirty block 0 at level 0 or
at new top indirection level without explicitly holding them.

A block cloning test case for large offsets has been added.

Reviewed-by: Rob Norris <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Co-authored-by: Ameer Hamza <[email protected]>
Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
Closes openzfs#16825
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants