pread() failures when using mdbox on btrfs

Timo Sirainen tss at iki.fi
Thu May 5 22:51:34 UTC 2016


On 05 May 2016, at 16:21, Marc Joliet <marcec at gmx.de> wrote:
> 
> (Note: I am not subscribed to this ML, so please be sure to CC me in replies.)
> 
> Hello,
> 
> I see a strange bug when running dovecot under btrfs with a mailbox in mdbox 
> format.  At some point, which can take a few minutes or more than a day, 
> dovecot starts logging pread() failures, like so:
> 
> Apr 02 23:43:42 thetick dovecot[570]: imap(marcec): Error: pread() failed with 
> file /home/marcec/.mdbox/mailboxes/LinuxAudio/User/dbox-
> Mails/dovecot.index.log: Input/output error
> 
> These would trigger when getmail runs (which in turn is configured to use 
> dovecot-lda).  It's only ever the *.index.log files, and it would usually 
> happen to the same one many times in a row.  To demonstrate, this is the full 
> list of unique pread() failures on one host (my desktop PC):

*.index.log files are always appended to using O_APPEND flag. Maybe this is relevant.

Also when a new .log file is created it's opened without the O_APPEND flag and the O_APPEND is added later. This was causing a bug recently in unionfs, which ignored the flag change and caused log file corruption.

> Rebooting the system would make it go away (without loss of mails), though 
> remounting the file system should have worked, too.  I tried a variety of 
> options, but the only one that helped was to convert the mailbox from mdbox to 
> maildir.  I have not seen any pread() failures in the two weeks since.

I can't really think of why Maildir format would get rid of the problem, since the dovecot.index.log files still exist and they're accessed the same way. Maybe with Maildir there are enough locks that it prevents some race condition that triggers this.

You could try stress testing with imaptest to see if it's easy to reproduce: http://imapwiki.org/ImapTest



More information about the dovecot mailing list