3.2.5.19.1 Receiving an Oplock Break Notification

The client MUST locate the open in the Session.OpenTable using the FileId in the Oplock Break Notification following the SMB2 header. If the open is not found, the client MUST stop processing.

If the open is found, the client MUST take action based on the Open.OplockLevel and the new OplockLevel that is received in the Oplock Break Notification.

  • If Open.OplockLevel is SMB2_OPLOCK_LEVEL_II, and the new OplockLevel is SMB2_OPLOCK_LEVEL_NONE, the client MUST set Open.OplockLevel to SMB2_OPLOCK_LEVEL_NONE and MUST stop processing.

  • If Open.OplockLevel is SMB2_OPLOCK_LEVEL_EXCLUSIVE and the new OplockLevel is SMB2_OPLOCK_LEVEL_NONE or SMB2_OPLOCK_LEVEL_II, locate the File in GlobalFileTable using Open.FileName. The client MUST flush any writes or byte range locks that it has cached locally to the server. The client MUST set Open.OplockLevel to new OplockLevel and send an oplock break acknowledgment.

  • If Open.OplockLevel is SMB2_OPLOCK_LEVEL_BATCH and the new OplockLevel is SMB2_OPLOCK_LEVEL_EXCLUSIVE, locate the File in GlobalFileTable using Open.FileName. The client MUST process as below:

    • Close any cached handles that have already been closed by the application, as specified in section 3.2.4.5.

    • If File.OpenTable is empty, stop processing.

    • Otherwise, set Open.OplockLevel to new OplockLevel and send an oplock break acknowledgment.

  • If Open.OplockLevel is SMB2_OPLOCK_LEVEL_BATCH, and the new OplockLevel is SMB2_OPLOCK_LEVEL_NONE or SMB2_OPLOCK_LEVEL_II, locate the File in GlobalFileTable using Open.FileName. The client MUST process as below:

    • For all cached handles in File.OpenTable,

      • Flush any writes or byte range locks that it has cached locally to the server.

      • Close any cached handles that have already been closed by the application, as specified in section 3.2.4.5.

    • If File.OpenTable is empty, stop processing.

    • Otherwise, set Open.OplockLevel to new OplockLevel and send an oplock break acknowledgment.

  • Otherwise, the client MUST stop processing.

The client MUST construct Oplock Break Acknowledgment following the syntax that is specified in section 2.2.24.1. The SMB2 header is initialized as follows:

  • Command MUST be set to SMB2 OPLOCK_BREAK.

  • The MessageId field is set as specified in section 3.2.4.1.3.

  • The client MUST set SessionId to Open.TreeConnect.Session.SessionId.

  • The client MUST set TreeId to Open.TreeConnect.TreeConnectId.

The Oplock Break Acknowledgment is initialized as follows:

  • The FileId MUST be set to Open.FileId.

  • The OplockLevel MUST be set to Open.OplockLevel.

The Oplock Break Acknowledgment MUST be sent to the server.