From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Johannes Henninger <johannes+btrfs@henninger.io>,
linux-btrfs@vger.kernel.org
Subject: Re: Exclusive quota of snapshot exceeded despite no space used
Date: Fri, 23 Oct 2015 07:47:25 +0800 [thread overview]
Message-ID: <5629758D.203@gmx.com> (raw)
In-Reply-To: <56294960.10406@henninger.io>
在 2015年10月23日 04:38, Johannes Henninger 写道:
> I'm having a weird problem with snapshots and exclusive quotas. After
> creating a snapshot of a subvolume and setting an exclusive quota of
> 50MB for the snapshot, everything seems to work fine. I can write
> approximately 50MB before the quota kicks in.
>
> However, if I create a snapshot, set an exclusive quota and just wait
> for some time, I suddenly cannot even create an empty file because I'm
> getting a "quota exceeded" error. The time until the bug appears seems
> to vary. During the waiting time, I'm changing neither the snapshot nor
> the original subvolume. "qgroup show -e" reports an exclusive use of
> only a few kilobytes for the snapshot, which is nowhere near the limit.
>
> Steps to reproduce (/media/extern is a fresh and empty btrfs partition):
>
> Enable quota and create an empty subvolume:
> root@t420:/media/extern# btrfs quota enable .
> root@t420:/media/extern# btrfs subvolume create sub
> Create subvolume './sub'
>
> Snapshot the subvolume and set a limit:
> root@t420:/media/extern# btrfs subvolume snapshot sub snap
> Create a snapshot of 'sub' in './snap'
> root@t420:/media/extern# cd snap/
> root@t420:/media/extern/snap# btrfs qgroup limit -e 50M .
>
> Sometimes it takes "longer" for the quota to kick in, so I'm touching a
> file every 5 minutes here:
>
> root@t420:/media/extern/snap# for file in {1..100}; do touch $file;
> sleep 5m; done
> touch: cannot touch ‘7’: Disk quota exceeded
> ^C
> root@t420:/media/extern/snap# btrfs qgroup show -e .
> qgroupid rfer excl max_excl
> -------- ---- ---- --------
> 0/5 16.00KiB 16.00KiB none
> 0/257 16.00KiB 16.00KiB none
> 0/258 16.00KiB 16.00KiB 50.00MiB
>
> Any idea why this happens?
BTW, to make btrfs qgroup show work, it's better to call sync before
qgroup show.
It's a known bug that even after qgroup accounting rework, qgroup
reserve still has bug and can cause reserved space to underflow, making
such problem happen.
For such case, btrfs qgroup show won't help as reserved space is not
shown in the output.
One workaround would be, umount the filesystem and mount again.
Which will reset the underflow reserved space and work for sometime.
If it's OK for you to recompile the kernel, you can try the following
patchset:
[PATCH v3 00/21] Rework btrfs qgroup reserved space framework
Which should solve the problem.
Thanks,
Qu
>
> Thanks,
> Johannes
>
> System info:
>
> Linux t420 4.3.0-rc5 #1 SMP Tue Oct 13 13:21:02 CEST 2015 x86_64
> GNU/Linux
>
> Label: none uuid: 9551e3ca-1608-469c-9d8c-77b99ce0e8ec
> Total devices 1 FS bytes used 816.00KiB
> devid 1 size 931.51GiB used 2.04GiB path /dev/sdb1
>
> btrfs-progs v4.1.2
>
> Data, single: total=8.00MiB, used=256.00KiB
> System, DUP: total=8.00MiB, used=16.00KiB
> System, single: total=4.00MiB, used=0.00B
> Metadata, DUP: total=1.00GiB, used=544.00KiB
> Metadata, single: total=8.00MiB, used=0.00B
> GlobalReserve, single: total=16.00MiB, used=0.00B
>
> [249174.151820] sdb: sdb1
> [249184.387377] sdb: sdb1
> [249184.573096] sdb: sdb1
> [249184.656274] BTRFS: device fsid
> 9551e3ca-1608-469c-9d8c-77b99ce0e8ec devid 1 transid 3 /dev/sdb1
> [249186.323915] sdb: sdb1
> [249186.534505] sdb: sdb1
> [249186.538420] sdb: sdb1
> [249196.781978] BTRFS info (device sdb1): disk space caching is enabled
> [249196.781986] BTRFS: has skinny extents
> [249196.781990] BTRFS: flagging fs with big metadata feature
> [249196.818164] BTRFS: creating UUID tree
> [249202.311983] BTRFS info (device sdb1): qgroup scan completed
> (inconsistency flag cleared)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-10-22 23:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-22 20:38 Exclusive quota of snapshot exceeded despite no space used Johannes Henninger
2015-10-22 23:47 ` Qu Wenruo [this message]
2015-10-23 15:05 ` Johannes Henninger
2015-10-25 0:44 ` Qu Wenruo
2015-10-25 11:10 ` Johannes Henninger
2015-10-25 12:17 ` Qu Wenruo
2015-10-26 7:12 ` Qu Wenruo
2015-10-27 0:15 ` Johannes Henninger
2015-10-27 1:06 ` Qu Wenruo
2015-10-28 14:02 ` Johannes Henninger
2015-10-29 2:31 ` Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5629758D.203@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=johannes+btrfs@henninger.io \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).