Bug ID 1057962
Summary Btrfs: 'cp --reflinks' exceeds quota limit without error
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware Other
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Kernel
Assignee kernel-maintainers@forge.provo.novell.com
Reporter antoine.belvire@opensuse.org
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

It looks like it's to possible to largely exceed quota limit on rfer size
without error, using cp --reflinks.

Tested on Tumbleweed with kernel-default 4.12 and also with kernel-default 4.13
from Kernel:stable.

Reproducible: always

Steps to reproduce:

1. Make sure quotas are enabled

2. Create '/test/' and '/test/a' subvolumes:
> btrfs subvolume create /test
> btrfs subvolume create /test/a

3. Set limits for '/test/a' qgroup:
> btrfs qgroup limit 10m <qgroupid> /
> btrfs qgroup limit -e 5m <qgroupid> /

`btrfs qgroup show -erF /test/a/` returns:
qgroupid         rfer         excl     max_rfer     max_excl 
--------         ----         ----     --------     -------- 
(the id)     16.00KiB     16.00KiB     10.00MiB      5.00MiB

4. Write a big file in '/test', here 50 MB:
> dd if=/dev/urandom of=/test/bigfile bs=1M count=50

5. Copy with reflink '/test/bigfile' to '/test/a/bigfile':
> cp --reflink /test/bigfile /test/a

Actual results:
* no error when doing cp --reflink
* Quota is largely exceeded:

> ~# btrfs filesystem sync /
> ~# btrfs qgroup show -erF /test/a/
> qgroupid         rfer         excl     max_rfer     max_excl 
> --------         ----         ----     --------     -------- 
> (the id)     50.02MiB     16.00KiB     10.00MiB      5.00MiB 
> ~#

Expected results:
* Disk quota error when doing cp --reflink
* rfer below max_rfer


You are receiving this mail because: