* [PATCH] Fixing quota error when removing files from a limit exceeded subvols
@ 2015-01-01 23:48 Khaled Ahmed
2015-01-03 2:09 ` Dongsheng Yang
0 siblings, 1 reply; 4+ messages in thread
From: Khaled Ahmed @ 2015-01-01 23:48 UTC (permalink / raw)
To: linux-btrfs; +Cc: Khaled Ahmed
Signed-off-by: Khaled Ahmed <khaled.gnu@gmail.com>
---
fs/btrfs/qgroup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 48b60db..b85200d 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2408,14 +2408,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
qg->reserved + (s64)qg->rfer + num_bytes >
- qg->max_rfer) {
+ qg->max_rfer - 1 ) {
ret = -EDQUOT;
goto out;
}
if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
qg->reserved + (s64)qg->excl + num_bytes >
- qg->max_excl) {
+ qg->max_excl - 1) {
ret = -EDQUOT;
goto out;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Fixing quota error when removing files from a limit exceeded subvols
2015-01-01 23:48 [PATCH] Fixing quota error when removing files from a limit exceeded subvols Khaled Ahmed
@ 2015-01-03 2:09 ` Dongsheng Yang
2015-01-03 14:29 ` Khaled Ahmed
0 siblings, 1 reply; 4+ messages in thread
From: Dongsheng Yang @ 2015-01-03 2:09 UTC (permalink / raw)
To: Khaled Ahmed; +Cc: linux-btrfs
Hi Khaled,
Could you give use more description about the problem this patch
is trying to solve? Maybe an example will help a lot to understand it.
Thanx
On Fri, Jan 2, 2015 at 7:48 AM, Khaled Ahmed <khaled.gnu@gmail.com> wrote:
> Signed-off-by: Khaled Ahmed <khaled.gnu@gmail.com>
> ---
> fs/btrfs/qgroup.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index 48b60db..b85200d 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -2408,14 +2408,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
>
> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
> qg->reserved + (s64)qg->rfer + num_bytes >
> - qg->max_rfer) {
> + qg->max_rfer - 1 ) {
> ret = -EDQUOT;
> goto out;
> }
>
> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
> qg->reserved + (s64)qg->excl + num_bytes >
> - qg->max_excl) {
> + qg->max_excl - 1) {
> ret = -EDQUOT;
> goto out;
> }
> --
> 2.1.0
>
> --
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fixing quota error when removing files from a limit exceeded subvols
2015-01-03 2:09 ` Dongsheng Yang
@ 2015-01-03 14:29 ` Khaled Ahmed
2015-01-04 10:54 ` Dongsheng Yang
0 siblings, 1 reply; 4+ messages in thread
From: Khaled Ahmed @ 2015-01-03 14:29 UTC (permalink / raw)
To: Dongsheng Yang; +Cc: linux-btrfs
Hi Yang,
This is how to reproduce the bug,
[root@algodev ~]# uname -r
3.18.0+
[root@algodev ~]# btrfs version
Btrfs v3.18-2-g6938452-dirty
[root@algodev ~]# btrfs quota enable LOOP/
[root@algodev ~]# btrfs qgroup show LOOP/
qgroupid rfer excl
-------- ---- ----
0/5 16384 16384
[root@algodev ~]# btrfs subvol create LOOP/subvol1
Create subvolume 'LOOP/subvol1'
[root@algodev ~]# btrfs qgroup limit 1g LOOP/subvol1/
[root@algodev ~]# btrfs qgroup show LOOP/
qgroupid rfer excl
-------- ---- ----
0/5 16384 16384
0/258 16384 16384
[root@algodev ~]# dd if=/dev/zero of=LOOP/subvol1/bigfile
dd: writing to ‘LOOP/subvol1/bigfile’: Disk quota exceeded
2097018+0 records in
2097017+0 records out
1073672704 bytes (1.1 GB) copied, 10.0759 s, 107 MB/s
[root@algodev ~]# rm -f LOOP/subvol1/bigfile
rm: cannot remove ‘LOOP/subvol1/bigfile’: Disk quota exceeded
[root@algodev ~]#
Best Regards,
~Khaled Ahmed
On Jan 3, 2015, at 4:09 AM, Dongsheng Yang <dongsheng081251@gmail.com> wrote:
> Hi Khaled,
>
> Could you give use more description about the problem this patch
> is trying to solve? Maybe an example will help a lot to understand it.
>
> Thanx
>
> On Fri, Jan 2, 2015 at 7:48 AM, Khaled Ahmed <khaled.gnu@gmail.com> wrote:
>> Signed-off-by: Khaled Ahmed <khaled.gnu@gmail.com>
>> ---
>> fs/btrfs/qgroup.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
>> index 48b60db..b85200d 100644
>> --- a/fs/btrfs/qgroup.c
>> +++ b/fs/btrfs/qgroup.c
>> @@ -2408,14 +2408,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
>>
>> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
>> qg->reserved + (s64)qg->rfer + num_bytes >
>> - qg->max_rfer) {
>> + qg->max_rfer - 1 ) {
>> ret = -EDQUOT;
>> goto out;
>> }
>>
>> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
>> qg->reserved + (s64)qg->excl + num_bytes >
>> - qg->max_excl) {
>> + qg->max_excl - 1) {
>> ret = -EDQUOT;
>> goto out;
>> }
>> --
>> 2.1.0
>>
>> --
>> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fixing quota error when removing files from a limit exceeded subvols
2015-01-03 14:29 ` Khaled Ahmed
@ 2015-01-04 10:54 ` Dongsheng Yang
0 siblings, 0 replies; 4+ messages in thread
From: Dongsheng Yang @ 2015-01-04 10:54 UTC (permalink / raw)
To: Khaled Ahmed; +Cc: linux-btrfs
On Sat, Jan 3, 2015 at 10:29 PM, Khaled Ahmed <khaled.gnu@gmail.com> wrote:
> Hi Yang,
>
> This is how to reproduce the bug,
>
> [root@algodev ~]# uname -r
> 3.18.0+
>
> [root@algodev ~]# btrfs version
> Btrfs v3.18-2-g6938452-dirty
>
> [root@algodev ~]# btrfs quota enable LOOP/
> [root@algodev ~]# btrfs qgroup show LOOP/
> qgroupid rfer excl
> -------- ---- ----
> 0/5 16384 16384
>
> [root@algodev ~]# btrfs subvol create LOOP/subvol1
> Create subvolume 'LOOP/subvol1'
>
> [root@algodev ~]# btrfs qgroup limit 1g LOOP/subvol1/
>
> [root@algodev ~]# btrfs qgroup show LOOP/
> qgroupid rfer excl
> -------- ---- ----
> 0/5 16384 16384
> 0/258 16384 16384
>
> [root@algodev ~]# dd if=/dev/zero of=LOOP/subvol1/bigfile
> dd: writing to ‘LOOP/subvol1/bigfile’: Disk quota exceeded
> 2097018+0 records in
> 2097017+0 records out
> 1073672704 bytes (1.1 GB) copied, 10.0759 s, 107 MB/s
>
> [root@algodev ~]# rm -f LOOP/subvol1/bigfile
> rm: cannot remove ‘LOOP/subvol1/bigfile’: Disk quota exceeded
Hi Ahmed,
Okey, thanx for your example.
a). I guess your problem is getting a EQUOTA when remove a file here.
It's because we need to reserve some metadata in transaction of btrfs_unlink().
b). I think you patch here will not solve your problem. The root cause is
current quota in btrfs is accounting data and metadata together.
c). I admit getting a EQUOTA is strange when you did not writing anything but
only remove a file. I had a plan in my TODO list which is making qgroup to
limit and account the size in three modes, data, metadata and both.
Then in this case
if you only limit the size of data, you will not get a EQUOTA any more.
Thanx
Yang
> [root@algodev ~]#
>
> Best Regards,
> ~Khaled Ahmed
>
>
> On Jan 3, 2015, at 4:09 AM, Dongsheng Yang <dongsheng081251@gmail.com> wrote:
>
>> Hi Khaled,
>>
>> Could you give use more description about the problem this patch
>> is trying to solve? Maybe an example will help a lot to understand it.
>>
>> Thanx
>>
>> On Fri, Jan 2, 2015 at 7:48 AM, Khaled Ahmed <khaled.gnu@gmail.com> wrote:
>>> Signed-off-by: Khaled Ahmed <khaled.gnu@gmail.com>
>>> ---
>>> fs/btrfs/qgroup.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
>>> index 48b60db..b85200d 100644
>>> --- a/fs/btrfs/qgroup.c
>>> +++ b/fs/btrfs/qgroup.c
>>> @@ -2408,14 +2408,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
>>>
>>> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
>>> qg->reserved + (s64)qg->rfer + num_bytes >
>>> - qg->max_rfer) {
>>> + qg->max_rfer - 1 ) {
>>> ret = -EDQUOT;
>>> goto out;
>>> }
>>>
>>> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
>>> qg->reserved + (s64)qg->excl + num_bytes >
>>> - qg->max_excl) {
>>> + qg->max_excl - 1) {
>>> ret = -EDQUOT;
>>> goto out;
>>> }
>>> --
>>> 2.1.0
>>>
>>> --
>>> 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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-04 10:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01 23:48 [PATCH] Fixing quota error when removing files from a limit exceeded subvols Khaled Ahmed
2015-01-03 2:09 ` Dongsheng Yang
2015-01-03 14:29 ` Khaled Ahmed
2015-01-04 10:54 ` Dongsheng Yang
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.