HP UX Common Internet File System (CIFS) Client/Server Software File Locking Implementations

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

1 48
Download 48 pages 18.07 Kb
Page 8
Image 8

Chapter 4 File Locking Implementations

File systems and pseudo file systems (like PC-NFS) implement autonomous file locking models. These file-locking models are invoked by the particular file system, and do not necessarily interoperate, or even know each other exist. Thus, when multiple client access methods open the same file – even with valid locking procedures for the opening file system – the locks can be ignored, resulting in concurrent file access and likely data corruption. To understand how the different file locking mechanisms interoperate (or do not interoperate), we must first understand how file locking is implemented for homogeneous access on the following file systems:

Windows (CIFS),

UNIX (JFS, HFS, etc)

NFS,

PC-NFS.

4.1WINDOWS (CIFS)

The Windows file system (using CIFS) utilizes three different file-locking mechanisms:

Mandatory Locking,

Byte-Range Locking,

Opportunistic Locking (Oplocks).

MANDATORY LOCKING is invoked at file open by the Windows Createfile API. Locking parameters supplied to Createfile include access mode and share mode.

Access mode defines how an application (caller of Createfile) wants to access the file:

Read:

Read access only

Write:

Write access only

Read-Write:

Read and Write access

Share mode defines how an application wants to limit or grant concurrent access while it has the file open, essentially comprising the locking scenario for MANDATORY LOCKS:

Deny-None:

Concurrent read and write access allowed

Deny-All:

No concurrent read or write access allowed

Deny-Read:

No concurrent read access allowed

Deny-Write:

No concurrent write access allowed

These are Windows default file locking mechanisms. There are obscure ways to disable mandatory locks, but they should never be disabled (which is why they are obscure). Windows documentation uses the terms “mandatory” and “share mode”. However, it is helpful to think of mandatory share mode locking as “OPEN MODE LOCKING”, because it is initiated during a file open, so subsequent references will use “Mandatory Share Mode (Open Mode) Locking”.

8

Page 8
Image 8
HP UX Common Internet File System (CIFS) Client/Server Software manual File Locking Implementations, Windows Cifs