dovecot-2.0: sdbox: If message file is unexpectedly lost, rebuil...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Apr 12 18:38:55 EEST 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/d4945c93c33b
changeset: 12737:d4945c93c33b
user: Timo Sirainen <tss at iki.fi>
date: Tue Apr 12 18:38:50 2011 +0300
description:
sdbox: If message file is unexpectedly lost, rebuild index.
diffstat:
src/lib-storage/index/dbox-single/sdbox-mail.c | 14 ++++++++++----
src/lib-storage/index/dbox-single/sdbox-storage.c | 2 +-
src/lib-storage/index/dbox-single/sdbox-storage.h | 1 +
3 files changed, 12 insertions(+), 5 deletions(-)
diffs (47 lines):
diff -r edf79127fccd -r d4945c93c33b src/lib-storage/index/dbox-single/sdbox-mail.c
--- a/src/lib-storage/index/dbox-single/sdbox-mail.c Tue Apr 12 18:38:00 2011 +0300
+++ b/src/lib-storage/index/dbox-single/sdbox-mail.c Tue Apr 12 18:38:50 2011 +0300
@@ -16,10 +16,16 @@
{
struct mail *_mail = &mail->imail.mail.mail;
- /* syncing code first unlinks the file, and index is updated later.
- so at this point we don't know if the file was unexpectedly lost
- or if it's just being expunged. just assume the latter. */
- mail_set_expunged(_mail);
+ (void)mail_index_refresh(_mail->box->index);
+ if (mail_index_is_expunged(_mail->transaction->view, _mail->seq)) {
+ mail_set_expunged(_mail);
+ return;
+ }
+
+ mail_storage_set_critical(_mail->box->storage,
+ "dbox %s: Unexpectedly lost uid=%u",
+ _mail->box->path, _mail->uid);
+ sdbox_set_mailbox_corrupted(_mail->box);
}
static bool sdbox_mail_file_set(struct dbox_mail *mail)
diff -r edf79127fccd -r d4945c93c33b src/lib-storage/index/dbox-single/sdbox-storage.c
--- a/src/lib-storage/index/dbox-single/sdbox-storage.c Tue Apr 12 18:38:00 2011 +0300
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.c Tue Apr 12 18:38:50 2011 +0300
@@ -196,7 +196,7 @@
file->uid);
}
-static void sdbox_set_mailbox_corrupted(struct mailbox *box)
+void sdbox_set_mailbox_corrupted(struct mailbox *box)
{
struct sdbox_mailbox *mbox = (struct sdbox_mailbox *)box;
struct sdbox_index_header hdr;
diff -r edf79127fccd -r d4945c93c33b src/lib-storage/index/dbox-single/sdbox-storage.h
--- a/src/lib-storage/index/dbox-single/sdbox-storage.h Tue Apr 12 18:38:00 2011 +0300
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.h Tue Apr 12 18:38:50 2011 +0300
@@ -42,6 +42,7 @@
void sdbox_update_header(struct sdbox_mailbox *mbox,
struct mail_index_transaction *trans,
const struct mailbox_update *update);
+void sdbox_set_mailbox_corrupted(struct mailbox *box);
struct mail_save_context *
sdbox_save_alloc(struct mailbox_transaction_context *_t);
More information about the dovecot-cvs
mailing list