# HG changeset patch # User Timo Sirainen # Date 1195079885 -7200 # Node ID e70686f19f678a0a454a5069cc75579809e02c86 # Parent a59deefc552fc0e7c68d262e7ea310156bc94169 Don't flush attribute cache unless we're locked and we really need to know the latest changes. diff -r a59deefc552f -r e70686f19f67 src/lib-index/mail-transaction-log-file.c --- a/src/lib-index/mail-transaction-log-file.c Wed Nov 14 23:52:33 2007 +0200 +++ b/src/lib-index/mail-transaction-log-file.c Thu Nov 15 00:38:05 2007 +0200 @@ -893,7 +893,7 @@ i_assert(file->mmap_base == NULL); - if (file->log->index->nfs_flush) { + if (file->log->index->nfs_flush && file->locked) { /* Make sure we know the latest file size */ nfs_flush_attr_cache_fd(file->filepath, file->fd); } diff -r a59deefc552f -r e70686f19f67 src/lib-index/mail-transaction-log.c --- a/src/lib-index/mail-transaction-log.c Wed Nov 14 23:52:33 2007 +0200 +++ b/src/lib-index/mail-transaction-log.c Thu Nov 15 00:38:05 2007 +0200 @@ -278,7 +278,7 @@ path = t_strconcat(log->index->filepath, MAIL_TRANSACTION_LOG_SUFFIX, NULL); - if (log->index->nfs_flush) + if (log->index->nfs_flush && log->head->locked) nfs_flush_attr_cache(path, TRUE); if (nfs_safe_stat(path, &st) < 0) { if (errno != ENOENT) { @@ -300,6 +300,10 @@ 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; diff -r a59deefc552f -r e70686f19f67 src/lib-storage/index/maildir/maildir-keywords.c --- a/src/lib-storage/index/maildir/maildir-keywords.c Wed Nov 14 23:52:33 2007 +0200 +++ b/src/lib-storage/index/maildir/maildir-keywords.c Thu Nov 15 00:38:05 2007 +0200 @@ -118,7 +118,7 @@ errors. */ if ((mk->storage->flags & MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE) != 0) - nfs_flush_attr_cache(mk->path, TRUE); + nfs_flush_attr_cache(mk->path, FALSE); if (nfs_safe_stat(mk->path, &st) < 0) { if (errno == ENOENT) { diff -r a59deefc552f -r e70686f19f67 src/lib-storage/index/maildir/maildir-uidlist.c --- a/src/lib-storage/index/maildir/maildir-uidlist.c Wed Nov 14 23:52:33 2007 +0200 +++ b/src/lib-storage/index/maildir/maildir-uidlist.c Thu Nov 15 00:38:05 2007 +0200 @@ -630,7 +630,9 @@ *recreated_r = FALSE; - if ((storage->flags & MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE) != 0) + /* don't bother flushing attribute caches unless uidlist is locked */ + if ((storage->flags & MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE) != 0 && + UIDLIST_IS_LOCKED(uidlist)) nfs_flush_attr_cache(uidlist->path, TRUE); if (nfs_safe_stat(uidlist->path, &st) < 0) { @@ -649,12 +651,15 @@ return 1; } - /* either the file hasn't been changed, or it has already been deleted - and the inodes just happen to be the same. check if the fd is still - valid. */ - if (!nfs_flush_attr_cache_fd(uidlist->path, uidlist->fd)) { - *recreated_r = TRUE; - return 1; + if ((storage->flags & MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE) != 0 && + UIDLIST_IS_LOCKED(uidlist)) { + /* NFS: either the file hasn't been changed, or it has already + been deleted and the inodes just happen to be the same. + check if the fd is still valid. */ + if (!nfs_flush_attr_cache_fd(uidlist->path, uidlist->fd)) { + *recreated_r = TRUE; + return 1; + } } if (st.st_size != uidlist->fd_size) { @@ -681,7 +686,8 @@ if (recreated) maildir_uidlist_close(uidlist); } else { - if ((storage->flags & MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE) != 0) + if (UIDLIST_IS_LOCKED(uidlist) && + (storage->flags & MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE) != 0) nfs_flush_attr_cache(uidlist->path, TRUE); }