summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2022-11-17 21:31:58 +0100
committerJoel Rosdahl <joel@rosdahl.net>2022-11-20 21:44:24 +0100
commit3b6c2a5a63e104ed2090ddebe611182297fd1f9c (patch)
treebd51cf63a419900e8ba9ff711f9fba8874336b79 /cmake
parentec77044ea62bab253e62ee5aaf2646a2ee551004 (diff)
downloadccache-3b6c2a5a63e104ed2090ddebe611182297fd1f9c.tar.gz
fix: Avoid race condition in inode cache for quick updates
The inode cache has a race condition that consists of these events: 1. A file is written with content C1, size S and timestamp (ctime/mtime) T. 2. Ccache hashes the file content and asks the inode cache to store the digest with a hash of S and T (and some other data) as the key. 3. The file is quickly thereafter written with content C2 without changing size S and timestamp T. The timestamp is not updated since the file writes are made within a time interval smaller than the granularity of the clock used for file system timestamps. At the time of writing, a common granularity on a Linux system is 0.004 s (250 Hz). 4. The inode cache is asked for the file digest and the inode cache delivers a digest of C1 even though the file's content is C2. To avoid the race condition, the inode cache now only caches inodes whose timestamp was updated more than two seconds ago. This conservative value is chosen since not all file systems have subsecond resolution. Fixes #1215.
Diffstat (limited to 'cmake')
0 files changed, 0 insertions, 0 deletions