Skip to content

Fix data loss on writes larger than the tape block size#607

Open
matejk wants to merge 1 commit into
LinearTapeFileSystem:mainfrom
matejk:fix/iosched-large-write-data-loss
Open

Fix data loss on writes larger than the tape block size#607
matejk wants to merge 1 commit into
LinearTapeFileSystem:mainfrom
matejk:fix/iosched-large-write-data-loss

Conversation

@matejk

@matejk matejk commented Jun 12, 2026

Copy link
Copy Markdown

_unified_insert_new_request in 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 single write() 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.

_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
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.

silent data corruption on ARM64?

1 participant