]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Add QUOTA_ALLOC_RESULT_BACKGROUND_CALC enum value
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Thu, 2 Nov 2017 10:04:46 +0000 (12:04 +0200)
committerTimo Sirainen <tss@dovecot.fi>
Thu, 9 Nov 2017 10:52:11 +0000 (12:52 +0200)
src/plugins/quota/quota-status.c
src/plugins/quota/quota-storage.c
src/plugins/quota/quota.c
src/plugins/quota/quota.h

index 1b227339ff5f5f4f3804fd048abc02396af4d5f9..3a466de95e61dec214bcb7ff487b15dc6af20fc3 100644 (file)
@@ -128,6 +128,7 @@ static void client_handle_request(struct quota_client *client)
                                value = t_strdup_printf("554 5.2.2 %s", error);
                        break;
                case QUOTA_ALLOC_RESULT_TEMPFAIL:
+               case QUOTA_ALLOC_RESULT_BACKGROUND_CALC:
                        ret = -1;
                        break;
                }
index 41cff34b3489a801ba8e159f32f0c9801c438af2..1affc1f7fa2bb3ef1db1affaa1fcb4d95a60e1be 100644 (file)
@@ -61,6 +61,7 @@ static void quota_set_storage_error(struct quota_transaction_context *qt,
                mail_storage_set_error(storage, MAIL_ERROR_NOQUOTA, errstr);
                break;
        case QUOTA_ALLOC_RESULT_TEMPFAIL:
+       case QUOTA_ALLOC_RESULT_BACKGROUND_CALC:
                mail_storage_set_critical(storage, "quota: %s", internal_err);
                break;
        case QUOTA_ALLOC_RESULT_OK:
@@ -261,6 +262,10 @@ static int quota_check(struct mail_save_context *ctx, struct mailbox *src_box)
                /* Log the error, but allow saving anyway. */
                i_error("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
                return 0;
+       case QUOTA_ALLOC_RESULT_BACKGROUND_CALC:
+               /* Could not determine if there is enough space due to ongoing
+                  background quota calculation, allow saving anyway. */
+               return 0;
        default:
                quota_set_storage_error(qt, t->box->storage, ret, error);
                return -1;
@@ -324,6 +329,11 @@ quota_save_begin(struct mail_save_context *ctx, struct istream *input)
                        /* Log the error, but allow saving anyway. */
                        i_error("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
                        break;
+               case QUOTA_ALLOC_RESULT_BACKGROUND_CALC:
+                       /* Could not determine if there is enough space due to
+                        * ongoing background quota calculation, allow saving
+                        * anyway. */
+                       break;
                default:
                        quota_set_storage_error(qt, t->box->storage, qret, error);
                        return -1;
index 9011101f51d26b46d56cacd2cdbd7dd3c5b57494..ebfa710e29a677069e150e146ba4e7c196f58b40 100644 (file)
@@ -283,6 +283,8 @@ const char *quota_alloc_result_errstr(enum quota_alloc_result res,
        switch (res) {
        case QUOTA_ALLOC_RESULT_OK:
                return "OK";
+       case QUOTA_ALLOC_RESULT_BACKGROUND_CALC:
+               return "Blocked by an ongoing background quota calculation";
        case QUOTA_ALLOC_RESULT_TEMPFAIL:
                return "Internal quota calculation error";
        case QUOTA_ALLOC_RESULT_OVER_MAXSIZE:
index fcb0dcb526a554b6fbf9fe218d741499f977d7a6..cd3a251b27f1b22c45d394aac60ab9b65f3cabe4 100644 (file)
@@ -47,6 +47,8 @@ enum quota_alloc_result {
        QUOTA_ALLOC_RESULT_OVER_QUOTA,
        /* Mail size is larger than even the maximum allowed quota. */
        QUOTA_ALLOC_RESULT_OVER_QUOTA_LIMIT,
+       /* Blocked by ongoing background quota calculation. */
+       QUOTA_ALLOC_RESULT_BACKGROUND_CALC,
 };
 
 /* Anything <= QUOTA_GET_RESULT_INTERNAL_ERROR is an error. */