Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-index/mail-index.c @ 6829:dbab5e592577 HEAD
NFS cache flushing APIs changed and backend implements it a bit differently.
Hopefully this works now more correctly.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 18 Nov 2007 08:40:59 +0200 |
parents | 256725979152 |
children | 41911abe6fa7 |
line wrap: on
line diff
--- a/src/lib-index/mail-index.c Sun Nov 18 08:01:54 2007 +0200 +++ b/src/lib-index/mail-index.c Sun Nov 18 08:40:59 2007 +0200 @@ -248,9 +248,6 @@ i_assert(index->fd == -1); i_assert(!MAIL_INDEX_IS_IN_MEMORY(index)); - if (index->nfs_flush) - nfs_flush_attr_cache(index->filepath); - /* Note that our caller must close index->fd by itself. */ if (index->readonly) errno = EACCES; @@ -465,6 +462,7 @@ { struct stat st1, st2; + i_assert(index->shared_lock_count == 0 || !index->nfs_flush); i_assert(index->excl_lock_count == 0); if (MAIL_INDEX_IS_IN_MEMORY(index)) @@ -474,30 +472,19 @@ return mail_index_try_open_only(index); if (index->nfs_flush) - nfs_flush_attr_cache(index->filepath); + nfs_flush_attr_cache_unlocked(index->filepath); if (nfs_safe_stat(index->filepath, &st2) < 0) { if (errno == ENOENT) return 0; - return mail_index_set_syscall_error(index, "stat()"); } - if (index->nfs_flush) { - if (!nfs_flush_attr_cache_fd(index->filepath, index->fd)) { - /* deleted/recreated, reopen */ - mail_index_close_file(index); - return mail_index_try_open_only(index); - } - } if (fstat(index->fd, &st1) < 0) { if (errno != ESTALE) return mail_index_set_syscall_error(index, "fstat()"); /* deleted/recreated, reopen */ - mail_index_close_file(index); - return mail_index_try_open_only(index); - } - - if (st1.st_ino == st2.st_ino && CMP_DEV_T(st1.st_dev, st2.st_dev)) { + } else if (st1.st_ino == st2.st_ino && + CMP_DEV_T(st1.st_dev, st2.st_dev)) { /* the same file */ return 1; }