Re: [exim-dev] mbx locking bug in CYGWIN

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: Derek Martin
CC: exim-dev, sparrow
Sujet: Re: [exim-dev] mbx locking bug in CYGWIN
On Wed, 16 Mar 2005, Derek Martin wrote:

> We seem to be talking about sharing mailbox files in RO mode.


Yes, that's how I understand it.

> Exim has no need of a shared lock, because it (AFAIK) has no need to
> hold the file open for reading... Isn't that the case?


Yes, but it has to interwork with other clients who may be opening the
file for reading. When I implemented this, I thought I understood it
(this was quite a few years ago now). It was one of those things that
needed really careful analysis and clear thought. I have not retained
the detailed understanding, and would have to think it all through again
to be sure of what goes on. Since I implemented it, there have been no
reports of problems - but then, how many people use MBX mailboxes?

> Based only on my understanding of what Exim is doing (that being
> delivering mail), the reading of the cited document, and discussion
> here, without reviewing the code for either program, it seems to me
> that Exim does not implement locking consistently with c-client.
> There seems to be no point whatever to the shared lock...


Things may have changed in c-client. Exim's code hasn't changed in this
area for a very long time. ("If it ain't broke" - or perhaps "if it
ain't been reported as broke" :-)

> 1. It was written 10 years ago. Much has changed in the Unix world by
> now.


Absolutely true. However, this thread originated as a CYGWIN thing, and
(nice though it is to know that Exim works in that environment) my main
concern is that Exim works in the "real" Unix world.

> 2. All that said, my understanding is that it is STILL the case that, 
>    in a heterogenious environment, NO LOCKING METHOD WORKS RELIABLY
>    OVER NFS.


I wonder why we have had no problems with user mailboxes on NFS (for a
system with three separate hosts) over the last 8 or so years, then?
The last problem caused a "final" fix to the locking code in Exim. Of
course, it uses lock files and link(), not plain fcntl() or flock().

[Note also that when I wrote Exim, I used only fcntl(). The ability to
use flock() was added later, after user pressure.]


-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book