Skip to content

VFS: keep game files hidden after delete-on-close - #1038

Open
gloger2003 wants to merge 1 commit into
xcl-dev:mainfrom
gloger2003:fix/vfs-delete-on-close
Open

gloger2003 wants to merge 1 commit into
xcl-dev:mainfrom
gloger2003:fix/vfs-delete-on-close

Conversation

@gloger2003

@gloger2003 gloger2003 commented Nov 24, 2026 •

Copy link
Copy Markdown

Part of #998. Opening a mounted game file with FILE_FLAG_DELETE_ON_CLOSE used to remove the overlay copy and expose the original again.

What is in it

  • Record a whiteout after a successful delete-on-close open of an overlay file that covers an original game file. Keep the whiteout when a second writable handle reopens the existing overlay file.
  • Exercise both handles in the in-tree test title and verify the original game directory stays byte-identical.

Tested

  • Windows 11 build 26300.9974, AMD Radeon RX 7800 XT (32.0.32029.2010), Ryzen 7 5700X, Rust 1.100.0 MSVC, Windows SDK DXC 1.9.2602.17.

  • cargo build --locked --workspace and cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output on the source in 7f93905: 727 passed, 0 failed, 41 ignored, no explicit GPU capability skips.

  • The new test reproduced the original resurfacing, including after a second writable open. The release build with the fix completed the in-tree title with zero failures.

  • Local merge of this exact head into main 47efa2e (tree bbccc1d): rebuilt the workspace, then ran all tests on the RX 7800 XT. 741 passed, 0 failed, 41 ignored, no explicit GPU capability skips. The delete-on-close e2e test and the previously failing truncate_existing_validation_errors test both passed.

  • Also checked a local combination with VFS: a delete through a handle hides the game file (#998) #1054 at 7ecc08f. In that combination, opening with FILE_FLAG_DELETE_ON_CLOSE, calling FileDispositionInfo(FALSE), then closing made the original visible again. Windows still deletes the overlay copy, but the explicit-disposition hook clears the whiteout. This is an interaction between the two PRs.

Regression run
Independent runs by Curry-976 on a GeForce RTX 4050 Laptop GPU. The contributor reports 727 passed, 0 failed, 41 ignored in the workspace suite, with two wave64 capability skips. The smoke runs were back to back.

main:

xcl-smoke v1
commit: 67a3735177f42cf8e5c886e67a974da7f87541b3
gpu: NVIDIA GeForce RTX 4050 Laptop GPU
title: mon jeu
seconds: 60
exit: 0x0
frames shown: 393 (PresentX 393)
presents per 2 s (last 3): 18 18 17
device removals: 0
crashes: 0
peak commit: 15279 MB

PR:

xcl-smoke v1
commit: 7f939053fe3dc83d17a337ece7f7731960cd279a
gpu: NVIDIA GeForce RTX 4050 Laptop GPU
title: mon jeu
seconds: 60
exit: 0x0
frames shown: 409 (PresentX 409)
presents per 2 s (last 3): 18 17 19
device removals: 0
crashes: 0
peak commit: 15277 MB

Not tested

  • Locally, Minecraft Preview 1.18.3064.0 lost the D3D12 device during startup on the RX 7800 XT with both the main baseline and this PR. The independent NVIDIA runs above are separate. Tests that require XCL_SAMPLE_* files.
  • This change covers FILE_FLAG_DELETE_ON_CLOSE for files. Deletion or renaming via SetFileInformationByHandle remains separate.

AI use

  • OpenAI Codex (GPT-6 family, exact model variant unavailable) implemented the change, added the regression test, ran the checks, and drafted this description.

An open with FILE_FLAG_DELETE_ON_CLOSE removes only the overlay file on close. Record a whiteout after the native open succeeds and retain it when another handle opens the existing overlay entry.

Exercise two handles in the test title and check that the original game tree stays byte-identical. The Windows workspace suite passed on an RX 7800 XT.
@dcastell1

Copy link
Copy Markdown

The new e2e expectation in this PR fails on the current base:

cargo test --workspace -- --test-threads=4
test result: FAILED. 712 passed; 1 failed; 25 ignored   (exit 101)

thread 'test_title_runs_and_game_folder_is_untouched' panicked at crates\xcl\tests\e2e.rs:159:5:
whiteouts: data\delete_me.txt

The title itself finishes clean (xcl_testtitle: done, failures: 0, Game exited with code 0x0 (0), report.json exit_code = 0), so this is the file state, not the run. The whiteout file at data\XCL.TestTitle\overlay\.xcl_whiteouts is 19 bytes:

data\delete_me.txt\n

i.e. the delete_me.txt entry is there and the new one the test asks for two lines later — data\delete_on_close.txt — is not, which is the second assert! at that spot (e2e.rs:159, right after the delete_me.txt line). So the close-with-delete path is not reaching the whiteout list on this run, which is exactly what the PR is for.

Environment: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, clean main@67a3735 (735 passed, 0 failed, 41 ignored) with this PR at 7f939053 applied with patch -p1 (clean, no fuzz). Tree restored afterwards; no game data.

AI-assisted (opencode): applied the patch to a built tree, ran the suite, inspected the overlay's whiteout file, reverted it.

@Curry-976

Copy link
Copy Markdown

Test report for this PR's head 7f939053fe3dc83d17a337ece7f7731960cd279a (checked out with gh pr checkout 1038, no local changes), with the two smoke blocks the description is waiting for.

Tested

  • NVIDIA GeForce RTX 4050 Laptop GPU (driver 32.0.16.1742, 32-lane waves), Intel Core i5-12450HX, Windows 11 26300, Rust 1.100.0 stable-x86_64-pc-windows-msvc.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 (debug): 727 passed, 0 failed, 41 ignored. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64). test_title_runs_and_game_folder_is_untouched, with the new delete-on-close check, passes.
  • scripts/smoke.ps1 -Game <retail title folder> (60 s, cargo build --release -p xcl), the two runs back to back:

