Question about Cyrus, ext3, and Linux kernel 2.4.18 bug

Lawrence Greenfield leg+ at andrew.cmu.edu
Wed Apr 16 22:38:15 EDT 2003


--On Wednesday, April 16, 2003 8:21 PM -0400 James Ralston 
<qralston+ml.info-cyrus at andrew.cmu.edu> wrote:

> 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

Sigh. This is a well known problem with ext2. It is impossible for any 
application to maintain sane consistency guarantees with ext2 in the 
default async mode. (It's not clear mounting ext2 in "sync" mode is 
sufficient for any serious application.)

All the Linux journalling filesystems implement softupdates-like semantics 
and do not require an fsync() on a directory to force filenames to disk. 
There are various reasons why doing so is unreasonable, which is why MTAs 
and Cyrus refuse to do so.

I can't think of any sane reason why ext3 authors would want to weaken the 
semantics they export to applications now.

Larry





More information about the Info-cyrus mailing list