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

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