Skip to main content

About file locking between protocols

Contributors netapp-nsriram

File locking is a method used by client applications to prevent a user from accessing a file previously opened by another user. How ONTAP locks files depends on the protocol of the client.

If the client is an NFS client, locks are advisory; if the client is an SMB client, locks are mandatory.

Because of differences between the NFS and SMB file locks, an NFS client might fail to access a file previously opened by an SMB application.

The following occurs when an NFS client attempts to access a file locked by an SMB application:

  • In mixed or NTFS volumes, file manipulation operations such as rm, rmdir, and mv can cause the NFS application to fail.

  • NFS read and write operations are denied by SMB deny-read and deny-write open modes, respectively.

  • NFS write operations fail when the written range of the file is locked with an exclusive SMB bytelock.

  • Unlink

    • For NTFS filesystems, SMB and CIFS delete operations are supported.

      The file will be removed after the last close.

    • NFS unlink operations are not supported.

      It is not supported because NTFS and SMB semantics are required, and the Last Delete-On-Close operation is not supported for NFS.

    • For UNIX filesystems, unlink operation is supported.

      It is supported because NFS and UNIX semantics are required.

  • Rename

    • For NTFS filesystems, if the destination file is opened from SMB or CIFS, the destination file can be renamed.

    • NFS rename is not supported.

      It is not supported because NTFS and SMB semantics are required.

In UNIX security-style volumes, NFS unlink and rename operations ignore SMB lock state and allow access to the file. All other NFS operations on UNIX security-style volumes honor SMB lock state.