]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
update lock counters with in-memory indexes too
authorTimo Sirainen <tss@iki.fi>
Thu, 13 Nov 2003 19:32:07 +0000 (21:32 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 13 Nov 2003 19:32:07 +0000 (21:32 +0200)
--HG--
branch : HEAD

src/lib-index/mail-index.c

index 1bdf0ff12cb8fde0ae4d820fc80baf86116cdf01..83dba8ba65ea20749431f7673897c0461195112a 100644 (file)
@@ -434,6 +434,12 @@ static int mail_index_lock_full(struct mail_index *index,
        if (index->lock_type == lock_type)
                return TRUE;
 
+       if (index->lock_type == MAIL_LOCK_EXCLUSIVE) {
+               index->excl_lock_counter++;
+               if (index->modifylog != NULL)
+                       mail_modifylog_notify_lock_drop(index->modifylog);
+       }
+
        if (index->anon_mmap) {
                /* anonymous mmaps are private and don't need any locking */
 #ifdef DEBUG
@@ -449,10 +455,6 @@ static int mail_index_lock_full(struct mail_index *index,
        }
 
        if (index->lock_type == MAIL_LOCK_EXCLUSIVE) {
-               index->excl_lock_counter++;
-               if (index->modifylog != NULL)
-                       mail_modifylog_notify_lock_drop(index->modifylog);
-
                /* dropping exclusive lock (either unlock or to shared) */
                keep_fsck = (index->set_flags & MAIL_INDEX_HDR_FLAG_FSCK) != 0;
                mail_index_update_header_changes(index);
@@ -465,8 +467,7 @@ static int mail_index_lock_full(struct mail_index *index,
                /* remove the FSCK flag only after successful fsync() */
                if (mail_index_sync_file(index) && !keep_fsck) {
                        index->header->flags &= ~MAIL_INDEX_HDR_FLAG_FSCK;
-                       if (!index->anon_mmap &&
-                           msync(index->mmap_base, index->header_size,
+                       if (msync(index->mmap_base, index->header_size,
                                  MS_SYNC) < 0) {
                                /* we only failed to remove the fsck flag,
                                   so this isn't fatal. */