VFS: preserve whiteouts when CreateFile fails on a deleted game file #1362
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1362
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1362"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@b3IKK on GitHub · 2026-11-24 15:12 UTC · original
b3IKK:vfs/preserve-whiteout-on-failed-create→main· +133 −27 · 2 files · 1 commits · openopen_decision_forcalledprepare_writebeforeCreateFileW/CreateFileA/CreateFile2ran, eagerly clearing any whiteout on the target path. If the underlyingCreateFile*call then failed (e.g. sharing violation, invalid flags/attributes, orERROR_ACCESS_DENIED), no overlay file was created yet the whiteout was already gone—resurrecting the deleted original game file.This adds
prepare_write_stagedandopen_decision_staged/open_decision_staged_for(following the existingstage_write/commit_writepattern fromd903a80) and hasapply_open_decisioncallcommit_writeonly afterCreateFile*returns a valid handle, while saving and restoringGetLastError()acrosscommit_write's whiteout persistence I/O so statuses likeERROR_ALREADY_EXISTSare not clobbered.What is in it
crates/xcl/src/vfs.rs: splitprepare_write_stagedout ofprepare_writeandopen_decision_staged_for/open_decision_stagedout ofopen_decision_forso callers can defercommit_writeuntil the file open succeeds.crates/xcl/src/vfs_hooks.rs: pass staged decisions fromhk_create_file_w,hk_create_file_a, andhk_create_file_2intoapply_open_decision, committing only onhandle != INVALID_HANDLE_VALUEwhile preservingGetLastError(); add unit testfailed_create_file_preserves_whiteout_and_last_error.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib vfs: 23 passed, 0 failedRegression run
main:
PR:
Not tested
AI use
vfs.rsandvfs_hooks.rs, wrote the staged open fix and unit test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.@futurepro62 on GitHub · 2026-11-24 15:17 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
b69731e(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.failed_create_file_preserves_whiteout_and_last_error.Not tested
AI use
@pickles976 on GitHub · 2026-11-24 15:20 UTC · original
Review from the #1259 author — your fix and mine are complementary halves of the same third-party #577 audit, and we should sequence deliberately: you close failed-open resurrection (staging no longer removes whiteouts before the open succeeds); #1259 closes missing-parent conjuring (a guard at the top of
prepare_writereturningERROR_PATH_NOT_FOUND, plus tests that a whited-out parent stays whited out and a game-only parent still stages fine). Semantic interaction is one line: my guard belongs at the top of what you rename toprepare_write_staged— happy to rebase onto whichever lands first, and your test suite plus my three cases form the joint acceptance set. Flagging it so the reviewer does not have to rediscover the overlap.@DavidM1911 on GitHub · 2026-11-24 16:28 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
@xpatfussy69x on GitHub · 2026-11-25 11:59 UTC · original
Test report for head
b69731eas pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignoredfailed_create_file_preserves_whiteout_and_last_errorran and passedXCL_SAMPLE_*data set (game-data tests not run)Not tested
mainAI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.