]> git.ipfire.org Git - thirdparty/ccache.git/commit
Fix NFS object corruption
authorWilson Snyder <wsnyder@wsnyder.org>
Fri, 8 Oct 2010 11:28:06 +0000 (07:28 -0400)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 1 Nov 2010 17:31:35 +0000 (18:31 +0100)
commitd887888cd2b8297452f3bf49812d13ba4fb089be
tree3861197476b3b145d3b986a351440064b43f51e0
parentb91097778f02c339f5124ff4604e54ea7ce02f07
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.
HACKING.txt
ccache.c
ccache.h
cleanup.c
execute.c
lockfile.c
stats.c
util.c