diff options
author | Wilson Snyder <wsnyder@wsnyder.org> | 2010-10-08 07:28:06 -0400 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2010-10-09 16:32:50 +0200 |
commit | 22bffd28cae021231dc7ddd4cda288b3115f2da1 (patch) | |
tree | f30c4c62f42a95ef6fe788bd2f55f20453818d55 /HACKING.txt | |
parent | 83f2624dffe2312d303d42720959bb82e0bf6adf (diff) | |
download | ccache-22bffd28cae021231dc7ddd4cda288b3115f2da1.tar.gz |
Fix NFS object corruption
Several months ago I reported a problem with NFS corruption from three
simultaneous NFS users of ccache on the same file; two writers to the cache
and one reader.
I believe I have tracked this issue down to a race related to the use of
unlink. On NFS, unlink() is NOT atomic; so what seemed to be happening was
the second writer unlink()ed the first's object, then the reader got the
partially unlinked (truncated) object.
The following patch fixes this issue by always calling rename before a
unlink - a new x_unlink function. There are some places where temp files
are being unlinked; for performance these can remain as the ordinary
unlink.
Diffstat (limited to 'HACKING.txt')
-rw-r--r-- | HACKING.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/HACKING.txt b/HACKING.txt index 43ff89e9..b34c29e6 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -27,6 +27,8 @@ Idioms * Use str_eq() instead of strcmp() when testing for string (in)equality. * Consider using str_startswith() instead of strncmp(). * Use bool, true and false for boolean values. +* Use tmp_unlink() or x_unlink() instead of unlink(). +* Use x_rename() instead of rename(). Other ----- |