Question about Cyrus, ext3, and Linux kernel 2.4.18 bug

James Ralston qralston+ml.info-cyrus at andrew.cmu.edu
Wed Apr 16 20:21:38 EDT 2003


On 2003-04-16 at 19:32:42-0300 Henrique de Moraes Holschuh <hmh at debian.org> wrote:
> All email software worth something calls fsync on every critical
> file, after every critical operation

Just calling fsync() on the critical file is *NOT* sufficient to
prevent data loss:

http://hypermail.idiosynkrasia.net/linux-kernel/archived/2002/week28/0240.html

In essence: guaranteeing that your file's data is on permanent storage
is only half of it; you also need to ensure that any changes to parent
directories are on permanent storage.  On filesystems which have
asynchronous directory updates (like ext3), that means you must call
fsync() on all directories which you caused to be modified as a result
of operating on your file.

> That includes Cyrus and postfix, at the very least.

Unfortunately, no, it doesn't.

I just skimmed the source for cyrus-imapd-2.2.0-ALPHA, and it appears
that Cyrus doesn't fsync() parent directories.  If this is true (i.e.,
I'm not misreading the source), then the entire Cyrus spool *must* be
mounted synchronously in order to prevent data loss.

And postfix is well-known for being broken in this regard:

http://hypermail.idiosynkrasia.net/linux-kernel/archived/2002/week28/0197.html

Regards,

-- 
James Ralston, Information Technology
Software Engineering Institute
Carnegie Mellon University, Pittsburgh, PA, USA





More information about the Info-cyrus mailing list