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

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