Blame SOURCES/1129235-mpo-7.1.0-flock.2.patch

c2a259
From f1121d1e7ff76ace6e89fbe275abc3abedd5940b Mon Sep 17 00:00:00 2001
c2a259
From: Jan Chaloupka <jchaloup@redhat.com>
c2a259
Date: Mon, 29 Sep 2014 21:43:53 +0200
c2a259
Subject: [PATCH] flock.2 NFS flock
c2a259
c2a259
---
c2a259
 man-pages/man2/flock.2 | 48 ++++++++++++++++++++++++++++++++++++++++--------
c2a259
 1 file changed, 40 insertions(+), 8 deletions(-)
c2a259
c2a259
diff --git a/man-pages/man2/flock.2 b/man-pages/man2/flock.2
c2a259
index 60537fe..b8c55d1 100644
c2a259
--- a/man-pages/man2/flock.2
c2a259
+++ b/man-pages/man2/flock.2
c2a259
@@ -145,19 +145,12 @@ possibly implemented in terms of
c2a259
 .BR fcntl (2),
c2a259
 appears on most UNIX systems.
c2a259
 .SH NOTES
c2a259
-.BR flock ()
c2a259
-does not lock files over NFS.
c2a259
-Use
c2a259
-.BR fcntl (2)
c2a259
-instead: that does work over NFS, given a sufficiently recent version of
c2a259
-Linux and a server which supports locking.
c2a259
-.PP
c2a259
 Since kernel 2.0,
c2a259
 .BR flock ()
c2a259
 is implemented as a system call in its own right rather
c2a259
 than being emulated in the GNU C library as a call to
c2a259
 .BR fcntl (2).
c2a259
-This yields true BSD semantics:
c2a259
+This yields classical BSD semantics:
c2a259
 there is no interaction between the types of lock
c2a259
 placed by
c2a259
 .BR flock ()
c2a259
@@ -166,6 +159,45 @@ and
c2a259
 and
c2a259
 .BR flock ()
c2a259
 does not detect deadlock.
c2a259
+(Note, however, that on some modern BSDs,
c2a259
+.\" E.g., according to the flock(2) man page, FreeBSD since at least 5.3
c2a259
+.BR flock ()
c2a259
+and
c2a259
+.BR fcntl (2)
c2a259
+locks
c2a259
+.I do
c2a259
+interact with one another.)
c2a259
+.PP
c2a259
+In Linux kernels up to 2.6.11,
c2a259
+.BR flock ()
c2a259
+does not lock files over NFS
c2a259
+(i.e., the scope of locks was limited to the local system).
c2a259
+Instead, one could use
c2a259
+.BR fcntl (2)
c2a259
+byte-range locking, which does work over NFS,
c2a259
+given a sufficiently recent version of
c2a259
+Linux and a server which supports locking.
c2a259
+Since Linux 2.6.12, NFS clients support
c2a259
+.BR flock ()
c2a259
+locks by emulating them as byte-range locks on the entire file.
c2a259
+This means that
c2a259
+.BR fcntl (2)
c2a259
+and
c2a259
+.BR flock ()
c2a259
+locks
c2a259
+.I do
c2a259
+interact with one another over NFS.
c2a259
+Since Linux 2.6.37,
c2a259
+.\" commit 5eebde23223aeb0ad2d9e3be6590ff8bbfab0fc2
c2a259
+the kernel supports a compatibility mode that allows
c2a259
+.BR flock ()
c2a259
+locks (and also
c2a259
+.BR fcntl (2)
c2a259
+byte region locks) to be treated as local;
c2a259
+see the discussion of the
c2a259
+.I "local_lock"
c2a259
+option in
c2a259
+.BR nfs (5).
c2a259
 .PP
c2a259
 .BR flock ()
c2a259
 places advisory locks only; given suitable permissions on a file,
c2a259
-- 
c2a259
1.9.3
c2a259