summaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-09-25 17:57:19 +0200
committerJ. Bruce Fields <bfields@citi.umich.edu>2007-10-10 00:32:45 +0200
commit9efa68ed079af97f4e9477eadef567ffe64f7afc (patch)
tree4f5ea350d651f1030ae24068cdfa8b8c145167c1 /Documentation/filesystems
parentDocumentation: move mandatory locking documentation to filesystems/ (diff)
downloadlinux-9efa68ed079af97f4e9477eadef567ffe64f7afc.tar.xz
linux-9efa68ed079af97f4e9477eadef567ffe64f7afc.zip
locks: add warning about mandatory locking races
The mandatory file locking implementation has long-standing races that probably render it useless. I know of no plans to fix them. Till we do, we should at least warn people. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/mandatory-locking.txt21
1 files changed, 20 insertions, 1 deletions
diff --git a/Documentation/filesystems/mandatory-locking.txt b/Documentation/filesystems/mandatory-locking.txt
index bc449d49eee5..0979d1d2ca8b 100644
--- a/Documentation/filesystems/mandatory-locking.txt
+++ b/Documentation/filesystems/mandatory-locking.txt
@@ -3,7 +3,26 @@
Andy Walker <andy@lysaker.kvaerner.no>
15 April 1996
-
+ (Updated September 2007)
+
+0. Why you should avoid mandatory locking
+-----------------------------------------
+
+The Linux implementation is prey to a number of difficult-to-fix race
+conditions which in practice make it not dependable:
+
+ - The write system call checks for a mandatory lock only once
+ at its start. It is therefore possible for a lock request to
+ be granted after this check but before the data is modified.
+ A process may then see file data change even while a mandatory
+ lock was held.
+ - Similarly, an exclusive lock may be granted on a file after
+ the kernel has decided to proceed with a read, but before the
+ read has actually completed, and the reading process may see
+ the file data in a state which should not have been visible
+ to it.
+ - Similar races make the claimed mutual exclusion between lock
+ and mmap similarly unreliable.
1. What is mandatory locking?
------------------------------