HP UX Common Internet File System (CIFS) Client/Server Software manual Unix, Nfs

Models: UX Common Internet File System (CIFS) Client/Server Software

1 48
Download 48 pages 18.07 Kb
Page 10
Image 10

An important detail is that Oplocks are invoked by the file system, not an application API. Therefore, an application can close an oplocked file, but the file system does not relinquish the Oplock. When the Oplock break is issued, the file system then simply closes the file in preparation for the subsequent open by the second process.

4.2UNIX

UNIX utilizes 2 kinds of file locking:

Advisory locking

Mandatory locking

Both lock types are implemented with the same function calls: fcntl and lockf. fcntl is the POSIX interface (introduced at SVR4), and lockf is provided for backward compatibility. The calling semantics are slightly different, but the functionality is basically the same.

Both functions specify read and/or write locking, and allow for byte-range locks or locking of the entire file. A read lock allows concurrent access for reading, but not writing. A write lock is exclusive.

ADVISORY LOCKING assumes that all processes attempting to access a file participate in the locking protocol by calling the locking functions correctly and honoring the lock status of the file. There is no requirement that a process must adhere to the advisory locking protocol. A process that does not participate in the protocol can obliviously write or read to a file that is locked with locking functions. Therefore there is a significant assumption of risk of data corruption with advisory locking.

MANDATORY LOCKING is implemented with function calls identical to advisory locking. Mandatory locking is then enabled per-file by manipulating the file’s permissions with chmod. To enable a file for mandatory locking, the group-id bit must be set, and the execute bit must be cleared (implying that executable files cannot be locked). Once set, any calls to open, read, or write to a previously locked file are failed by the kernel, regardless of whether the process participates in the file locking protocol. Most UNIX locking scenarios refer to advisory locking protocol. The UNIX mandatory option seems to be rarely utilized, so further references to mandatory locking refer to Windows only.

Note that UNIX does not employ the concept of Mandatory Share Mode (Open Mode) locking like Windows does. UNIX locking consists of byte range locking and is strictly programmatic on a previously opened file. Also, UNIX is incapable of sending an oplock break to a client, and therefore cannot interoperate with Windows clients using Opportunistic Locking.

4.3NFS

File locking for NFS is provided by two cooperating protocols:

Network Lock Manager

Network Status Monitor

10

Page 10
Image 10
HP UX Common Internet File System (CIFS) Client/Server Software manual Unix, Nfs