[PATCH] D37410: LTO: Try to open cache files before renaming them.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 17:56:24 PDT 2017


pcc created this revision.
Herald added subscribers: hiraditya, inglorion, emaste.

It appears that a potential race between the cache client and the cache
pruner that I thought was unlikely actually happened in practice [1].
Try to avoid the race condition by opening the temporary file before
renaming it. Do this only on non-Windows platforms because we cannot
rename open files on Windows.

[1] https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium.memory%2FLinux_CFI%2F1610%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout


https://reviews.llvm.org/D37410

Files:
  lld/ELF/LTO.cpp
  llvm/include/llvm/LTO/Caching.h
  llvm/lib/LTO/Caching.cpp
  llvm/tools/gold/gold-plugin.cpp
  llvm/tools/llvm-lto2/llvm-lto2.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37410.113632.patch
Type: text/x-patch
Size: 5061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170902/bec18acd/attachment.bin>


More information about the llvm-commits mailing list