Mercurial > dovecot > original-hg > dovecot-1.2
changeset 1887:75d86ebb844e HEAD
update lock counters with in-memory indexes too
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 13 Nov 2003 21:32:07 +0200 |
parents | de4b5d7ec9b2 |
children | 4c94ab0ff8de |
files | src/lib-index/mail-index.c |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index.c Thu Nov 13 18:05:36 2003 +0200 +++ b/src/lib-index/mail-index.c Thu Nov 13 21:32:07 2003 +0200 @@ -434,6 +434,12 @@ 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 @@ } 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 @@ /* 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. */