Re: imapd and synchronous writes

John Gardiner Myers (jgm+@cmu.edu)
Mon, 11 Mar 1996 15:31:32 -0500 (EST)


fraioli@dg-rtp.dg.com (Marc J. Fraioli) writes:
> I'm looking at the docs for CMU's cygnus IMAP server, and came
> across the following warning in a README:
> [...]
> What is the reason for this?

The ext2 filesystem performs directory updates asynchronously. When
the IMAP server (or sendmail) is given a message, it will create a
file for it, write out the contents, and fsync() it before informing
the sender that it has accepted responsibility for the message.

However, the fsync() doesn't mean a hill of beans if the directory
entry for the file doesn't get committed to disk. If the machine
crashes before that buffer gets flushed, the message gets lost. There
is no way the application can commit the directory change short of
calling sync().

Similarly, there are cases where the server databases can become
inconsistent if rename() calls don't get committed to disk. There's a
*lot* of open()/writev()/fsync()/rename() sequences in the code.

These server applications absolutely depend on synchronous directory
updates. So the directories for their databases have to be marked
with the synchronous attribute.

-- 
_.John G. Myers		Internet: jgm+@CMU.EDU
			LoseNet:  ...!seismo!ihnp4!wiscvm.wisc.edu!give!up