[Dovecot] Locking /var/mail/user issue with postfix and dovecot
Ben Morrow
ben at morrow.me.uk
Fri Oct 26 00:15:09 EEST 2012
At 10AM +0300 on 25/10/12 you (Robert JR) wrote:
>
> Stan, sorry but you didnot understand my question at all, dovecot in
> this case is reading the mailbox file while user downloading the mail
> and not WRITING. only postfix write when a mail arrives and DOVECOT
> only read the mail. And even if both write to the file, I have already
> set the locking option of both to FCNTL so no problem should happen.
> My question is postfix locking option is = FCNTL, DOTLOCK , and
> dovecot = FCNTL, if postfix find a file already FCNTL, why it dotlock
> the file 5 secs then remove the dotlock and say resource unaviable?
As Stan said earlier, this is a Postfix question. The rule for
dotlocking is that you must create the .lock *before* opening the file,
in case whoever has it locked will be replacing the file altogether; but
with fcntl locking you must acquire the lock *after* opening the file,
since that's the way the syscall works. This means that if Postfix is
going to use both forms of lock, it has to acquire a dotlock before it
can look for a fcntl lock.
In other words: the methods in mailbox_delivery_lock are *not* tried in
order, because they can't be. Dotlock is always tried first.
You should have compatible locking settings for all your programs
accessing your mboxes. If Postfix is using dotlock, Dovecot should be
using dotlock as well. If you don't have any local programs (mail
clients, for instance) which require dotlocks, you should probably
change Postfix to just use fcntl locks.
Ben
More information about the dovecot
mailing list