]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: Storage rebuild changes weren't actually being committed to disk.
authorTimo Sirainen <tss@iki.fi>
Wed, 7 Jul 2010 14:52:16 +0000 (15:52 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 7 Jul 2010 14:52:16 +0000 (15:52 +0100)
--HG--
branch : HEAD

src/lib-storage/index/dbox-multi/mdbox-map.c
src/lib-storage/index/dbox-multi/mdbox-map.h
src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
src/lib-storage/index/dbox-multi/mdbox-sync.c

index 9e262f527433750d07c3a1bb3f2f5398b49298db..e82461c334fa4a758d9f1ffb7bd8387908e89a5f 100644 (file)
@@ -474,6 +474,11 @@ void mdbox_map_atomic_set_failed(struct mdbox_map_atomic_context *atomic)
        atomic->success = FALSE;
 }
 
+void mdbox_map_atomic_set_success(struct mdbox_map_atomic_context *atomic)
+{
+       atomic->success = TRUE;
+}
+
 int mdbox_map_atomic_finish(struct mdbox_map_atomic_context **_atomic)
 {
        struct mdbox_map_atomic_context *atomic = *_atomic;
index c5500c7d7dcd5c4a0187c22e162030eab97b2f38..8abe03f6c3b60b4b1125cd099fc276eed96b1c28 100644 (file)
@@ -69,6 +69,10 @@ bool mdbox_map_atomic_is_locked(struct mdbox_map_atomic_context *atomic);
 /* When finish() is called, rollback the changes. If data was already written
    to map's transaction log, this desyncs the map and causes a rebuild */
 void mdbox_map_atomic_set_failed(struct mdbox_map_atomic_context *atomic);
+/* Mark this atomic as having succeeded. This is internally done if
+   transaction or append is committed within this atomic, but not when the
+   atomic is used standalone. */
+void mdbox_map_atomic_set_success(struct mdbox_map_atomic_context *atomic);
 /* Commit/rollback changes within this atomic context. */
 int mdbox_map_atomic_finish(struct mdbox_map_atomic_context **atomic);
 
index 693d751729364fe14b5314e428aa9f46fcc6d1b7..e086f81515597e986839b5ff8c2afaf33690cf34 100644 (file)
@@ -908,6 +908,7 @@ int mdbox_storage_rebuild(struct mdbox_storage *storage)
 
        atomic = mdbox_map_atomic_begin(storage->map);
        ret = mdbox_storage_rebuild_in_context(storage, atomic);
+       mdbox_map_atomic_set_success(atomic);
        if (mdbox_map_atomic_finish(&atomic) < 0)
                ret = -1;
        return ret;
index c2f61ef0b1abb840612ba86b8797243f331d14bc..57519f32439bac934b82f50f97b335719c8c34fb 100644 (file)
@@ -308,6 +308,8 @@ int mdbox_sync(struct mdbox_mailbox *mbox, enum mdbox_sync_flags flags)
        ret = mdbox_sync_begin(mbox, flags, atomic, &sync_ctx);
        if (ret == 0 && sync_ctx != NULL)
                ret = mdbox_sync_finish(&sync_ctx, TRUE);
+       if (ret == 0)
+               mdbox_map_atomic_set_success(atomic);
        if (mdbox_map_atomic_finish(&atomic) < 0)
                ret = -1;
        return ret;