Commit 26cdee08 authored by Valentin David's avatar Valentin David
Browse files

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.
parent 3513580c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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: