Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
scan::tests::disk_usage_is_whole_allocation_units,fs::writeperforms asynchronous buffered I/O without flushing dirty pages to storage (fsync).On Copy-on-Write filesystems with delayed allocation (such as OpenZFS), newly written asynchronous blocks remain in dirty transaction groups (TXG) in memory before commit. An immediate
stat()call on the written file reportsst_blocks = 1(accounting only for the inode/bonus buffer, or 512 bytes), causingscan_dirto readtree.bytes = 512and failing the assertion:This caused CI build failures when building packages in environments using ZFS build scratch pools (e.g. NixOS Hydra CI build 347804046).
Changes
fs::writewithFile::create,write_all, followed byfile.sync_all()(fsync).drop(file)before invokingscan_dir.Verification
Verified both locally and inside an isolated NixOS QEMU VM running an OpenZFS pool configured with compression and POSIX ACLs:
sync_all:st_blocks = 1,tree.bytes = 512(panics with 512).sync_all:st_blocks = 197(100,864 bytes), test passes.cargo xtask lintandcargo xtask testpass cleanly.