-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Win32 FS: Rewrite (fix) vfs::host::rename, Fix fs::utime for directories #8894
Conversation
f53418e
to
1bfafc8
Compare
Added an fs::utime fix for directories based on https://docs.microsoft.com/en-us/windows/win32/fileio/obtaining-a-handle-to-a-directory to fix fs::utime usage on the pr. Requesting @bevanweiss to review the fix. (ERROR_ACCESS_DENIED was returned before) |
I think this might be a slightly bigger problem that this implementation won't resolve. It does appear that if (all) the files are opened with the FILE_SHARE_DELETE attribute, then renames are allowed, but I'm not sure if that extends to entire path moves, nor what kind of other problems it will raise.. The policy of always specifying FILE_SHARE_DELETE appears to be supported by Microsoft (in regards to Golang libraries anyway): golang/go#32088 (comment) It 'might' be a cleaner solution. |
We already use this flag though, that's why renaming each file works here. |
In fs::file::file() it appears that we don't always set this flag, although admittedly there's not many situations where we don't set it, but it would only take one file to block the move/rename.
|
I added a commit for it but I already tested all 3 flags always set in fs::file::open, doesnt fix it and renaming each file still works. |
2c5be0c
to
43ffc5a
Compare
Made vfs::host::rename atomic for it and added kernel explorer info on filesystem. |
06f6edf
to
83da09f
Compare
Can't use cpu_thread::suspend_all... (no-op here) rewritten. |
e031cd5
to
7f66df6
Compare
5195725
to
9d640db
Compare
100% accurate now. |
f4c6363
to
de64d05
Compare
Some conflict |
Conflict should be fixed. |
I've noticed that when MoveFileEx is called on a directory with opened file handles it returns an access error, it even affects one of my cellSysCache tests which was my testcase for this fix.
"Suspend" opened sys_fs file handles in such case by closing, fs::rename then reopen on the new (if succeeded) or old file path.
Partially addresses #8891 (fixes Battlefieled BC2)
Also: add guest filesystem information in kernel explorer and cellSysCache improvemenrs.