Hi, I tried to configure qgroups on a btrfs filesystem but was really surprised that when you snapshot a subvolume, the snapshot will not be assigned to the qgroup the subvolume was in.
As an example consider the small terminal session in the attachment: I create a subvol A, assign it to qgroup 1/1 and set a limit of 5M on that qgroup. Then I write a file into A and eventually get "disk quota exceeded". Then I create a snapshot of A and call it B. B will not be assigned to 1/1 and writing a file into B confirms that no limits at all are imposed for B. I feel like I must be missing something here. Considering that creating a snapshot does not require root privileges this would mean that any user can just circumvent any quota and therefore make them useless. Is there a way to enforce quotas even when a user creates snapshots? Moritz
$ btrfs quota enable . $ btrfs subvolume create A Create subvolume './A' $ btrfs qgroup create 1/1 . $ btrfs qgroup show -p --sync . qgroupid rfer excl parent -------- ---- ---- ------ 0/5 16.00KiB 16.00KiB --- 0/257 16.00KiB 16.00KiB --- 1/1 0.00B 0.00B --- $ btrfs qgroup assign 0/257 1/1 . $ btrfs qgroup limit 5M 1/1 . $ dd if=/dev/urandom of=A/foo bs=1M count=4 4+0 records in 4+0 records out 4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0529255 s, 79.2 MB/s $ btrfs qgroup show -p --sync . qgroupid rfer excl parent -------- ---- ---- ------ 0/5 16.00KiB 16.00KiB --- 0/257 4.02MiB 4.02MiB 1/1 1/1 4.02MiB 4.02MiB --- $ dd if=/dev/urandom of=A/bar bs=1M count=4 dd: error writing 'A/bar': Disk quota exceeded 1+0 records in 0+0 records out 917504 bytes (918 kB, 896 KiB) copied, 0.00408068 s, 225 MB/s $ btrfs subvolume snapshot A B Create a snapshot of 'A' in './B' $ btrfs qgroup show -p --sync . qgroupid rfer excl parent -------- ---- ---- ------ 0/5 16.00KiB 16.00KiB --- 0/257 4.89MiB 16.00KiB 1/1 0/258 4.89MiB 16.00KiB --- 1/1 4.89MiB 4.89MiB --- $ dd if=/dev/urandom of=B/baz bs=1M count=4 4+0 records in 4+0 records out 4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0174467 s, 240 MB/s $ btrfs qgroup show -p --sync . qgroupid rfer excl parent -------- ---- ---- ------ 0/5 16.00KiB 16.00KiB --- 0/257 4.89MiB 16.00KiB 1/1 0/258 8.89MiB 4.02MiB --- 1/1 4.89MiB 4.89MiB ---