Re: [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas

2015-12-06 Thread Timo Sirainen
On 23 Mar 2015, at 22:32, Michał Giżyński  wrote:
> 
> 
> On 17.02.2015 20:03, Michał Giżyński wrote:
>> 
>> On 21.11.2014 20:04, Grzegorz Nosek wrote:
>>> Hi all,
>>> 
>>> I noticed that in some circumstances quota warnings are ignored. The bug 
>>> arises when both of the following are used:
>>> 
>>> 1. percentage-based quota warnings, i.e.:
>>> 
>>>  quota_warning = storage=1%% quota-warning 1 %u
>>> 
>>> 2. filesystem quota backend (and probably others, except for quotas 
>>> configured directly in dovecot config)
>>> 
>>> Percentage-based quota warnings have rule.bytes_limit recalculated based on 
>>> root_set->default_rule.bytes_limit, however this value is zero when FS 
>>> quotas are in use. Real quota values (from quotactl) are fetched very late, 
>>> in quota_warnings_execute() but at that point no recalculation happens. As 
>>> the warning rules have bytes_limit==0, they're effectively ignored.
>>> 
>>> The patch below enables quota warnings to be sent when using filesystem 
>>> (and possibly maildirsize-based) quotas.
>>> 
>>> Based and tested on Ubuntu 14.04's dovecot 2.2.9.
>>> 
>>> Best regards,
>>> Grzegorz Nosek
>>> 
>>> 
>>> diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c
>>> index adbd70d..8e4d7e0 100644
>>> --- a/src/plugins/quota/quota.c
>>> +++ b/src/plugins/quota/quota.c
>>> @@ -1163,6 +1163,8 @@ static void quota_warnings_execute(struct 
>>> quota_transaction_context *ctx,
>>>   &count_current, &count_limit) < 0)
>>>return;
>>> 
>>> +   quota_root_recalculate_relative_rules(root->set, bytes_limit, 
>>> count_limit);
>>> +
>>>bytes_before = bytes_current - ctx->bytes_used;
>>>count_before = count_current - ctx->count_used;
>>>for (i = 0; i < count; i++) {
>> Hi,
>> this patch realy fix the bug in quota_warning. Is it possible to add this 
>> patch to the next release ?
>> 
> Hi,
> I saw that new dovecot was released. Is the quota_warning has been improved ?

That patch is doing a bit too many recalculations, which also always trigger 
debug message logging if mail_debug=yes. The attached patch probably fixes the 
problem? I'll add it after v2.2.20 is released (because it's affecting so many 
different platforms that there's too big of a chance of it breaking one of them 
due to some typo).



quota-fs-rules-recalc.diff
Description: Binary data




Re: [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas

2015-03-23 Thread Michał Giżyński


On 17.02.2015 20:03, Michał Giżyński wrote:


On 21.11.2014 20:04, Grzegorz Nosek wrote:

Hi all,

I noticed that in some circumstances quota warnings are ignored. The 
bug arises when both of the following are used:


1. percentage-based quota warnings, i.e.:

  quota_warning = storage=1%% quota-warning 1 %u

2. filesystem quota backend (and probably others, except for quotas 
configured directly in dovecot config)


Percentage-based quota warnings have rule.bytes_limit recalculated 
based on root_set->default_rule.bytes_limit, however this value is 
zero when FS quotas are in use. Real quota values (from quotactl) are 
fetched very late, in quota_warnings_execute() but at that point no 
recalculation happens. As the warning rules have bytes_limit==0, 
they're effectively ignored.


The patch below enables quota warnings to be sent when using 
filesystem (and possibly maildirsize-based) quotas.


Based and tested on Ubuntu 14.04's dovecot 2.2.9.

Best regards,
 Grzegorz Nosek


diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c
index adbd70d..8e4d7e0 100644
--- a/src/plugins/quota/quota.c
+++ b/src/plugins/quota/quota.c
@@ -1163,6 +1163,8 @@ static void quota_warnings_execute(struct 
quota_transaction_context *ctx,

   &count_current, &count_limit) < 0)
