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-19 10:37:58 +0100
commit9126287e3f592d27569e2f46dc6f582a4e8924aa (patch)
tree95b17659b431d8e70b2c929ef06e61bea1c6b301
parent603490729b4bb766327095ef283b29cde680597d (diff)
downloadbuildstream-9126287e3f592d27569e2f46dc6f582a4e8924aa.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 62d06f3ce..4d352651d 100644
--- a/buildstream/_artifactcache/casserver.py
+++ b/buildstream/_artifactcache/casserver.py
@@ -426,7 +426,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: