[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Policy wrt mail lockfile (section 4.3)

[ Please don't Cc: public replies to me. ]

Karl M. Hegbloom:
> What happens?  Can you describe the problem?  Explain your setup in
> more detail, please.  I would like to know more about the problems
> that are encountered with nfs.

When you try to create a lock file with open(2) using O_CREAT|O_EXCL
(i.e., you ask the kernel to create the file, but fail if it exists
already), the operation will sometimes fail, when you network drops
a packet. That operation simply isn't guaranteed to work over NFS,
even though it is for normal Unix filesystems.

What happens then is that some programs will think they got the
lock, when they didn't, and will proceed to mangle mailboxes.
Other programs will think they didn't get the lock, when they
did, and then the lock will prevent anyone from using the mailbox.

How often this happens depends on how often your network drops
packages and how often your mail programs try to use lock files.

> Publib uses the return value from the stat call, which
> you're not supposed to do.  (I don't know why yet.)

I check that the link count is two to see if I managed to create
the lock file with link(2). If the stat fails, I can't check
the link count. I _must_ check the return of the stat.

(And, as I've said, I'm not an expert on this.)

Please read <http://www.iki.fi/liw/mail-to-lasu.html> before mailing me.
Please don't Cc: me when replying to my message on a mailing list.

Attachment: pgpTkX5aTdFBp.pgp
Description: PGP signature

Reply to: