Mercurial > dovecot > core-2.2
changeset 21568:5accb4ee4d95
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.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Wed, 15 Feb 2017 18:18:46 +0200 |
parents | 8004757eeee0 |
children | 716b798e11d0 |
files | src/lib-storage/mail-storage.c |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.c Wed Feb 15 18:05:14 2017 +0200 +++ b/src/lib-storage/mail-storage.c Wed Feb 15 18:18:46 2017 +0200 @@ -1420,14 +1420,17 @@ 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;