[dovecot-cvs] dovecot/src/lib-index mail-custom-flags.c,1.13,1.14 mail-index-open.c,1.18,1.19 mail-index-util.c,1.14,1.15 mail-index-util.h,1.7,1.8 mail-index.c,1.74,1.75 mail-index.h,1.54,1.55 mail-modifylog.c,1.35,1.36

cras at procontrol.fi cras at procontrol.fi
Mon Nov 25 21:02:51 EET 2002


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv2991/src/lib-index

Modified Files:
	mail-custom-flags.c mail-index-open.c mail-index-util.c 
	mail-index-util.h mail-index.c mail-index.h mail-modifylog.c 
Log Message:
Locking changes triggered a bit larger cleanup :) If we have to wait for a
lock longer, the client is now notified about it every 30 seconds. Also if
mailbox opening fails because of lock timeout, we won't overwrite the index
anymore. Finally user gets a clear error message about lock timeout instead
of "internal error".



Index: mail-custom-flags.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-custom-flags.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- mail-custom-flags.c	4 Nov 2002 07:11:32 -0000	1.13
+++ mail-custom-flags.c	25 Nov 2002 19:02:49 -0000	1.14
@@ -195,7 +195,8 @@
 	if (mcf->lock_type == type)
 		return TRUE;
 
-	if (file_wait_lock(mcf->fd, type, DEFAULT_LOCK_TIMEOUT) <= 0)
+	/* FIXME: possibility to use .lock file instead */
+	if (file_wait_lock(mcf->fd, type) <= 0)
 		return index_cf_set_syscall_error(mcf, "file_wait_lock()");
 
 	mcf->lock_type = type;

Index: mail-index-open.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-open.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mail-index-open.c	21 Nov 2002 20:50:53 -0000	1.18
+++ mail-index-open.c	25 Nov 2002 19:02:49 -0000	1.19
@@ -245,49 +245,53 @@
 	return TRUE;
 }
 
