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,
On 21.11.2014 20:04, Grzegorz Nosek wrote: 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