fix(disk,runtime): cross-filesystem-safe clone/snapshot moves (EXDEV fallback)#624
Open
G4614 wants to merge 1 commit into
Open
fix(disk,runtime): cross-filesystem-safe clone/snapshot moves (EXDEV fallback)#624G4614 wants to merge 1 commit into
G4614 wants to merge 1 commit into
Conversation
Clone/snapshot base promotion (fork_qcow2) and import/clone box
provisioning (provision_box) moved files/dirs with a bare std::fs::rename,
which fails with EXDEV ("Invalid cross-device link") when the source (box
home / staging) and destination (base store / boxes dir) live on different
filesystems — e.g. a tmpfs scratch area vs the on-disk data dir.
- fork_qcow2: fall back to copy + remove on EXDEV (matches the existing
archive::move_file helper).
- provision_box: fall back to recursive copy + remove_dir_all on EXDEV
(directory move; std::fs::copy can't copy a tree). Symlinks preserved.
Fixes ~37 clone/snapshot/export integration tests that run with the box
home on tmpfs and the base store on the repo disk.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
rename cannot be operated between different mounted file systems (eg. /tmp mounted independently )
Test plan
Two-sided (fix reverted vs applied), the clone/snapshot/export integration tests, run with the per-test box home on a tmpfs
/tmpand the base store on an ext4 disk (i.e. different filesystems):clone_export_import(9) +snapshot_clone_deep(28) — clone / snapshot-clone / export-import flows that promote a disk to the base store and/or move an import staging dir intoboxes/.disk/mod.rs+rt_impl.rsreverted)fork_qcow2)Storage("Failed to move disk … : Invalid cross-device link (os error 18)")provision_box)Storage("Failed to rename …/staging → …/boxes/… : Invalid cross-device link")archive.rs::move_filealready handledEXDEV; this brings the clone/snapshot move paths in line. Same-filesystem setups (most CI) take the plainrenamefast path and are unaffected.