main:

xcl-smoke v1
commit: 67a3735177f42cf8e5c886e67a974da7f87541b3
gpu: NVIDIA GeForce RTX 4050 Laptop GPU
title: mon jeu
seconds: 60
exit: 0x0
frames shown: 393 (PresentX 393)
presents per 2 s (last 3): 18 18 17
device removals: 0
crashes: 0
peak commit: 15279 MB

PR:

xcl-smoke v1
commit: 7f939053fe3dc83d17a337ece7f7731960cd279a
gpu: NVIDIA GeForce RTX 4050 Laptop GPU
title: mon jeu
seconds: 60
exit: 0x0
frames shown: 409 (PresentX 409)
presents per 2 s (last 3): 18 17 19
device removals: 0
crashes: 0
peak commit: 15277 MB

This laptop's frame rate drops from run to run as it heats up (an earlier main run on the same commit showed 554 frames), so the two blocks above are the pair taken back to back. The title was not checked for delete-on-close opens: the runs are a regression check only.

Not tested

  • AMD GPUs, a release build of the test suite, directories opened with FILE_FLAG_DELETE_ON_CLOSE.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands above on this machine and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Independent verification, merged onto current main 384f7f7 locally (clean merge).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

@JJAutoCompare

Copy link
Copy Markdown

Empirical test report (7f93905)

Hardware / environment

  • Windows x64, OS build 10.0.26200.0. AMD CPU reported as family 23, model 113, stepping 0, with 12 logical processors.
  • Test profile with debug info and incremental compilation disabled. rustc 1.100.0 (0ef1bc386 2026-11-09). dxc --version reported 1.9.2609.5 (01b62ad47).
  • CPU-only execution outside Invoke-ArcTest.ps1, with zero Arc GPU mutex hold. The focused commands used XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1.

Commands and results

  • cargo test --workspace --no-run exited 0 at 7f939053fe3dc83d17a337ece7f7731960cd279a.
  • cargo test -p xcl --lib vfs -- --nocapture exited 101. The log recorded 19 passed, 1 failed, 0 ignored, and 0 SKIPPED lines. The filter selected the vfs and vfs_hooks library tests.
  • cargo test -p xcl --lib vfs::tests::truncate_existing_validation_errors -- --nocapture exited 101 on both the PR head and its parent e74dda2d4b5c28a81cfa971d14bc417a6be966aa. Each isolated run recorded 0 passed, 1 failed, 0 ignored, and 0 skips.

Observed behavior

  • Existing CPU checks passed for overlay copy-on-write, whiteout persistence across VFS reinitialization, and hiding original children after directory recreation.
  • The same native error-code assertion failed on both commits. It read Win32 error 127 (ERROR_PROC_NOT_FOUND) where it expected 5 (ERROR_ACCESS_DENIED).

Not tested

The full GPU workspace suite and game smoke runs were omitted. The PR adds its two-handle delete-on-close regression check inside the D3D12-dependent test title. The workspace build compiled that check, and the CPU VFS filter left it unexecuted.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1038-focused.log and published.

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.

5 participants