[Dovecot] locking question

Timo Sirainen tss at iki.fi
Sun Apr 1 09:48:38 EEST 2007


On 29.3.2007, at 21.30, Stewart Dean wrote:

> There are three applications that have their mitts on files on my  
> mail server, which is running AIXV5.3 and UWIMAP and mbox format.   
> The mail folders and INBOXES are native to that machine, but also  
> are NFS exported to a login server and a mailing list server.  All  
> three machines are running the lockd daemon.
>
> Everybody wants to lock differently
> 1) procmail (delivering for sendmail), which seems to want to use  
> dotlocking, fcntl and lockf locking; for whatever reasons, the  
> compile time tests seem to disallow flock.
> 2) UWIMAP which according to wiki.dovecot.org/Migration/UW uses:
> mbox_read_locks = flock
> mbox_write_locks = dotlock flock
> 3) I want to run dovecot in the same environment as I switch over,  
> for which the locking strategy is supposed to be (according to  
> http://wiki.dovecot.org/MboxLocking)
> mbox_read_locks = fcntl
> mbox_write_locks = dotlock fcntl
>
> Since that same page in the wiki says. "*It's important that all  
> software that's reading or writing to mboxes use the same locking  
> settings.",* I had recompiled procmail so it only usedotlocking and  
> fcntl (thus removing lockf in addition to the disallowed  
> flock)...but now I bumped into the Migration/UW page and there  
> looks to be a conflict.

It doesn't actually hurt to use more locking mechanisms, as long as  
they all use at least one common and they're not in different order.

> I want to be able to run dovecot (for testing) and UWIMAP (for all  
> users/production)  at the same time (but never at the same time  
> with the same mailbox), but UWIMAP is doc'ed to use flock and  
> Dovecot doesn't
> It's conceivable that the different locking strategies of UWIMAP  
> and Dovecot don't matter because they would never be going after  
> the same mail files (right?) but there is procmail, which has to  
> interact with both.  It appears to not use flock OK, even though  
> the docs say it should since UWIMAP expects it, and I've disabled  
> lockf as well.  But will there be a conflict with procmail and  
> dovecot's use of fcntl, which UWIMAP doesn't use?

You could use:

mbox_read_locks = fcntl flock
mbox_write_locks = dotlock fcntl flock

Both UW-IMAP and Procmail use dotlock as the first write lock and  
reading uses only a single lock method, so there won't be any deadlocks.

Hmm. I think when delivering new mails only the write lock matters.  
At least with UW-IMAP. Looks like Dovecot also at least usually write  
locks the mbox if it has changed.

So the read lock is mostly useful in situations like where one  
process is reading the mails while another process expunges messages.  
UW-IMAP doesn't allow two processes to access the same mbox  
simultaneously anyway.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20070401/4f55cbee/attachment-0001.pgp 


More information about the dovecot mailing list