[Dovecot] Dovecot NFS locking issue

Giulio Casella giulio at dsi.unimi.it
Mon Jul 11 18:06:04 EEST 2011


Look at mbox_read_locks and mbox_write_locks parameters.
 From http://wiki2.dovecot.org/MailboxFormat/mbox:

--------------------------------------------------------
There are at least four different ways to lock a mbox:
• dotlock: mailboxname.lock file created by almost all software when writing to 
mboxes. This grants the writer an exclusive lock over the mbox, so it's usually 
not used while reading the mbox so that other processes can also read it at the 
same time. So while using a dotlock typically prevents actual mailbox 
corruption, it doesn't protect against read errors if mailbox is modified while 
a process is reading.

• flock: flock() system call is quite commonly used for both read and write 
locking. The read lock allows multiple processes to obtain a read lock for the 
mbox, so it works well for reading as well. The one downside to it is that it 
doesn't work if mailboxes are stored in NFS.

• fcntl: Very similar to flock, also commonly used by software. In some systems 
this fcntl() system call is compatible with flock(), but in other systems it's 
not, so you shouldn't rely on it. fcntl works with NFS if you're using lockd 
daemon in both NFS server and client.

• lockf: POSIX lockf() locking. Because it allows creating only exclusive locks, 
it's somewhat useless so Dovecot doesn't support it. With Linux lockf() is 
internally compatible with fcntl() locks, but again you shouldn't rely on this.

--------------------------------------------------------

but:

- lockf is unsupported by dovecot
- flock doesn't work over NFS
- fcntl works over NFS only if lockd is running on both sides (useful only if 
you can setup lockd on your storage appliance)
- dotlock is not so performing, and sometimes could give read errors, but should 
work (and protect you from mailbox corruption)

Anyway take a look also to maildir format (almost entirely lockless).

Hope this helps.

Bye,
gc


Il 11/07/2011 15.56, satish patel ha scritto:
>
> Anyone ?
>
>> From: satish_lx at hotmail.com
>> To: dovecot at dovecot.org
>> Date: Fri, 8 Jul 2011 17:08:40 +0000
>> Subject: [Dovecot] Dovecot NFS locking issue
>>
>>
>> Hi All,
>>
>> We had 15 imap/pop UW-imap servers behind load balancer and mail storage was NFS  for almost around ~30,000 users on it.  Currently we migrate UW-imap to dovecot with fcntl  NFS locking.  After migration on dovecot it started error related locking see following error
>>
>> Error: fcntl() failed with mbox file /home/w/a/wahmed/.inbox: No locks available
>> Error: fcntl() failed with mbox file /home/e/d/edurand/.inbox: No locks available
>>
>> Look like my NFS locking getting overload or something its (netapps NFS server)
>>
>> what you suggest to fix this issue ? how uw-imap was working with NFS before ?
>>
>> Appreciate your help.
>>
>> -S
>>
>>   		 	   		
>   		 	   		

-- 
Giulio Casella                                         giulio at dsi.unimi.it
System and network manager
Computer Science Dept. - University of Milano


More information about the dovecot mailing list