Commit Graph

3 Commits

Author SHA1 Message Date
Marat Radchenko
285eebdddf Revert "Stop replacing files in LFS storage when downloading them concurrently on Windows"
This reverts commit 0c8edfc097a8364819649c9ba4df2221082a8cf8.
2019-11-05 17:30:13 +03:00
Marat Radchenko
0c8edfc097 Stop replacing files in LFS storage when downloading them concurrently on Windows
On Windows, there is no way to replace file atomically. Instead, MoveFileExA:

1. Calls CreateFileA(access=Delete, shareMode=Delete)
2. Calls SetRenameInformationFile to rename file
3. Calls CloseFile

The problem is that if parallel process attempts to open destination file for reading between
steps 2 and 3, it will try to do that without shareMode=Delete and will hit a SHARING_VIOLATION error.

In practice, this race condition results in:

  Smudge error: Error opening media file.: open .git\lfs\objects\<sha>: The process cannot access the file because it is being used by another process.

There are two solutions here:

 1. Do not overwrite file if it already exists
 2. Retry reading from file if got a SHARING_VIOLATION

This commit implements option 1.

Fixes #2825 (for Windows, other OSes are race-free already). Also see #3813 and #3826.
2019-10-25 10:54:25 +03:00
Kazuki MATSUDA / 松田一樹
e55bc4c5d4
Add clonefile implementation on Windows with ReFS. 2019-08-27 12:30:01 +09:00