file locking

David DeSimone fox at rsn.hp.com
Thu Sep 19 01:50:43 CEST 2002


Adrian Otto <aotto at aotto.com> wrote:
>
> Note that some systems implement flock() using fcntl locks underneath. 
> If you are using one of these systems, then locking over NFS is safe,
> even when the lock is set using flock().

There are so many permutations here, as locking is very system- and
environment-specific.  Tools that handle mail must go through mighty
contortions to make sure they are doing the "right" thing to lock
mailboxes, and many of them still get it slightly wrong on some systems.

A further wrinkle that hasn't been mentioned here is that fcntl-locks
can bring performance problems.  Some systems will force all file
operations to be non-buffered when files are locked via fcntl.  The
assumption is that the locking could possibly be for the purpose of
sharing data across multiple machines via NFS, so all reads and writes
are performed synchronously with no caching of data, to avoid stale
information being used.

I have no real solution to offer, except perhaps ESR's original
autodaemon code, in which a server is set up to handle all the accesses
of the list information, and could handle the conflicts of multiple
programs trying to read and update the same information.

Of course, ESR's autodaemon never worked at all on my systems, but
that's for me to figure out.  :)

-- 
 David DeSimone   | "The doctrine of human equality reposes on this:
<fox at rsn.hp.com>  |  that there is no man really clever who has not
 Hewlett-Packard  |  found that he is stupid." -- Gilbert K. Chesterson

For summay digest subscription: bogofilter-digest-subscribe at aotto.com



More information about the Bogofilter mailing list