On Sun, 2007-03-11 at 21:32 +0200, Timo Sirainen wrote:
- write mails to tmp/
- lock dovecot-uidlist file
- rename() mails from tmp/ to new/
- write the new dovecot-uidlist's contents to dovecot-uidlist.lock
- rename() dovecot-uidlist.lock to dovecot-uidlist
If I switched 3 and 4, there are only rename()s that can fail.
And I of course mean that if writing dovecot-uidlist.lock fails, the whole mail saving is aborted with "ouf of disk space" error, even though the mail file itself was successfully saved to tmp.
And at least my Linux allows rename()ing when there's no disk space left. I hope that's the case for "out of quota" conditions too? Or does it create a new directory entry which can in some situations cause a new disk block allocation which will fail?..
rename()s from tmp/ to new/ can at least fail. But if that happens the whole transaction can again be aborted and all the mails unlink()ed (even the ones already in new/. that's how it currently works too).
So the only problem is if the last uidlist rename() fails. But that I hope won't fail because it's done inside the same directory, and the maildir root directory is pretty static.