Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] history locking with fcntl



On 2008-04-17 06:58:34 -0700, Bart Schaefer wrote:
> On Apr 17, 10:40am, Peter Stephenson wrote:
> } pindex(HIST_FCNTL_LOCK)
> } provide better performance, in particular avoiding history corruption when
> } files are stored on NFS.
> 
> Really?  Traditionally fcntl() has been a lousy way to lock over NFS.

AFAIK, it's the only way to prevent some corruption due to file caching.

> Procmail, for example, has acres of code to handle using secondary
> files as semaphores precisely because nothing else was reliable over
> NFS

But procmail *also* uses fcntl. My patch still uses the old lock
mechanism, it just adds fcntl locking. That said, I often use fcntl
only, without any problem.

> (more specifically, only creat() was guaranteed to be atomic and
> lock daemons were flaky).

Some software, like Firefox, uses symlink() locking. So, if symlink()
isn't atomic, there will be problems with such software.

> I guess my point is that while fcntl() may be good on recent OSs (or
> recent versions of NFS, more likely) it's dangerous in an environment
> where you don't know what the NFS server is using (no matter how recent
> the local NFS client is).

I don't see why it can be dangerous if it is used in addition to
another lock mechanism, like it currently is.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author