summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin David <valentin.david@codethink.co.uk>2018-11-15 12:41:37 +0100
committerValentin David <valentin.david@codethink.co.uk>2018-11-28 15:29:52 +0100
commit26cdee087a690a4db66609d59fa14c656b98237d (patch)
treeeaa78856b0edbaceece2d3130b9fdd707c38874e
parent3513580cacb9784900f119600e1a8ab9aa4fed32 (diff)
downloadbuildstream-26cdee087a690a4db66609d59fa14c656b98237d.tar.gz
Use f_bavail to query available space. Not f_bfree.
f_bfree space might not be usable. In practice we see failures in big disks because f_bfree is over 2GB and f_bavail is 0. We get ENOSPC if writing on disk then.
-rw-r--r--buildstream/_artifactcache/casserver.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/buildstream/_artifactcache/casserver.py b/buildstream/_artifactcache/casserver.py
index ee84c4943..88cbf304e 100644
--- a/buildstream/_artifactcache/casserver.py
+++ b/buildstream/_artifactcache/casserver.py
@@ -422,7 +422,7 @@ def _clean_up_cache(cas, object_size):
# which mounts the repo
stats = os.statvfs(cas.casdir)
buffer_ = int(2e9) # Add a 2 GB buffer
- free_disk_space = (stats.f_bfree * stats.f_bsize) - buffer_
+ free_disk_space = (stats.f_bavail * stats.f_bsize) - buffer_
total_disk_space = (stats.f_blocks * stats.f_bsize) - buffer_
if object_size > total_disk_space: