Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6808:937faba78a68 HEAD
Don't flush attribute cache twice after locking transaction log.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 15 Nov 2007 14:18:03 +0200 |
parents | 5382964fc01d |
children | 9d8c00d4c467 |
files | src/lib-index/mail-transaction-log-file.c src/lib-index/mail-transaction-log.c |
diffstat | 2 files changed, 14 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-file.c Thu Nov 15 13:32:10 2007 +0200 +++ b/src/lib-index/mail-transaction-log-file.c Thu Nov 15 14:18:03 2007 +0200 @@ -914,11 +914,13 @@ i_assert(file->mmap_base == NULL); - if (file->log->index->nfs_flush && (file->locked || nfs_flush)) { - /* Make sure we know the latest file size */ + /* NFS: if file isn't locked, we're optimistic that we can read enough + data without flushing attribute cache. if after reading we notice + that we really should have read more, flush the cache and try again. + if file is locked, the attribute cache was already flushed when + refreshing the log. */ + if (file->log->index->nfs_flush && nfs_flush) nfs_flush_attr_cache_fd(file->filepath, file->fd); - nfs_flush = TRUE; - } if (file->buffer != NULL && file->buffer_offset > start_offset) { /* we have to insert missing data to beginning of buffer */
--- a/src/lib-index/mail-transaction-log.c Thu Nov 15 13:32:10 2007 +0200 +++ b/src/lib-index/mail-transaction-log.c Thu Nov 15 14:18:03 2007 +0200 @@ -297,19 +297,14 @@ file->refcount--; log->index->need_recreate = TRUE; return 0; - } else { - if (log->head->st_ino == st.st_ino && - CMP_DEV_T(log->head->st_dev, st.st_dev)) { - /* same file? */ - if (!log->head->locked) { - /* we don't care that much, it most likely is */ - return 0; - } - if (nfs_flush_attr_cache_fd(log->head->filepath, - log->head->fd)) - return 0; - /* nope */ - } + } else if (log->head->st_ino == st.st_ino && + CMP_DEV_T(log->head->st_dev, st.st_dev)) { + /* NFS: log files get rotated to .log.2 files instead + of being unlinked, so we don't bother checking if + the existing file has already been unlinked here + (in which case inodes could match but point to + different files) */ + return 0; } file = mail_transaction_log_file_alloc(log, path);