+static int mail_index_verify_header(MailIndex *index, MailIndexHeader *hdr)
+{
+	/* if index is being created, we'll wait here until it's finished */
+	if (!mail_index_wait_lock(index, F_RDLCK))
+		return FALSE;
+
+	/* check the compatibility anyway just to be sure */
+	if (!read_and_verify_header(index->fd, hdr, TRUE)) {
+		index_set_error(index, "Non-compatible index file %s",
+				index->filepath);
+		(void)mail_index_wait_lock(index, F_UNLCK);
+		return FALSE;
+	}
+
+	if (!mail_index_wait_lock(index, F_UNLCK))
+		return FALSE;
+
+	return TRUE;
+}
+
 static int mail_index_open_file(MailIndex *index, const char *path,
 				int update_recent, int fast)
 {
         MailIndexHeader hdr;
-	int fd, failed;
 
 	/* the index file should already be checked that it exists and
 	   we're compatible with it. */
 
-	fd = open(path, O_RDWR);
-	if (fd == -1)
+	index->fd = open(path, O_RDWR);
+	if (index->fd == -1)
 		return index_file_set_syscall_error(index, path, "open()");
+	index->filepath = i_strdup(path);
 
-	/* if index is being created, we'll wait here until it's finished */
-	if (file_wait_lock(fd, F_RDLCK, DEFAULT_LOCK_TIMEOUT) <= 0) {
-		index_file_set_syscall_error(index, path, "file_wait_lock()");
-		(void)close(fd);
-		return FALSE;
-	}
-
-	/* check the compatibility anyway just to be sure */
-	if (!read_and_verify_header(fd, &hdr, TRUE)) {
-		index_set_error(index, "Non-compatible index file %s", path);
-		(void)close(fd);
-		return FALSE;
-	}
+	if (!mail_index_verify_header(index, &hdr)) {
+		(void)close(index->fd);
+		index->fd = -1;
 
-	if (file_wait_lock(fd, F_UNLCK, 0) <= 0) {
-		index_file_set_syscall_error(index, path, "file_wait_lock()");
-		(void)close(fd);
+		i_free(index->filepath);
+		index->filepath = NULL;
 		return FALSE;
 	}
 
-	index->fd = fd;
-	index->filepath = i_strdup(path);
 	index->indexid = hdr.indexid;
 
-	failed = !index_open_and_fix(index, update_recent, fast);
-
-	if (!index->set_lock(index, MAIL_LOCK_UNLOCK))
-		failed = TRUE;
-
-	if (failed) {
+	/* the shared lock set is just to make sure we drop exclusive lock */
+	if (!index_open_and_fix(index, update_recent, fast) ||
+	    !index->set_lock(index, MAIL_LOCK_UNLOCK)) {
 		mail_index_close(index);
 		return FALSE;
 	}
@@ -296,43 +300,48 @@
 }
 
 static int mail_index_init_new_file(MailIndex *index, MailIndexHeader *hdr,
-				    int fd, const char *path,
-				    const char **index_path)
+				    const char *temp_path)
 {
-	off_t fsize;
+	const char *index_path;
+	uoff_t fsize;
 
-	*index_path = NULL;
+	/* set the index's path temporarily */
+	index->filepath = t_strdup_noconst(temp_path);
 
-	if (write_full(fd, hdr, sizeof(MailIndexHeader)) < 0) {
-		index_file_set_syscall_error(index, path, "write_full()");
+	if (write_full(index->fd, hdr, sizeof(MailIndexHeader)) < 0) {
+		index_set_syscall_error(index, "write_full()");
+		index->filepath = NULL;
 		return FALSE;
 	}
 
 	fsize = sizeof(MailIndexHeader) +
 		INDEX_MIN_RECORDS_COUNT * sizeof(MailIndexRecord);
-	if (file_set_size(fd, (off_t)fsize) < 0) {
-		index_file_set_syscall_error(index, path, "file_set_size()");
+	if (file_set_size(index->fd, fsize) < 0) {
+		index_set_syscall_error(index, "file_set_size()");
+		index->filepath = NULL;
 		return FALSE;
 	}
 
-	if (file_wait_lock(fd, F_WRLCK, DEFAULT_LOCK_TIMEOUT) <= 0) {
-		index_file_set_syscall_error(index, path, "file_wait_lock()");
+	if (mail_index_wait_lock(index, F_WRLCK) <= 0) {
+		index->filepath = NULL;
 		return FALSE;
 	}
+	index->filepath = NULL;
 
 	/* move the temp index into the real one. we also need to figure
 	   out what to call ourself on the way. */
-	*index_path = t_strconcat(index->dir, "/"INDEX_FILE_PREFIX, NULL);
-	if (link(path, *index_path) == 0) {
-		if (unlink(path) < 0) {
+	index_path = t_strconcat(index->dir, "/"INDEX_FILE_PREFIX, NULL);
+	if (link(temp_path, index_path) == 0) {
+		if (unlink(temp_path) < 0) {
 			/* doesn't really matter, log anyway */
-			index_file_set_syscall_error(index, path, "unlink()");
+			index_file_set_syscall_error(index, temp_path,
+						     "unlink()");
 		}
 	} else {
 		if (errno != EEXIST) {
 			/* fatal error */
 			index_set_error(index, "link(%s, %s) failed: %m",
-					path, *index_path);
+					temp_path, index_path);
 			return FALSE;
 		}
 
@@ -345,17 +354,18 @@
 			   override previous index as well */
 			hostpid_init();
 
-			*index_path = t_strconcat(*index_path, "-",
-						  my_hostname, NULL);
+			index_path = t_strconcat(index_path, "-",
+						 my_hostname, NULL);
 		}
 
-		if (rename(path, *index_path) < 0) {
+		if (rename(temp_path, index_path) < 0) {
 			index_set_error(index, "rename(%s, %s) failed: %m",
-					path, *index_path);
+					temp_path, index_path);
 			return FALSE;
 		}
 	}
 
+	index->filepath = i_strdup(index_path);
 	return TRUE;
 }
 
@@ -363,40 +373,37 @@
 			     int update_recent)
 {
 	MailIndexHeader hdr;
-	const char *path, *index_path;
-	int fd, nodiskspace;
+	const char *path;
+	int nodiskspace;
 
 	*dir_unlocked = FALSE;
-	index_path = NULL;
 
 	mail_index_init_header(index, &hdr);
 
 	if (index->nodiskspace) {
 		/* don't even bother trying to create it */
-		fd = -1;
 	} else {
 		/* first create the index into temporary file. */
-		fd = mail_index_create_temp_file(index, &path);
-		if (fd != -1) {
-			if (!mail_index_init_new_file(index, &hdr, fd,
-						      path, &index_path)) {
+		index->fd = mail_index_create_temp_file(index, &path);
+		if (index->fd != -1) {
+			if (!mail_index_init_new_file(index, &hdr, path)) {
 				int old_errno = errno;
 
-				(void)close(fd);
+				(void)close(index->fd);
 				(void)unlink(path);
-				fd = -1;
+				index->fd = -1;
 
 				errno = old_errno;
 			}
 		}
 
-		if (fd == -1 && errno != ENOSPC) {
+		if (index->fd == -1 && errno != ENOSPC) {
 			/* fatal failure */
 			return FALSE;
 		}
 	}
 
-	if (fd == -1) {
+	if (index->fd == -1) {
 		/* no space for index files, keep it in memory */
 		index->mmap_full_length = INDEX_FILE_MIN_SIZE;
 		index->mmap_base = mmap_anon(index->mmap_full_length);
@@ -407,11 +414,8 @@
 
 		index->anon_mmap = TRUE;
 		index->filepath = i_strdup("(in-memory index)");
-	} else {
-		index->filepath = i_strdup(index_path);
 	}
 
-	index->fd = fd;
 	index->indexid = hdr.indexid;
 
 	/* the fd is actually already locked, now we're just making it
@@ -548,18 +552,21 @@
 	if (mail_index_open(index, update_recent, fast))
 	        return TRUE;
 
+	if (index->index_lock_timeout || index->mailbox_lock_timeout)
+		return FALSE;
+
 	/* index wasn't found or it was broken. lock the directory and check
 	   again, just to make sure we don't end up having two index files
 	   due to race condition with another process. */
 	if (!mail_index_lock_dir(index, MAIL_LOCK_EXCLUSIVE))
 		return FALSE;
 
-	if (mail_index_open(index, update_recent, fast)) {
+	failed = FALSE;
+	if (mail_index_open(index, update_recent, fast))
 		dir_unlocked = FALSE;
-		failed = FALSE;
-	} else {
-		failed = !mail_index_create(index, &dir_unlocked,
-					    update_recent);
+	else if (!index->index_lock_timeout && !index->mailbox_lock_timeout) {
+		if (!mail_index_create(index, &dir_unlocked, update_recent))
+			failed = TRUE;
 	}
 
 	if (!dir_unlocked && !mail_index_lock_dir(index, MAIL_LOCK_UNLOCK))

Index: mail-index-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-util.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mail-index-util.c	27 Oct 2002 06:37:18 -0000	1.14
+++ mail-index-util.c	25 Nov 2002 19:02:49 -0000	1.15
@@ -3,6 +3,7 @@
 #include "lib.h"
 #include "ibuffer.h"
 #include "hostpid.h"
+#include "file-lock.h"
 #include "message-size.h"
 #include "message-part-serialize.h"
 #include "mail-index.h"
@@ -104,4 +105,36 @@
 	}
 
 	return fd;
+}
+
+static void mail_index_lock_notify(unsigned int secs_left, void *context)
+{
+	MailIndex *index = context;
+
+	if (index->lock_notify_func == NULL)
+		return;
+
+	index->lock_notify_func(MAIL_LOCK_NOTIFY_INDEX_ABORT,
+				secs_left, index->lock_notify_context);
+}
+
+int mail_index_wait_lock(MailIndex *index, int lock_type)
+{
+	int ret;
+
+	ret = file_wait_lock_full(index->fd, lock_type, DEFAULT_LOCK_TIMEOUT,
+				  mail_index_lock_notify, index);
+	if (ret < 0)
+		return index_set_syscall_error(index, "file_wait_lock()");
+
+	if (ret == 0) {
+		index_set_error(index, "Timeout while waiting for "
+				"release of fcntl() lock for index file "
+				"%s", index->filepath);
+		index->index_lock_timeout = TRUE;
+		return FALSE;
+	}
+
+	return TRUE;
+
 }

Index: mail-index-util.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-util.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mail-index-util.h	28 Oct 2002 09:31:40 -0000	1.7
+++ mail-index-util.h	25 Nov 2002 19:02:49 -0000	1.8
@@ -36,4 +36,7 @@
    and sets *path to the full path of the created file.  */
 int mail_index_create_temp_file(MailIndex *index, const char **path);
 
+/* Wrapper to file_set_lock(), also calling index's lock notify callback. */
+int mail_index_wait_lock(MailIndex *index, int lock_type);
+
 #endif

Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- mail-index.c	20 Nov 2002 18:27:52 -0000	1.74
+++ mail-index.c	25 Nov 2002 19:02:49 -0000	1.75
@@ -258,8 +258,8 @@
 
 	/* use our own locking here so we don't mess up with any other
 	   index states, like inconsistency. */
-	if (file_wait_lock(index->fd, F_WRLCK, DEFAULT_LOCK_TIMEOUT) <= 0)
-		return index_set_syscall_error(index, "file_wait_lock()");
+	if (!mail_index_wait_lock(index, F_WRLCK))
+		return FALSE;
 
 #ifdef DEBUG
 	mprotect(index->mmap_base, index->mmap_used_length,
@@ -276,8 +276,8 @@
 	mprotect(index->mmap_base, index->mmap_used_length, PROT_NONE);
 #endif
 
-	if (file_wait_lock(index->fd, F_UNLCK, 0) <= 0)
-		return index_set_syscall_error(index, "file_wait_lock()");
+	if (!mail_index_wait_lock(index, F_UNLCK))
+		return FALSE;
 
 	return !failed;
 }
@@ -286,8 +286,8 @@
 {
 	MailLockType old_lock_type;
 
-	if (file_wait_lock(index->fd, F_UNLCK, 0) <= 0)
-		return index_set_syscall_error(index, "file_wait_lock()");
+	if (!mail_index_wait_lock(index, F_UNLCK))
+		return FALSE;
 
 	old_lock_type = index->lock_type;
 	index->lock_type = MAIL_LOCK_UNLOCK;
@@ -332,11 +332,8 @@
 		if (ret <= 0)
 			return FALSE;
 	} else {
-		if (file_wait_lock(index->fd, fd_lock_type,
-				   DEFAULT_LOCK_TIMEOUT) <= 0) {
-			return index_set_syscall_error(index,
-						       "file_wait_lock()");
-		}
+		if (!mail_index_wait_lock(index, fd_lock_type))
+			return FALSE;
 	}
 
 	index->lock_type = lock_type;
@@ -365,10 +362,8 @@
 			if (!mail_index_lock_remove(index))
 				return FALSE;
 
-			if (file_wait_lock(index->fd, MAIL_LOCK_EXCLUSIVE,
-					   DEFAULT_LOCK_TIMEOUT) <= 0)
-				return index_set_syscall_error(index,
-							"file_wait_lock()");
+			if (!mail_index_wait_lock(index, F_WRLCK))
+				return FALSE;
 			index->lock_type = MAIL_LOCK_EXCLUSIVE;
 
 			debug_mprotect(index->mmap_base,
@@ -458,6 +453,14 @@
 	return mail_index_lock_full(index, lock_type, TRUE);
 }
 
+void mail_index_set_lock_notify_callback(MailIndex *index,
+					 MailLockNotifyFunc func,
+					 void *context)
+{
+	index->lock_notify_func = func;
+	index->lock_notify_context = context;
+}
+
 int mail_index_verify_hole_range(MailIndex *index)
 {
 	MailIndexHeader *hdr;
@@ -983,17 +986,24 @@
 	return TRUE;
 }
 
-const char *mail_index_get_last_error(MailIndex *index)
+MailIndexError mail_index_get_last_error(MailIndex *index)
 {
-	return index->error;
-}
+	if (index->inconsistent)
+		return MAIL_INDEX_ERROR_INCONSISTENT;
+	if (index->nodiskspace)
+		return MAIL_INDEX_ERROR_DISKSPACE;
+	if (index->index_lock_timeout)
+		return MAIL_INDEX_ERROR_INDEX_LOCK_TIMEOUT;
+	if (index->mailbox_lock_timeout)
+		return MAIL_INDEX_ERROR_MAILBOX_LOCK_TIMEOUT;
 
-int mail_index_is_diskspace_error(MailIndex *index)
-{
-	return !index->inconsistent && index->nodiskspace;
+	if (index->error != NULL)
+		return MAIL_INDEX_ERROR_INTERNAL;
+
+	return MAIL_INDEX_ERROR_NONE;
 }
 
-int mail_index_is_inconsistency_error(MailIndex *index)
+const char *mail_index_get_last_error_text(MailIndex *index)
 {
-	return index->inconsistent;
+	return index->error;
 }

Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- mail-index.h	21 Nov 2002 20:50:53 -0000	1.54
+++ mail-index.h	25 Nov 2002 19:02:49 -0000	1.55
@@ -67,6 +67,37 @@
 	MAIL_LOCK_EXCLUSIVE
 } MailLockType;
 
+typedef enum {
+	/* Mailbox is locked, will abort in secs_left */
+	MAIL_LOCK_NOTIFY_MAILBOX_ABORT,
+	/* Mailbox lock looks stale, will override in secs_left */
+	MAIL_LOCK_NOTIFY_MAILBOX_OVERRIDE,
+	/* Index is locked, will abort in secs_left */
+	MAIL_LOCK_NOTIFY_INDEX_ABORT
+} MailLockNotifyType;
+
+typedef enum {
+	/* No errors */
+	MAIL_INDEX_ERROR_NONE,
+	/* Internal error, see get_error_text() for more information. */
+	MAIL_INDEX_ERROR_INTERNAL,
+	/* Index is now in inconsistent state with the previous known state,
+	   meaning that the message IDs etc. may have changed - only way to
+	   recover this would be to fully close the mailbox and reopen it.
+	   With IMAP this would mean a forced disconnection since we can't do
+	   forced CLOSE. */
+	MAIL_INDEX_ERROR_INCONSISTENT,
+	/* We ran out of available disk space. */
+	MAIL_INDEX_ERROR_DISKSPACE,
+	/* Mail index locking timeouted */
+	MAIL_INDEX_ERROR_INDEX_LOCK_TIMEOUT,
+	/* Mailbox locking timeouted */
+	MAIL_INDEX_ERROR_MAILBOX_LOCK_TIMEOUT
+} MailIndexError;
+
+typedef void (*MailLockNotifyFunc)(MailLockNotifyType notify_type,
+				   unsigned int secs_left, void *context);
+
 typedef struct _MailIndex MailIndex;
 typedef struct _MailIndexData MailIndexData;
 typedef struct _MailTree MailTree;
@@ -179,7 +210,7 @@
 	   let it happen. Better ways to do this would be to a) mark the
 	   data to be updated later, b) use try_lock() if the update is
 	   preferred but not required, c) unlock + lock again, but make
-	   sure that won't create race conditions */
+	   sure that won't create race conditions. */
 	int (*set_lock)(MailIndex *index, MailLockType lock_type);
 
 	/* Try locking the index. Returns TRUE if the lock was got and
@@ -187,6 +218,12 @@
 	   occured. Never blocks. */
 	int (*try_lock)(MailIndex *index, MailLockType lock_type);
 
+	/* If we have to wait for the lock, the given lock notify function
+	   is called once in a while. */
+	void (*set_lock_notify_callback)(MailIndex *index,
+					 MailLockNotifyFunc func,
+					 void *context);
+
 	/* Rebuild the whole index. Note that this changes the indexid
 	   so all the other files must also be rebuilt after this call.
 	   Index MUST NOT have shared lock, but exclusive lock or no lock at
@@ -303,19 +340,12 @@
 	void (*update_field_raw)(MailIndexUpdate *update, MailDataField field,
 				 const void *value, size_t size);
 
-	/* Returns last error message */
-	const char *(*get_last_error)(MailIndex *index);
-
-	/* Returns TRUE if last error was because we ran out of available
-	   disk space. */
-	int (*is_diskspace_error)(MailIndex *index);
+	/* Returns the last error code. */
+	MailIndexError (*get_last_error)(MailIndex *index);
 
-	/* Returns TRUE if index is now in inconsistent state with the
-	   previous known state, meaning that the message IDs etc. may
-	   have changed - only way to recover this would be to fully close
-	   the mailbox and reopen it. With IMAP connection this would mean
-	   a forced disconnection since we can't do forced CLOSE. */
-	int (*is_inconsistency_error)(MailIndex *index);
+	/* Returns the full error message for last error. This message may
+	   contain paths etc. so it shouldn't be shown to users. */
+	const char *(*get_last_error_text)(MailIndex *index);
 
 /* private: */
 	MailIndexData *data;
@@ -359,6 +389,9 @@
 	time_t file_sync_stamp;
 	unsigned int first_recent_uid;
 
+	MailLockNotifyFunc lock_notify_func;
+	void *lock_notify_context;
+
 	/* these fields are OR'ed to the fields in index header once we
 	   get around grabbing exclusive lock */
 	unsigned int set_flags;
@@ -369,6 +402,8 @@
 	unsigned int mail_read_mmaped:1;
 	unsigned int inconsistent:1;
 	unsigned int nodiskspace:1;
+	unsigned int index_lock_timeout:1;
+	unsigned int mailbox_lock_timeout:1;
 };
 
 /* needed to remove annoying warnings about not initializing all struct
@@ -377,13 +412,17 @@
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
-	0, 0, 0, 0, 0, 0, 0
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+	0
 
 /* defaults - same as above but prefixed with mail_index_. */
 int mail_index_open(MailIndex *index, int update_recent, int fast);
 int mail_index_open_or_create(MailIndex *index, int update_recent, int fast);
 int mail_index_set_lock(MailIndex *index, MailLockType lock_type);
 int mail_index_try_lock(MailIndex *index, MailLockType lock_type);
+void mail_index_set_lock_notify_callback(MailIndex *index,
+					 MailLockNotifyFunc func,
+					 void *context);
 int mail_index_fsck(MailIndex *index);
 MailIndexHeader *mail_index_get_header(MailIndex *index);
 MailIndexRecord *mail_index_lookup(MailIndex *index, unsigned int seq);
@@ -412,9 +451,8 @@
 void mail_index_update_field_raw(MailIndexUpdate *update, MailDataField field,
 				 const void *value, size_t size);
 time_t mail_get_internal_date(MailIndex *index, MailIndexRecord *rec);
-const char *mail_index_get_last_error(MailIndex *index);
-int mail_index_is_diskspace_error(MailIndex *index);
-int mail_index_is_inconsistency_error(MailIndex *index);
+MailIndexError mail_index_get_last_error(MailIndex *index);
+const char *mail_index_get_last_error_text(MailIndex *index);
 
 /* INTERNAL: */
 void mail_index_init(MailIndex *index, const char *dir);

Index: mail-modifylog.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-modifylog.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- mail-modifylog.c	6 Nov 2002 07:08:04 -0000	1.35
+++ mail-modifylog.c	25 Nov 2002 19:02:49 -0000	1.36
@@ -382,12 +382,12 @@
 	      this check to make sure it's not locked by others. */
 	ret = file_try_lock(fd, F_WRLCK);
 	if (ret < 0)
-		modifylog_set_syscall_error(file, "file_wait_lock()");
+		modifylog_set_syscall_error(file, "file_try_lock()");
 
 	if (ret > 0 && mail_modifylog_init_fd(file, fd)) {
 		/* drop back to read lock */
 		if (file_try_lock(fd, F_RDLCK) <= 0) {
-			modifylog_set_syscall_error(file, "file_wait_lock()");
+			modifylog_set_syscall_error(file, "file_try_lock()");
 			ret = -1;
 		}
 
@@ -417,7 +417,7 @@
 		return -1;
 	}
 
-	if (file_wait_lock(fd, F_RDLCK, DEFAULT_LOCK_TIMEOUT) <= 0) {
+	if (file_wait_lock(fd, F_RDLCK) <= 0) {
 		modifylog_set_syscall_error(file, "file_wait_lock()");
 		(void)close(fd);
 		return -1;




More information about the dovecot-cvs mailing list