# HG changeset patch # User Timo Sirainen # Date 1195129083 -7200 # Node ID 937faba78a6889931e5311dcc8ac894b573b74e9 # Parent 5382964fc01d2369ef93e31c58d463993dca948a Don't flush attribute cache twice after locking transaction log. diff -r 5382964fc01d -r 937faba78a68 src/lib-index/mail-transaction-log-file.c --- 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 */ diff -r 5382964fc01d -r 937faba78a68 src/lib-index/mail-transaction-log.c --- 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);