Question about Cyrus, ext3, and Linux kernel 2.4.18 bug

Michael Fair michael at daclubhouse.net
Wed Apr 16 20:33:03 EDT 2003


> > I do not consider programs that do:
> > 1) copy main file to temp
> > 2) modify temp
> > 3) replace main file
>
> I do.  They must call fsync before doing (3).

Right, this makes sense.  I had it in my head that fsync
would be called after (3) to synchronize the contents of
the main file, but you're right as long as it was called
on the temp file before (3) then regardless of where the
system crashed the new file would either be there, or it
wouldn't but never zeroed out.

Given that, I also agree that not calling fsync before
(3) would be a "badly written" application.

> > Putting the spool directory in "sync" mode does alleviate
> > these problems as all data is immediately flushed to disk.
> > But then this omewhat removes the benefits of having a
> > journaled FS to begin with.
>
> All email software worth something calls fsync on every critical file,
after
> every critical operation, thus ALREADY operating in "close to sync mount
> mode".  That includes Cyrus and postfix, at the very least.

As long as the writers of the application considered a journaling
FS semantics to begin with and take care to fsync before doing
anything that results in a metadata change then I certainly concur
that it achieves "close to sync" semantics.  (You get it where
you need it, get the performance boost wher eyou don't)

I guess this also just goes to prove your earlier point that
data journals mostly just protect badly written applications...

But I still find myself asking, are they badly written or just
buggy (for instance perhaps cyrus or postfix missed a couple
spots, or accepted a patch that looked right but wasn't).
I'm not trying to support bad programming, but am trying to
account for the all too human factor in this.

While I have definitely shifted my stance on journaled FS'
and critical applications like Postfix and Cyrus, I would
still feel safer if for my low load, non-performance critical
servers, I could turn on a data journal.  To my knowledge,
only Ext3 supports that at this time.  Of course statements
from the application developers saying they are aware of
what operations create metadata journal entries, and are
sure to fsync before doing any such operations for the
critical files makes me feel a whole lot safer too.
Maybe I won't bother eaking out the time to convert my
XFS systems to Ext3 after all! :)

-- Michael --







More information about the Info-cyrus mailing list