Skip to content

Replace hard linked metadata.rmeta with a copy when finalizing the incremental compilation session dir fails - #162366

Open
TheHighestBit wants to merge 3 commits into
rust-lang:mainfrom
TheHighestBit:copy-on-finalize-error
Open

TheHighestBit wants to merge 3 commits into
rust-lang:mainfrom
TheHighestBit:copy-on-finalize-error

Conversation

@TheHighestBit

@TheHighestBit TheHighestBit commented Sep 6, 2026

Copy link
Copy Markdown

Fixes #151181.

Since 1.90.0, on ReFS (Windows Dev Drive) volumes finalizing the incremental compilation session directory would fail with Access is denied. (os error 5). The issue was caused by #114669, which meant that metadata.rmeta inside the session dir was a hard link to a file that was potentially being used by several other processes and ReFS seemingly refuses to rename such directories. As a fallback, we try to replace the hard linked metadata file with a copy instead, so that the rename can succeed.

I don't think adding a test for this is possible due to the lack of a ReFS runner but I added a unit test for the replace_hard_link_with_copy helper.

r? @bjorn3

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 6, 2026
@rustbot

rustbot commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @bjorn3 (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Comment thread compiler/rustc_incremental/src/persist/fs.rs
@bjorn3 bjorn3 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 9, 2026
@TheHighestBit

Copy link
Copy Markdown
Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 9, 2026
Comment thread compiler/rustc_incremental/src/persist/fs.rs Outdated
@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@bjorn3

bjorn3 commented Sep 17, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 0bae8cf has been approved by bjorn3

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: "error finalizing incremental compilation session directory. Access is denied. (os error 5)" when building on Windows

4 participants