Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2935:0b72e95cd3ae HEAD
Don't try to fsck when we're modifying index. It could have happened with
corrupted transaction logs.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 05 Dec 2004 03:41:45 +0200 |
parents | c3ae75597952 |
children | 57f975a9b63b |
files | src/lib-index/mail-index-fsck.c src/lib-index/mail-index-private.h src/lib-index/mail-index-sync-update.c src/lib-index/mail-index.c |
diffstat | 4 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-fsck.c Sun Dec 05 03:38:17 2004 +0200 +++ b/src/lib-index/mail-index-fsck.c Sun Dec 05 03:41:45 2004 +0200 @@ -114,6 +114,11 @@ uoff_t file_offset; int ret, lock_log; + if (index->sync_update) { + /* we're modifying index, don't do anything */ + return 1; + } + lock_log = !index->log_locked; if (lock_log) { if (mail_transaction_log_sync_lock(index->log, &file_seq,
--- a/src/lib-index/mail-index-private.h Sun Dec 05 03:38:17 2004 +0200 +++ b/src/lib-index/mail-index-private.h Sun Dec 05 03:41:45 2004 +0200 @@ -127,6 +127,7 @@ unsigned int mmap_no_write:1; unsigned int readonly:1; unsigned int fsck:1; + unsigned int sync_update:1; }; enum mail_index_sync_handler_type {
--- a/src/lib-index/mail-index-sync-update.c Sun Dec 05 03:38:17 2004 +0200 +++ b/src/lib-index/mail-index-sync-update.c Sun Dec 05 03:41:45 2004 +0200 @@ -1108,6 +1108,9 @@ if (had_dirty) map->hdr.flags &= ~MAIL_INDEX_HDR_FLAG_HAVE_DIRTY; + /* make sure we don't go doing fsck while modifying the index */ + index->sync_update = TRUE; + first_append_uid = 0; check_ext_offsets = TRUE; while ((ret = mail_transaction_log_view_next(view->log_view, &thdr, @@ -1163,6 +1166,8 @@ map = view->map; mail_index_sync_map_deinit(&sync_map_ctx); + index->sync_update = FALSE; + if (ret < 0) { mail_index_view_unlock(view); return -1;
--- a/src/lib-index/mail-index.c Sun Dec 05 03:38:17 2004 +0200 +++ b/src/lib-index/mail-index.c Sun Dec 05 03:41:45 2004 +0200 @@ -657,8 +657,10 @@ if ((*map)->hdr.indexid != 0) { /* sync this as a view from transaction log. */ + index->sync_update = TRUE; ret = mail_index_sync_from_transactions(index, map, sync_to_index); + index->sync_update = FALSE; if (ret != 0) return ret;