Fix data loss on writes larger than the tape block size#607
Open
matejk wants to merge 1 commit into
Open
Conversation
_unified_insert_new_request copies at most one cache block (the tape block size) but returned the full requested count, so the append loop in unified_write advanced past data that was never stored. Writes larger than the block size silently lost everything after the first block while reporting success. Latent with libfuse 2, which caps requests at 128 KiB, below the default 512 KiB block; reachable today through the I/O scheduler API and triggered by FUSE 3 request sizes. Return the number of bytes actually stored. A regression test (multi-block single writes of random data, content verified) accompanies the integration test suite. Fixes LinearTapeFileSystem#591
This was referenced Jun 12, 2026
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.
_unified_insert_new_requestin the unified I/O scheduler copies at most one tape block of an incoming write into the new request, but reports the full count as written. Any singlewrite()larger than the tape block size is silently truncated to one block — a 1 MiB write with the default 512 KiB block size stores exactly 524288 bytes while the application sees success.One commit, 5 lines: cap the reported count at what was actually queued, so the caller loops over the remainder.
This matches the corruption reported in #591. A regression test that verifies the content of multi-block single writes ships with the integration test-suite PR (#611,
t/13-large-write-integrity.sh).Note: #603 (FUSE 3) includes this same commit, because FUSE 3's 1 MiB requests expose the bug in the default configuration; git drops the duplicate whichever PR merges first.
Fixes #591.