btrfs qgroups Disk quota exceeded with only 60% usage

I have set up a btrfs volume with subvolumes and qgroups on those subvolumes.
Currently I’m getting the “Disk quota exceeded” error but according to qgroup show I have only used about 60% of the total quota. There is also still enough free space on the volume:

# mount /dev/sdb on /var/log/squid type btrfs (rw,relatime,space_cache,subvolid=257,subvol=/logging) /dev/sdb on /srv/www/squid type btrfs (rw,relatime,space_cache,subvolid=258,subvol=/statistics)

#df -h /dev/sdb 150G 85G 65G 57% /var/log/squid /dev/sdb 150G 85G 65G 57% /srv/www/squid

# btrfs subvolume show /srv/www/squid /srv/www/squid Name: statistics uuid: 8ddfb9aa-0818-ea45-a37e-e5b659987569 Parent uuid: - Creation time: 2015-11-13 12:46:45 Object ID: 258 Generation (Gen): 9842 Gen at creation: 7 Parent: 5 Top Level: 5 Flags: - Snapshot(s):

Data is set to ‘single’ instead of ‘DUP’:

# btrfs fi df /srv/www/squid Data, single: total=80.00GiB, used=79.39GiB System, DUP: total=32.00MiB, used=16.00KiB Metadata, DUP: total=3.00GiB, used=2.30GiB GlobalReserve, single: total=512.00MiB, used=0.00B

[CODE]# btrfs qgroup show -prce /srv/www/squid
qgroupid rfer excl max_rfer max_excl parent child


0/5 16.00KiB 16.00KiB 0.00B 0.00B — —
0/257 8.14GiB 8.14GiB 25.00GiB 0.00B — —
0/258 73.22GiB 73.22GiB 150.00GiB 0.00B — — [/CODE]

# touch /srv/www/squid/tt touch: cannot touch ‘/srv/www/squid/tt’: Disk quota exceeded

Balancing the btrfs subvolume also doesn’t help…

I know the quota set for /srv/www/squid is currently equal to the total disk space. At first the quota was set to 100Gb but then I increased it to 150Gb for testing purposes because I was already bumping the 100Gb quota limit when using only about 60Gb actual data. And as you can see above, the other subvolume on that volume only uses 8Gb of data, so I should bump into a “no space left on device error” before i would be able to bump onto the quota limit currently.

I do have to note that this filesystem currently contains 4,209,707 small files (in several subdirectories) but I don’t see how that could be a reason to “lose” 70Gb of free space ?

What is happening here ? Is this a bug in the quota system ?