From: Timo Sirainen Date: Fri, 27 Mar 2020 11:01:57 +0000 (+0200) Subject: lib-index: mail_cache_compress_with_trans() - Require that transaction log is locked X-Git-Tag: 2.3.11.2~410 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d5f8b2ea70072526f281096b507c33d9e91e6da4;p=thirdparty%2Fdovecot%2Fcore.git lib-index: mail_cache_compress_with_trans() - Require that transaction log is locked This should be true now for all of its callers. --- diff --git a/src/lib-index/mail-cache-compress.c b/src/lib-index/mail-cache-compress.c index 9d4f0c3334..5225defbbc 100644 --- a/src/lib-index/mail-cache-compress.c +++ b/src/lib-index/mail-cache-compress.c @@ -505,6 +505,7 @@ mail_cache_compress_full(struct mail_cache *cache, int ret; i_assert(!cache->compressing); + i_assert(cache->index->log_sync_locked); *lock_r = NULL; diff --git a/src/lib-index/mail-cache.h b/src/lib-index/mail-cache.h index a01562a2e1..b1ce97cae1 100644 --- a/src/lib-index/mail-cache.h +++ b/src/lib-index/mail-cache.h @@ -67,11 +67,8 @@ mail_cache_register_get_list(struct mail_cache *cache, pool_t pool, /* Returns TRUE if cache should be compressed. */ bool mail_cache_need_compress(struct mail_cache *cache); -/* Compress cache file. Offsets are updated to given transaction. The cache - compression lock should be kept until the transaction is committed. - mail_cache_compress_unlock() needs to be called afterwards. The lock doesn't - prevent updates to the cache while it's held, it only prevents another cache - compression. +/* Compress cache file. Offsets are updated to given transaction. + The transaction log must already be exclusively locked. The cache compression is done only if the current cache file's file_seq matches compress_file_seq. The idea is that compression isn't done if