[Dovecot] Maildir "locking"

Attila Nagy bra at fsn.hu
Thu Sep 15 11:25:43 EEST 2011


On 09/15/11 10:19, Timo Sirainen wrote:
> On Wed, 2011-09-14 at 13:32 +0200, Attila Nagy wrote:
>> Hello,
>>
>> I'm looking for the alternative of qmail's chmod -t (sticky bit on the
>> maildir root) for Dovecot. What I'm trying to achieve with this lock:
>> - Dovecot lmtp should give back a temporary error (so the email will be
>> deferred and re-delivered later)
>> - all other Dovecot daemons (pop, imap) should work as usual, but should
>> not alter maildir contents (they can modify their own files, like
>> indexes, logs etc)
>>
>> What is the best way to do this? If there is no such thing currently,
>> would it be hard to implement the sticky bit checking on the root?
> dovecot-uidlist.lock basically does this. Dovecot comes with maildirlock
> utility to properly create it. How long would your locks be? They are
> assumed stale after 2 minutes if you don't update the mtime. Readers
> will block and if they're still locked after 2 minutes they'll abort (if
> mtime has been changed). There's also mail_max_lock_timeout setting that
> changes this wait (you could e.g. lower it only with lmtp).
>
Well, basically "forever" in the sense that I would like to move the 
mailbox to a different machine, so if lmtp waits for the lock to 
disappear and that happens when the mailbox is deleted, and it will do 
the delivery, it's a bad thing.
Before Dovecot, we've had the following process of mailbox moving:
- set the sticky bit on the maildir, so qmail won't deliver into it 
(will give back 4XX)
- start to sync/copy the mailbox to the other machine
- if it's over, remove the directory on the source machine

So what I'm looking for is a lock method, which makes the mailbox read 
only, so every modification should "soft" fail (no 500 errors on lmtp).
What would be the best for this (moving mailboxes between machines)?
BTW, the process can be time consuming, even tens of minutes (lots of 
mails).


More information about the dovecot mailing list