]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Replace mailbox_set_reason() with reason_code=storage:autoexpunge and...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 11 Mar 2021 14:56:32 +0000 (16:56 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 29 Sep 2021 10:09:58 +0000 (10:09 +0000)
src/lib-storage/list/mail-storage-list-index-rebuild.c
src/lib-storage/mail-autoexpunge.c

index 9e852e2d825daf686ac95ed8431647c9efd06681..1e4f4627e75a529050722dd66b30132d26630ec9 100644 (file)
@@ -184,7 +184,6 @@ mail_storage_list_index_find_indexed_mailbox(struct mail_storage_list_index_rebu
                return 0;
 
        box = mailbox_alloc(info->ns->list, info->vname, MAILBOX_FLAG_IGNORE_ACLS);
-       mailbox_set_reason(box, "mailbox list rebuild");
        if (mailbox_get_metadata(box, MAILBOX_METADATA_GUID, &metadata) < 0) {
                mail_storage_set_critical(rebuild_ns->ns->storage,
                        "List rebuild: Couldn't lookup mailbox %s GUID: %s",
@@ -301,7 +300,6 @@ mail_storage_list_index_try_create(struct mail_storage_list_index_rebuild_ctx *c
        e_debug(box->event, "Mailbox GUID %s exists in storage, but not in list index",
                guid_128_to_string(guid_p));
 
-       mailbox_set_reason(box, "mailbox list rebuild restore");
        box->corrupted_mailbox_name = TRUE;
        if (mailbox_exists(box, FALSE, &existence) < 0) {
                mail_storage_set_critical(storage,
@@ -444,9 +442,12 @@ static int mail_storage_list_index_rebuild_int(struct mail_storage *storage)
                   this avoids race conditions between other list rebuilds and also
                   makes sure that other processes creating/deleting mailboxes can't
                   cause confusion with race conditions. */
+               struct event_reason *reason =
+                       event_reason_begin("storage:mailbox_list_rebuild");
                if ((ret = mail_storage_list_index_rebuild_lock_lists(&ctx)) == 0)
                        ret = mail_storage_list_index_rebuild_ctx(&ctx);
                mail_storage_list_index_rebuild_unlock_lists(&ctx);
+               event_reason_end(&reason);
        } else
                ret = 0;
 
index f7c4b5ab0daef3f912ed2fee6505ead165376de0..73e764b02a842b1baf2fed50ca04661fe5d659b1 100644 (file)
@@ -179,7 +179,6 @@ mailbox_autoexpunge_set(struct mail_namespace *ns, const char *vname,
           any ACLs the user might normally have against expunging in
           the mailbox. */
        box = mailbox_alloc(ns->list, vname, MAILBOX_FLAG_IGNORE_ACLS);
-       mailbox_set_reason(box, "autoexpunge");
        if (mailbox_autoexpunge(box, autoexpunge, autoexpunge_max_mails,
                                expunged_count) < 0) {
                e_error(box->event, "Failed to autoexpunge: %s",
@@ -253,6 +252,8 @@ unsigned int mail_user_autoexpunge(struct mail_user *user)
        struct file_lock *lock = NULL;
        struct mail_namespace *ns;
        unsigned int expunged_count = 0;
+       struct event_reason *reason =
+               event_reason_begin("storage:autoexpunge");
 
        for (ns = user->namespaces; ns != NULL; ns = ns->next) {
                if (ns->alias_for == NULL) {
@@ -260,6 +261,7 @@ unsigned int mail_user_autoexpunge(struct mail_user *user)
                                break;
                }
        }
+       event_reason_end(&reason);
        file_lock_free(&lock);
        return expunged_count;
 }