# HG changeset patch # User Timo Sirainen # Date 1181668011 -10800 # Node ID 7420a96ebc8fe40e5d3147f067d529e16179d922 # Parent f63c99fe863cc19df5fa30cdee06f8fc17ee1af2 If new/ directory is lost when syncing, assume the mailbox was deleted and make the mailbox inconsistent (which disconnects the client). diff -r f63c99fe863c -r 7420a96ebc8f 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:51 2007 +0300 @@ -458,7 +458,8 @@ { 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 mail_storage_set_index_error(struct index_mailbox *ibox) diff -r f63c99fe863c -r 7420a96ebc8f 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:51 2007 +0300 @@ -67,6 +67,7 @@ unsigned int notify_pending:1; unsigned int move_to_memory:1; unsigned int fsync_disable:1; + unsigned int mailbox_deleted:1; }; struct index_transaction_context { diff -r f63c99fe863c -r 7420a96ebc8f 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:51 2007 +0300 @@ -931,6 +931,12 @@ *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(&mbox->storage->storage, "stat(%s) failed: %m", new_dir); return -1;