Skip to content

copy_file_range: prevent size-mismatch when copying large files#297

Open
CatalinaLeca wants to merge 1 commit into
xoriors:mainfrom
CatalinaLeca:bugfix/disable-copy-file-range
Open

copy_file_range: prevent size-mismatch when copying large files#297
CatalinaLeca wants to merge 1 commit into
xoriors:mainfrom
CatalinaLeca:bugfix/disable-copy-file-range

Conversation

@CatalinaLeca
Copy link
Copy Markdown

What

  • Re-implemented EncryptedFs::copy_file_range to copy in blocks not larger than
    cipher.max_plaintext_len(), eliminating partial writes.

Why

  • Copying a file inside the mounted volume (>256 KiB) used to corrupt it and log
    “size mismatch write … 262144”.

Fixes #232

Copilot AI review requested due to automatic review settings May 10, 2025 12:33
@CatalinaLeca CatalinaLeca requested a review from radumarias as a code owner May 10, 2025 12:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR re-implements EncryptedFs::copy_file_range to copy data in blocks not exceeding the cipher’s maximum plaintext length, thereby preventing size-mismatch errors when copying large files.

  • Replaces the old copy_file_range implementation with a block-based copying mechanism
  • Renames the parameter "file_range_req" to "req" for brevity
  • Adds inline comments to clarify safety guards and block handling

Comment thread src/encryptedfs.rs
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.

Error reading after copy

2 participants