From 9126287e3f592d27569e2f46dc6f582a4e8924aa Mon Sep 17 00:00:00 2001 From: Valentin David Date: Thu, 15 Nov 2018 12:41:37 +0100 Subject: 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. --- buildstream/_artifactcache/casserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: -- cgit v1.2.1