From: Timo Sirainen Date: Wed, 15 Feb 2017 16:18:46 +0000 (+0200) Subject: lib-storage: Don't sync mailbox after undeleting it. X-Git-Tag: 2.3.0.rc1~2091 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8282724fc88edd747c2d3a7bfec7dee64decdb;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Don't sync mailbox after undeleting it. This is useful only when deleting it. With undeletion the syncing isn't useful and might actually be harmful with mailbox formats that didn't fully open the mailbox while it was undeleted. --- diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index eaeae1a358..90bc26d527 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -1420,14 +1420,17 @@ int mailbox_mark_index_deleted(struct mailbox *box, bool del) return -1; } - /* sync the mailbox. this finishes the index deletion and it can - succeed only for a single session. we do it here, so the rest of - the deletion code doesn't have to worry about race conditions. */ - box->delete_sync_check = TRUE; - ret = mailbox_sync(box, MAILBOX_SYNC_FLAG_FULL_READ); - box->delete_sync_check = FALSE; - if (ret < 0) - return -1; + if (del) { + /* sync the mailbox. this finishes the index deletion and it + can succeed only for a single session. we do it here, so the + rest of the deletion code doesn't have to worry about race + conditions. */ + box->delete_sync_check = TRUE; + ret = mailbox_sync(box, MAILBOX_SYNC_FLAG_FULL_READ); + box->delete_sync_check = FALSE; + if (ret < 0) + return -1; + } box->marked_deleted = del; return 0;