Cause: insufficient information about locking files over NFS
Consequence: incomplete documenation
Fix: information about locking files over NFS is added
Result: updated documentation
The manpage for flock(2) states:
flock() does not lock files over NFS. Use fcntl(2) instead: that does work over NFS, given a sufficiently recent version of Linux and a server which supports locking.
But as far as I can tell, from a programmer's point of view, flock() does work over NFS. The shell command "flock a.a bash" experimentlaly locks a file on an NFS mounted volume, while in e.g. linux-2.6.18-274.3.1.el5.x86_64/fs/nfs/file.c
there is a comment
"We're simulating flock() locks using posix locks on the server"
suggesting to me that flock() works on NFS in RHEL5 and RHEL6.
Upstream e449654fdb3f19aafc569df47d12bffdf6276236 probably addresss this bug, I think. That change will go out with the next release.
(In reply to Michael Kerrisk from comment #3)
> Upstream e449654fdb3f19aafc569df47d12bffdf6276236 probably addresss this
> bug, I think. That change will go out with the next release.
What git tree is that commit relative to?
Created attachment 909193 [details]
The upstream patch
Created attachment 909385 [details]
flock.2 NFS flock for MPO
Thank you very much guys
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.