[OpenAFS] mail spool on AFS
Patrick J. LoPresti
patl@cag.lcs.mit.edu
20 Nov 2001 14:50:36 -0500
Craig_Everhart@transarc.com writes:
> What we used at CMU for a million years was a solution that
> delivered mail as separate files in the $home/Mailbox/ directory,
> with a directory DB that allowed the mail deliverers to find $home
> pretty effectively. (This is before X.500, let alone LDAP.) This
> let each user share their quota for mail and other stuff, and it
> avoided the byte-range locking stuff, using whole-file (AFS) file
> locking.
Too bad you did not take one more step; you could have invented
maildirs and avoided the need for any locks at all.
See http://cr.yp.to/proto/maildir.html, but my quick summary is as
follows:
A maildir is a directory hierarchy that looks like this:
maildir
maildir/tmp
maildir/new
To deliver a message, the MTA writes it as a new file under tmp, syncs
it, and renames it to put it under new. Clients look for messages in
new, not tmp, so they never see any message until it has been fully
written. This obviates the need for locks.
Maildirs generally have a "cur" directory where the messages get moved
as they are incorporated; this is to make it easy to tell when you
have new mail. But it is the tmp/new trick which makes the protocol
lock-free.
So if you use a maildir-capable MTA (e.g., qmail or Postfix), and set
up your ACLs to allow the MTA to write to each user's maildir in their
home directory, you get lock-free, reliable, and *scalable* mail
delivery via AFS.
This is not to say that dedicated IMAP servers are a bad idea, but
they are not the only sane option.
- Pat