Re: Ext2, fsync() and MTA's?

Andrew McNamara (andrewm@connect.com.au)
Sun, 13 May 2001 00:53:37 +1000


>> Under Linux, the Postfix MTA sets "chattr +S" on it's spool directories
>> - obviously this hurts it's performance badly (compared to the BSD's).
>
>Not really. BSD directory updates are always synchronous in the cases postfix
>cares about. At least on the old BSD FFS/UFS file systems. Thats the only
>reason the postfix stuff doesnt need it on BSD.

Indeed, but doesn't "chattr +S" on the parent directory causes the file
data to be writen syncronously also, which would really hurt.

>> It would be really nice to be able to say it's no longer necessary. It
>> wants to know that a file (file data, inode and directory entry) are
>> commited to stable storage when an fsync returns.
>
>fsync guarantees the inode data is up to date, fdatasync just the data. The
>directory name SuS and posix dont cover or provide any method for guaranteeing.
>The convention Linux adopted is that its valid to fsync() a directory file
>handle. It seemed the logical abstraction.

I seem to recall that in 2.2, fsync behaved like fdatasync, and that
it's only in 2.4 that it also syncs metadata - is this correct?

Do the BSD's sync the directory data on an fsync of a file? I guess
this is the bone of contention - if linux is now doing exactly what BSD
does, it will make it a lot easier to answer accusations of this
nature.

Wietse isn't prepared to add code to Postfix to fsync the parent
directory's handle just for Linux - it would have to be done in a lot
of places (even though he wraps most system calls already), and he is
concerned one location may be missed: it's not something that can
tested for.

---
Andrew McNamara (System Architect)

connect.com.au Pty Ltd
Lvl 3, 213 Miller St, North Sydney, NSW 2060, Australia
Phone: +61 2 9409 2117, Fax: +61 2 9409 2111
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/