Grzegorz Nosek
2014-Nov-21 19:04 UTC
[PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
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++) {
Michał Giżyński
2015-Feb-17 19:03 UTC
[PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
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
Michał Giżyński
2015-Mar-23 20:32 UTC
[PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
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
Apparently Analagous Threads
- [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
- [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
- quota_wrning not working for me (quota_rewrite patch for dovecot 1.0.8)
- Question regarding reverse quota_warning
- Quota warning generated when crossing on both sides