return;

+   quota_root_recalculate_relative_rules(root->set, bytes_limit, 
count_limit);

+
bytes_before = bytes_current - ctx->bytes_used;
count_before = count_current - ctx->count_used;
for (i = 0; i < count; i++) {

Hi,
this patch realy fix the bug in quota_warning. Is it possible to add 
this patch to the next release ?



Hi,
I saw that new dovecot was released. Is the quota_warning has been 
improved ?


--
Pozdrawiam / Best Regards
Michał Giżyński


Re: [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas

2015-02-17 Thread Michał Giżyński


On 21.11.2014 20:04, Grzegorz Nosek wrote:

Hi all,

I noticed that in some circumstances quota warnings are ignored. The 
bug arises when both of the following are used:


1. percentage-based quota warnings, i.e.:

  quota_warning = storage=1%% quota-warning 1 %u

2. filesystem quota backend (and probably others, except for quotas 
configured directly in dovecot config)


Percentage-based quota warnings have rule.bytes_limit recalculated 
based on root_set->default_rule.bytes_limit, however this value is 
zero when FS quotas are in use. Real quota values (from quotactl) are 
fetched very late, in quota_warnings_execute() but at that point no 
recalculation happens. As the warning rules have bytes_limit==0, 
they're effectively ignored.


The patch below enables quota warnings to be sent when using 
filesystem (and possibly maildirsize-based) quotas.


Based and tested on Ubuntu 14.04's dovecot 2.2.9.

Best regards,
 Grzegorz Nosek


diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c
index adbd70d..8e4d7e0 100644
--- a/src/plugins/quota/quota.c
+++ b/src/plugins/quota/quota.c
@@ -1163,6 +1163,8 @@ static void quota_warnings_execute(struct 
quota_transaction_context *ctx,

   &count_current, &count_limit) < 0)
return;

+   quota_root_recalculate_relative_rules(root->set, bytes_limit, 
count_limit);

+
bytes_before = bytes_current - ctx->bytes_used;
count_before = count_current - ctx->count_used;
for (i = 0; i < count; i++) {

Hi,
this patch realy fix the bug in quota_warning. Is it possible to add 
this patch to the next release ?


--
Pozdrawiam / Best Regards
Michał Giżyński


[PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas

2014-11-22 Thread Grzegorz Nosek

Hi all,

I noticed that in some circumstances quota warnings are ignored. The bug 
arises when both of the following are used:


1. percentage-based quota warnings, i.e.:

  quota_warning = storage=1%% quota-warning 1 %u

2. filesystem quota backend (and probably others, except for quotas 
configured directly in dovecot config)


Percentage-based quota warnings have rule.bytes_limit recalculated based 
on root_set->default_rule.bytes_limit, however this value is zero when 
FS quotas are in use. Real quota values (from quotactl) are fetched very 
late, in quota_warnings_execute() but at that point no recalculation 
happens. As the warning rules have bytes_limit==0, they're effectively 
ignored.


The patch below enables quota warnings to be sent when using filesystem 
(and possibly maildirsize-based) quotas.


Based and tested on Ubuntu 14.04's dovecot 2.2.9.

Best regards,
 Grzegorz Nosek


diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c
index adbd70d..8e4d7e0 100644
--- a/src/plugins/quota/quota.c
+++ b/src/plugins/quota/quota.c
@@ -1163,6 +1163,8 @@ static void quota_warnings_execute(struct 
quota_transaction_context *ctx,

   &count_current, &count_limit) < 0)
return;

+   quota_root_recalculate_relative_rules(root->set, bytes_limit, 
count_limit);

+
bytes_before = bytes_current - ctx->bytes_used;
count_before = count_current - ctx->count_used;
for (i = 0; i < count; i++) {