Question: posix fcntl module

David Bolen db3l at
Thu Aug 30 06:48:16 CEST 2001

Sheila King <sheila at> writes:

> I appreciate the input/feedback. However, simply "don't do locks over
> NFS" is a bit brief. Could you elaborate? Why not? What problems does
> this create? Why might the situation improve in NFS V4?

It's been a while since I was deep in NFS messes, but the short of it
is that NFS is a stateless protocol, and file locking is inherently a
stateful activity.  NFS separated out lock issues into a separate
protocol that was actually normally serviced by a completely separate
daemon than normal NFS operations.  And the problem was that it just
didn't work that well (except perhaps in perfect conditions in
homogeneous environments).  There were race conditions, locks could
get stranded due to system crashes, lock daemons didn't always work
properly and so on.  The lock protocol also changed from NFS v2 to v3
creating further headaches for interoperability.  And the NFS model
wasn't the greatest fit for non-Unix systems, complicating the attempt
to emulate lock locking facilities.

In most cases, anyone who tried to depend on locking over NFS (after
all, if you're using it it's probably important) eventually got burned
one too many times and just swore off of it.

Version 4 of NFS improves a lot on the handling of locks, moving them
(and the need to maintain their state on the server as a leased basis)
into the core protocol.  I don't have any personal experience with v4
configurations (the RFC is from 12/2000 so I don't know how widely its
available yet), but at least in theory the protocol ought to be able
to do a much better job managing locks.

I'm sure doing some net searches for NFS and locking could point up
various horror stories :-)

-- David
 \               David Bolen            \   E-mail: db3l at  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \

More information about the Python-list mailing list