In article <20040603233416.GB15833@???>,
Peter D. Gray <pdg@???> wrote:
>I think most of the information I have seen in this thread is
>correct, but the circumstances for it being correct have
>not been stated.
>
>From my knowledge:
>
>- if you use NFS version 3 AND you set the timeout
> on the attribute cache to 0 (no attribute caching)
> then there is no problem using NFS for anything
> as long as you do your locking properly.
>
> This is because NFSv3 has an atomic file create
> operation which allows .lock files to work
> ala UFS. Also, attribute information is returned
> with every aknowledgement.
But not all clients implement the NFS O_EXCL stuff. For example,
the Linux NFS client doesn't up till this day because it doesn't
fit into the Linux VFS semantics (O_EXCL is being done at the VFS
level, not at the FS level). Yes, that sucks.
The only guaranteed cross-platform exclusive/atomic operation
is link(2).
> But, if you fail to get a fcntl lock, you must
> close and re-open the file before trying to get the
> lock again.
Well that depends.
If you have access to a Debian box where liblockfile-dev is
installed, read the lockfile_create(3) manpage. Wait - ofcourse
there are copies on the web. Read:
http://www.fifi.org/cgi-bin/man2html/usr/share/man/man3/lockfile_create.3.gz
Especially the REMOTE FILE SYSTEMS AND THE KERNEL ATTRIBUTE CACHE stuff.
Mike.