From: Timo Sirainen Date: Thu, 11 Mar 2021 14:56:32 +0000 (+0200) Subject: lib-storage: Replace mailbox_set_reason() with reason_code=storage:autoexpunge and... X-Git-Tag: 2.3.18~343 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ec30d083b28ebb16606201df8478ffa7cefde89;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Replace mailbox_set_reason() with reason_code=storage:autoexpunge and storage:mailbox_list_rebuild --- diff --git a/src/lib-storage/list/mail-storage-list-index-rebuild.c b/src/lib-storage/list/mail-storage-list-index-rebuild.c index 9e852e2d82..1e4f4627e7 100644 --- a/src/lib-storage/list/mail-storage-list-index-rebuild.c +++ b/src/lib-storage/list/mail-storage-list-index-rebuild.c @@ -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; diff --git a/src/lib-storage/mail-autoexpunge.c b/src/lib-storage/mail-autoexpunge.c index f7c4b5ab0d..73e764b02a 100644 --- a/src/lib-storage/mail-autoexpunge.c +++ b/src/lib-storage/mail-autoexpunge.c @@ -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; }