All of lore.kernel.org
 help / color / mirror / Atom feed
* Qgroups are not applied when snapshotting a subvol?
@ 2017-03-25 22:03 Moritz Sichert
  2017-03-26  5:45 ` Duncan
  2017-03-27  0:39 ` Qu Wenruo
  0 siblings, 2 replies; 24+ messages in thread
From: Moritz Sichert @ 2017-03-25 22:03 UTC (permalink / raw)
  To: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

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

[-- Attachment #2: btrfs-qgroups.txt --]
[-- Type: text/plain, Size: 1826 bytes --]

$ 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 ---

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2017-03-29 11:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-25 22:03 Qgroups are not applied when snapshotting a subvol? Moritz Sichert
2017-03-26  5:45 ` Duncan
2017-03-27  0:39 ` Qu Wenruo
2017-03-27  3:26   ` Andrei Borzenkov
2017-03-27  3:46     ` Qu Wenruo
2017-03-27 11:02       ` Moritz Sichert
2017-03-27 12:01         ` Austin S. Hemmelgarn
2017-03-27 19:32           ` Chris Murphy
2017-03-27 19:53             ` Roman Mamedov
2017-03-27 20:06               ` Hans van Kranenburg
2017-03-27 21:11                 ` Chris Murphy
2017-03-28  2:41                   ` Duncan
2017-03-28  5:21                     ` Duncan
2017-03-28  3:56             ` Andrei Borzenkov
2017-03-28 11:24             ` Austin S. Hemmelgarn
2017-03-28 12:00               ` Marat Khalili
2017-03-28 12:20                 ` Austin S. Hemmelgarn
2017-03-28 13:53                   ` Marat Khalili
2017-03-28 15:24                     ` Austin S. Hemmelgarn
2017-03-29  5:53                       ` Marat Khalili
2017-03-28  1:49           ` Qu Wenruo
2017-03-28 11:44             ` Austin S. Hemmelgarn
2017-03-29  5:38               ` Duncan
2017-03-29 11:36                 ` Austin S. Hemmelgarn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.