dovecot: Don't flush attribute cache the first time when stating...

dovecot at dovecot.org dovecot at dovecot.org
Thu Nov 15 00:46:49 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/c1bd43be8f9a
changeset: 6799:c1bd43be8f9a
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Nov 15 00:46:43 2007 +0200
description:
Don't flush attribute cache the first time when stating a lock file. Usually
the locking works fine without it.

diffstat:

1 file changed, 7 insertions(+), 2 deletions(-)
src/lib/file-dotlock.c |    9 +++++++--

diffs (34 lines):

diff -r e70686f19f67 -r c1bd43be8f9a src/lib/file-dotlock.c
--- a/src/lib/file-dotlock.c	Thu Nov 15 00:38:05 2007 +0200
+++ b/src/lib/file-dotlock.c	Thu Nov 15 00:46:43 2007 +0200
@@ -66,6 +66,7 @@ struct lock_info {
 	unsigned int have_pid:1;
 	unsigned int pid_read:1;
 	unsigned int use_io_notify:1;
+	unsigned int lock_stated:1;
 };
 
 static struct dotlock *
@@ -155,8 +156,12 @@ static int update_lock_info(time_t now, 
 {
 	struct stat st;
 
-	if (lock_info->set->nfs_flush)
+	/* don't waste time flushing attribute cache the first time we're here.
+	   if it's stale we'll get back here soon. */
+	if (lock_info->set->nfs_flush && lock_info->lock_stated)
 		nfs_flush_attr_cache(lock_info->lock_path, TRUE);
+
+	lock_info->lock_stated = TRUE;
 	if (nfs_safe_lstat(lock_info->lock_path, &st) < 0) {
 		if (errno != ENOENT) {
 			i_error("lstat(%s) failed: %m", lock_info->lock_path);
@@ -448,7 +453,7 @@ static int dotlock_create(const char *pa
 	lock_info.lock_path = lock_path;
 	lock_info.fd = -1;
 	lock_info.use_io_notify = set->use_io_notify;
-;
+
 	last_notify = 0; do_wait = FALSE;
 
 	do {


More information about the dovecot-cvs mailing list