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.
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.