[dovecot-cvs] dovecot-1.0: If new/ directory is lost when syncing, assume the ...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 12 20:06:55 EEST 2007
details: http://hg.dovecot.org/dovecot-1.0/rev/072b4b19227f
changeset: 5301:072b4b19227f
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 12 20:06:50 2007 +0300
description:
If new/ directory is lost when syncing, assume the mailbox was deleted and
make the mailbox inconsistent (which disconnects the client).
diffstat:
3 files changed, 9 insertions(+), 1 deletion(-)
src/lib-storage/index/index-storage.c | 3 ++-
src/lib-storage/index/index-storage.h | 1 +
src/lib-storage/index/maildir/maildir-sync.c | 6 ++++++
diffs (40 lines):
diff -r 86498791bea9 -r 072b4b19227f src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c Tue Jun 12 19:55:36 2007 +0300
+++ b/src/lib-storage/index/index-storage.c Tue Jun 12 20:06:50 2007 +0300
@@ -422,7 +422,8 @@ bool index_storage_is_inconsistent(struc
{
struct index_mailbox *ibox = (struct index_mailbox *) box;
- return mail_index_view_is_inconsistent(ibox->view);
+ return mail_index_view_is_inconsistent(ibox->view) ||
+ ibox->mailbox_deleted;
}
void index_storage_set_callbacks(struct mail_storage *_storage,
diff -r 86498791bea9 -r 072b4b19227f src/lib-storage/index/index-storage.h
--- a/src/lib-storage/index/index-storage.h Tue Jun 12 19:55:36 2007 +0300
+++ b/src/lib-storage/index/index-storage.h Tue Jun 12 20:06:50 2007 +0300
@@ -82,6 +82,7 @@ struct index_mailbox {
unsigned int notify_pending:1;
unsigned int mail_read_mmaped:1;
unsigned int fsync_disable:1;
+ unsigned int mailbox_deleted:1;
};
struct index_transaction_context {
diff -r 86498791bea9 -r 072b4b19227f src/lib-storage/index/maildir/maildir-sync.c
--- a/src/lib-storage/index/maildir/maildir-sync.c Tue Jun 12 19:55:36 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-sync.c Tue Jun 12 20:06:50 2007 +0300
@@ -909,6 +909,12 @@ maildir_sync_quick_check(struct maildir_
*new_changed_r = *cur_changed_r = FALSE;
if (stat(new_dir, &st) < 0) {
+ if (errno == ENOENT) {
+ /* mailbox was deleted under us. this isn't the only
+ way it can break, but the most common one. */
+ ibox->mailbox_deleted = TRUE;
+ return -1;
+ }
mail_storage_set_critical(STORAGE(mbox->storage),
"stat(%s) failed: %m", new_dir);
return -1;
More information about the dovecot-cvs
mailing list