* [PATCH RFC] Btrfs: fix confusing edquot happening case
@ 2013-04-15 10:37 Wang Shilong
2013-04-15 10:45 ` Arne Jansen
0 siblings, 1 reply; 4+ messages in thread
From: Wang Shilong @ 2013-04-15 10:37 UTC (permalink / raw)
To: Linux Btrfs; +Cc: Arne Jansen, Jan Schmidt
Step to reproduce:
mkfs.btrfs <disk>
mount <disk> <mnt>
dd if=/dev/zero of=/<mnt>/data bs=1M count=10
sync
btrfs quota enable <mnt>
btrfs qgroup create 0/5 <mnt>
btrfs qgroup limit 5M 0/5 <mnt>
rm -f /<mnt>/data
sync
btrfs qgroup show <mnt>
dd if=/dev/zero of=data bs=1M count=1
>From the perspective of users, qgroup's referenced or referenced
is negative,But user can not continue to write data! a workaround
way is to cast u64 to int64 when doing qgroup reservation.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
This confusing edquot may also happen after Jan's qgroup
rescan has been implemented.
---
fs/btrfs/qgroup.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index b44124d..0178223 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1523,14 +1523,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
qg = (struct btrfs_qgroup *)(uintptr_t)unode->aux;
if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
- qg->reserved + qg->rfer + num_bytes >
+ qg->reserved + (signed long long)qg->rfer + num_bytes >
qg->max_rfer) {
ret = -EDQUOT;
goto out;
}
if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
- qg->reserved + qg->excl + num_bytes >
+ qg->reserved + (signed long long)qg->excl + num_bytes >
qg->max_excl) {
ret = -EDQUOT;
goto out;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] Btrfs: fix confusing edquot happening case
2013-04-15 10:37 [PATCH RFC] Btrfs: fix confusing edquot happening case Wang Shilong
@ 2013-04-15 10:45 ` Arne Jansen
2013-04-15 11:43 ` Wang Shilong
0 siblings, 1 reply; 4+ messages in thread
From: Arne Jansen @ 2013-04-15 10:45 UTC (permalink / raw)
To: Wang Shilong; +Cc: Linux Btrfs, Jan Schmidt
On 15.04.2013 12:37, Wang Shilong wrote:
> Step to reproduce:
> mkfs.btrfs <disk>
> mount <disk> <mnt>
> dd if=/dev/zero of=/<mnt>/data bs=1M count=10
> sync
> btrfs quota enable <mnt>
> btrfs qgroup create 0/5 <mnt>
> btrfs qgroup limit 5M 0/5 <mnt>
> rm -f /<mnt>/data
> sync
> btrfs qgroup show <mnt>
> dd if=/dev/zero of=data bs=1M count=1
>
> From the perspective of users, qgroup's referenced or referenced
>
> is negative,But user can not continue to write data! a workaround
> way is to cast u64 to int64 when doing qgroup reservation.
>
> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> ---
> This confusing edquot may also happen after Jan's qgroup
> rescan has been implemented.
> ---
> fs/btrfs/qgroup.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index b44124d..0178223 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -1523,14 +1523,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
> qg = (struct btrfs_qgroup *)(uintptr_t)unode->aux;
>
> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
> - qg->reserved + qg->rfer + num_bytes >
> + qg->reserved + (signed long long)qg->rfer + num_bytes >
why not use s64 instead of signed long long? Otherwise this is the right way to
solve this.
Thanks,
Arne
> qg->max_rfer) {
> ret = -EDQUOT;
> goto out;
> }
>
> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
> - qg->reserved + qg->excl + num_bytes >
> + qg->reserved + (signed long long)qg->excl + num_bytes >
> qg->max_excl) {
> ret = -EDQUOT;
> goto out;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] Btrfs: fix confusing edquot happening case
2013-04-15 10:45 ` Arne Jansen
@ 2013-04-15 11:43 ` Wang Shilong
2013-04-15 12:03 ` Arne Jansen
0 siblings, 1 reply; 4+ messages in thread
From: Wang Shilong @ 2013-04-15 11:43 UTC (permalink / raw)
To: Arne Jansen; +Cc: Wang Shilong, Linux Btrfs, Jan Schmidt
Hello Arne,
> On 15.04.2013 12:37, Wang Shilong wrote:
>> Step to reproduce:
>> mkfs.btrfs <disk>
>> mount <disk> <mnt>
>> dd if=/dev/zero of=/<mnt>/data bs=1M count=10
>> sync
>> btrfs quota enable <mnt>
>> btrfs qgroup create 0/5 <mnt>
>> btrfs qgroup limit 5M 0/5 <mnt>
>> rm -f /<mnt>/data
>> sync
>> btrfs qgroup show <mnt>
>> dd if=/dev/zero of=data bs=1M count=1
>>
>> From the perspective of users, qgroup's referenced or referenced
>>
>> is negative,But user can not continue to write data! a workaround
>> way is to cast u64 to int64 when doing qgroup reservation.
>>
>> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
>> ---
>> This confusing edquot may also happen after Jan's qgroup
>> rescan has been implemented.
>> ---
>> fs/btrfs/qgroup.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
>> index b44124d..0178223 100644
>> --- a/fs/btrfs/qgroup.c
>> +++ b/fs/btrfs/qgroup.c
>> @@ -1523,14 +1523,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
>> qg = (struct btrfs_qgroup *)(uintptr_t)unode->aux;
>>
>> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
>> - qg->reserved + qg->rfer + num_bytes >
>> + qg->reserved + (signed long long)qg->rfer + num_bytes >
>
> why not use s64 instead of signed long long? Otherwise this is the right way to
> solve this.
Yeah,V2 is coming. By the way, do you mind that i add Acked-by: Arne Jasen <sensille@gmx.net>?
Thanks,
Wang
>
> Thanks,
> Arne
>
>> qg->max_rfer) {
>> ret = -EDQUOT;
>> goto out;
>> }
>>
>> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
>> - qg->reserved + qg->excl + num_bytes >
>> + qg->reserved + (signed long long)qg->excl + num_bytes >
>> qg->max_excl) {
>> ret = -EDQUOT;
>> goto out;
>
> --
> 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 RFC] Btrfs: fix confusing edquot happening case
2013-04-15 11:43 ` Wang Shilong
@ 2013-04-15 12:03 ` Arne Jansen
0 siblings, 0 replies; 4+ messages in thread
From: Arne Jansen @ 2013-04-15 12:03 UTC (permalink / raw)
To: Wang Shilong; +Cc: Wang Shilong, Linux Btrfs, Jan Schmidt
On 15.04.2013 13:43, Wang Shilong wrote:
> Hello Arne,
>
>> On 15.04.2013 12:37, Wang Shilong wrote:
>>> Step to reproduce:
>>> mkfs.btrfs <disk>
>>> mount <disk> <mnt>
>>> dd if=/dev/zero of=/<mnt>/data bs=1M count=10
>>> sync
>>> btrfs quota enable <mnt>
>>> btrfs qgroup create 0/5 <mnt>
>>> btrfs qgroup limit 5M 0/5 <mnt>
>>> rm -f /<mnt>/data
>>> sync
>>> btrfs qgroup show <mnt>
>>> dd if=/dev/zero of=data bs=1M count=1
>>>
>>> From the perspective of users, qgroup's referenced or referenced
>>>
>>> is negative,But user can not continue to write data! a workaround
>>> way is to cast u64 to int64 when doing qgroup reservation.
>>>
>>> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
>>> ---
>>> This confusing edquot may also happen after Jan's qgroup
>>> rescan has been implemented.
>>> ---
>>> fs/btrfs/qgroup.c | 4 ++--
>>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
>>> index b44124d..0178223 100644
>>> --- a/fs/btrfs/qgroup.c
>>> +++ b/fs/btrfs/qgroup.c
>>> @@ -1523,14 +1523,14 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
>>> qg = (struct btrfs_qgroup *)(uintptr_t)unode->aux;
>>>
>>> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
>>> - qg->reserved + qg->rfer + num_bytes >
>>> + qg->reserved + (signed long long)qg->rfer + num_bytes >
>>
>> why not use s64 instead of signed long long? Otherwise this is the right way to
>> solve this.
>
> Yeah,V2 is coming. By the way, do you mind that i add Acked-by: Arne Jasen <sensille@gmx.net>?
You can add a Reviewed-by: Arne Jansen <sensille@gmx.net>
Thanks,
Arne
>
> Thanks,
> Wang
>>
>> Thanks,
>> Arne
>>
>>> qg->max_rfer) {
>>> ret = -EDQUOT;
>>> goto out;
>>> }
>>>
>>> if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
>>> - qg->reserved + qg->excl + num_bytes >
>>> + qg->reserved + (signed long long)qg->excl + num_bytes >
>>> qg->max_excl) {
>>> ret = -EDQUOT;
>>> goto out;
>>
>> --
>> 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
>
> --
> 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:[~2013-04-15 12:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-15 10:37 [PATCH RFC] Btrfs: fix confusing edquot happening case Wang Shilong
2013-04-15 10:45 ` Arne Jansen
2013-04-15 11:43 ` Wang Shilong
2013-04-15 12:03 ` Arne Jansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox