]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/btrfs/super.c
Merge tag 'vfio-ccw-20200206' of https://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / fs / btrfs / super.c
index a906315efd19e23382cef2664c5ebb0c2977bbcb..0616a5434793d100ffa1db67c0afe961c687ba51 100644 (file)
@@ -2135,7 +2135,15 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
         */
        thresh = SZ_4M;
 
-       if (!mixed && total_free_meta - thresh < block_rsv->size)
+       /*
+        * We only want to claim there's no available space if we can no longer
+        * allocate chunks for our metadata profile and our global reserve will
+        * not fit in the free metadata space.  If we aren't ->full then we
+        * still can allocate chunks and thus are fine using the currently
+        * calculated f_bavail.
+        */
+       if (!mixed && block_rsv->space_info->full &&
+           total_free_meta - thresh < block_rsv->size)
                buf->f_bavail = 0;
 
        buf->f_type = BTRFS_SUPER_MAGIC;