]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Don't sync mailbox after undeleting it.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 15 Feb 2017 16:18:46 +0000 (18:18 +0200)
committerGitLab <gitlab@git.dovecot.net>
Thu, 16 Feb 2017 10:38:36 +0000 (12:38 +0200)
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.

src/lib-storage/mail-storage.c

index eaeae1a3582d7d6fc8465f502a28d98911d3d871..90bc26d52738f0ad4326ef05b26b3be817692428 100644 (file)
@@ -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;