]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: index_index_rebuild_init() - Assert-crash if index isn't locked
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 16 Apr 2020 11:46:28 +0000 (14:46 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 16 Apr 2020 11:52:42 +0000 (14:52 +0300)
src/lib-storage/index/index-rebuild.c

index b6cac3d226ed4142ec6cd81a1bdd400d77059963..b1db6b251c791693fd48cb116bdd7aacd89fe747 100644 (file)
@@ -200,6 +200,11 @@ index_index_rebuild_init(struct mailbox *box, struct mail_index_view *view,
        const char *index_dir, *backup_path;
        enum mail_index_open_flags open_flags = MAIL_INDEX_OPEN_FLAG_READONLY;
 
+       /* Rebuilding really should be done locked so multiple processes won't
+          try to rebuild concurrently. Also at the end of rebiuld cache
+          purging requires this lock. */
+       i_assert(mail_index_is_locked(view->index));
+
        ctx = i_new(struct index_rebuild_context, 1);
        ctx->box = box;
        ctx->view = view;