pread() failures when using mdbox on btrfs

Marc Joliet marcec at
Sat May 7 11:44:31 UTC 2016

On Friday 06 May 2016 01:51:34 Timo Sirainen wrote:
>On 05 May 2016, at 16:21, Marc Joliet <marcec at> 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
>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.

I will mention that in the btrfs ML thread.  Who knows, maybe it will lead to 

>> 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:

I will experiment with that when I have some more time.  Thanks for the 

Marc Joliet
"People who think they know everything really annoy those of us who know we
don't" - Bjarne Stroustrup
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the dovecot mailing list