in reply to Re: Re: Flock() over NFS
in thread Flock() over NFS

Most of the time kernel locking works fine over NFS. I encountered failures on a mail server with several thousand users at a rate of about once a week. The mail server was Solaris and the clients included a variety of versions of free and commercial UNIXes.

My code to replicate the problem was much more aggressive than yours, spawning hundreds of child processes. I'd suggest modifying your code to take a command line argument and fork that many child processes. Run it with lots of children on both your NFS client and server hosts and see if you can get any failures that way.

It could be that your UNIX client and server have a working, compatible NFS locking implementation between them, but this test will not tell you if your code will work other clients or servers, so why not use a guaranteed to work method like atomically renaming files via link(), preferrably via a standard CPAN module?