Cautions About Mandatory Locking
Keep in mind the following aspects of locking:
-
Mandatory locking works only for local files. Mandatory locking is not supported when accessing files through NFS.
-
Mandatory locking protects only the segments of a file that are locked. The remainder of the file can be accessed according to normal file permissions.
-
If multiple reads or writes are needed for an atomic transaction, the process should explicitly lock all such segments before any I/O begins. Advisory locks are sufficient for all programs that perform in this way.
-
Arbitrary programs should not have unrestricted access permission to files on which record locks are used.
-
Advisory locking is more efficient because a record lock check does not have to be performed for every I/O request.