xfs, reiserfs, ext2 and sync directory updates
On Thu, Jul 19, 2001 at 06:06:55PM +0200, Russell Coker wrote:
> On Thu, 19 Jul 2001 15:48, Kevin J. Menard, Jr. wrote:
> > CS> if i was running a news spool or a large Maildir/ spool, i think i'd
> > CS> stick with reiserfs but this is my workstation, where i have lots of
> > CS> large files (incl. huge mbox files) so i think i'll be switching to XFS.
> > But don't you want synchronous writes for your mail spool? I was
> > under the impression that journaling filesystems don't support this
> > (yet?).
on my home workstation, i don't care that much. i run amanda nightly to
back everything up to tape.
> Synchronous writes are supported. The issue is that Linux by default
> does not make link() a synchronous operation. If you create a link
> and then fsync() the parent directory then you are certain that the
> link is in place.
> Some mail servers rely on link() being synchronous and can
> theoretically perform incorrectly if the power fails at the wrong
the real problem is that directory updates in linux are not synchronous.
wietse venema (author of postfix) sees that as a stupid bug in linux. i
tend to agree with him, although i'm not overjoyed by his decision not
to write special case code (i.e. write queue file, open directory, fsync
directory, close directory) to handle this linux misfeature.
freebsd's filesystem has a neat feature called 'soft-updates' which
does this right. writing files on a fs mounted with soft-updates is
asynchronous and fast, but directory entry updates are synchronous
(safer but slower). a good balance between speed and safety, and ideal
for a mail queue or Maildir/ spool. it would be nice to see something
like this in linux.
> There are patches available for Qmail to make it fsync() the
> directory. I am not sure how Postfix handles this, or Procmail.
> Perhaps Craig can advise on this as he knows more about Postfix and
> Procmail than me.
the workaround for postfix is to use 'chattr +S' to set the postfix
queue directories to be sync write. this is safe, but has the
unfortunate side-effect of making all the *files* in the queue
directories also sync-write...which hurts performance quite badly.
of course, this only works on ext2fs (and probably ext3 as well - dunno,
haven't tried it) as neither reiserfs or xfs support ext2 attributes.
the postfix startup scripts detect whether they are running on linux
with ext2 and automatically run 'chattr +S' on the queue directories
when postfix is started. if you're willing to take a risk, you can edit
the scripts so that they don't do this...but don't expect anyone to care
if you lose mail as a result :)
> I haven't bothered investigating this in depth. If one of my servers
> crashes the possibility that one message may be lost is really the
> least of my concerns (email client programs crash far more often and
> lose much more mail).
i haven't yet had a problem running reiserfs for my mail systems. it's
possible that i will one day, but IMO the risk is small enough that i
the speed benefit of using reiserfs for the queue greatly outweighs the
risk...imo, it's worth it.
craig sanders <firstname.lastname@example.org>
Fabricati Diem, PVNC.
-- motto of the Ankh-Morpork City Watch