[PATCH] D48051: LTO: Work around a Windows kernel bug by keeping file handles open for memory mapped files.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 11 16:22:11 PDT 2018
pcc added a comment.
In https://reviews.llvm.org/D48051#1129109, @zturner wrote:
> In https://reviews.llvm.org/D48051#1129100, @pcc wrote:
>
> > > I don't think that would prevent other processes from opening the file. Both processes just have to make sure they both specify `FILE_SHARE_DELETE`.
> >
> > As I wrote in my message to Bob that doesn't seem to work. According to process monitor the second process fails to open the file with "DELETE PENDING".
>
>
> That's because a handle has been opened with `FILE_FLAG_DELETE_ON_CLOSE` and then subsequently closed. As soon as you close a file that has been openend with that flag, no other opens can happen on the file. That's why I suggested transferring ownership of it.
But we need to close the handle to clear `FILE_FLAG_DELETE_ON_CLOSE`. Or are you suggesting that we do this:
- open file with `FILE_FLAG_DELETE_ON_CLOSE`
- map the file
- use it
- unmap it
- do magic to clear `FILE_FLAG_DELETE_ON_CLOSE`
? I'm not sure that would be simpler because it would mean transferring ownership back to the `TempFile`.
https://reviews.llvm.org/D48051
More information about the llvm-commits
mailing list