From: Timo Sirainen Date: Fri, 20 Dec 2013 17:59:22 +0000 (+0200) Subject: mdbox: When purging writes new data, flush them to disk before locking the map index. X-Git-Tag: 2.2.11~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc4bac5d314d4801fa9759704a29393da8f29399;p=thirdparty%2Fdovecot%2Fcore.git mdbox: When purging writes new data, flush them to disk before locking the map index. --- diff --git a/src/lib-storage/index/dbox-multi/mdbox-purge.c b/src/lib-storage/index/dbox-multi/mdbox-purge.c index 41decd67ac..d1c3fb0404 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-purge.c +++ b/src/lib-storage/index/dbox-multi/mdbox-purge.c @@ -383,6 +383,11 @@ mdbox_file_purge(struct mdbox_purge_context *ctx, struct dbox_file *file, "(%"PRIuUOFF_T" < %"PRIuUOFF_T")", offset, st.st_size); ret = 0; } + if (ret > 0 && ctx->append_ctx != NULL) { + /* flush writes before locking the map */ + if (mdbox_map_append_flush(ctx->append_ctx) < 0) + ret = -1; + } if (ret <= 0) ret = -1;