# HG changeset patch # User Aki Tuomi # Date 1507102337 -10800 # Node ID 73e9c31c22dd8e86a6aee28108d7b392b672f072 # Parent 400ff84f109dbbee328ec11b182b50a3cf405728 quota-clone: Always update dict ret_count and ret_bytes become zero if no quota rules are specified, so we need to update the dict anyways. Broken in 81d10aff29baede9ae4944d6c89790871123d11d diff -r 400ff84f109d -r 73e9c31c22dd src/plugins/quota-clone/quota-clone-plugin.c --- a/src/plugins/quota-clone/quota-clone-plugin.c Fri Sep 22 13:30:43 2017 +0300 +++ b/src/plugins/quota-clone/quota-clone-plugin.c Wed Oct 04 10:32:17 2017 +0300 @@ -72,24 +72,14 @@ i_error("quota_clone_plugin: Failed to lookup current quota count"); return; } - if (ret_bytes == 0 && ret_count == 0) { - /* quota isn't enabled - no point in updating it */ - return; - } - /* Then update the resources that exist. The resources can't really - change unless the quota backend is changed, so we don't worry about - the special case of ret_count changing between 1 and 0. Note that - ret_count==1 also when quota is unlimited. */ + /* update resources always regardless of existence, + FIXME: This should be fixed in v2.3 */ trans = dict_transaction_begin(quser->dict); - if (ret_bytes > 0) { - dict_set(trans, DICT_QUOTA_CLONE_BYTES_PATH, - t_strdup_printf("%llu", (unsigned long long)bytes_value)); - } - if (ret_count > 0) { - dict_set(trans, DICT_QUOTA_CLONE_COUNT_PATH, - t_strdup_printf("%llu", (unsigned long long)count_value)); - } + dict_set(trans, DICT_QUOTA_CLONE_BYTES_PATH, + t_strdup_printf("%llu", (unsigned long long)bytes_value)); + dict_set(trans, DICT_QUOTA_CLONE_COUNT_PATH, + t_strdup_printf("%llu", (unsigned long long)count_value)); if (dict_transaction_commit(&trans) < 0) i_error("quota_clone_plugin: Failed to commit dict update"); else