Pretty much the only reason for this to happen is if the index directory
was deleted while another process still had the index open. Even this
doesn't normally trigger this crash, because there are other checks earlier
that usually catch it. So it crashes only in some race conditions.
Fixes:
Error: rename(.../dovecot.index.log.newlock, .../dovecot.index.log) failed: No such file or directory
Panic: file mail-transaction-log-file.c: line 105 (mail_transaction_log_file_free): assertion failed: (!file->locked)
file->fd = new_fd;
ret = mail_transaction_log_file_stat(file, FALSE);
- if (need_lock) {
+ if (need_lock && ret == 0) {
/* we'll need to preserve the lock */
if (mail_transaction_log_file_lock(file) < 0)
ret = -1;
}
if (file_dotlock_replace(dotlock,
- DOTLOCK_REPLACE_FLAG_DONT_CLOSE_FD) <= 0)
+ DOTLOCK_REPLACE_FLAG_DONT_CLOSE_FD) <= 0) {
+ /* need to unlock to avoid assert-crash in
+ mail_transaction_log_file_free() */
+ mail_transaction_log_file_unlock(file, "creation failed");
return -1;
+ }
/* success */
file->fd = new_fd;