3.2.5.42 Receiving an OpLock Break Notification
If an SMB_COM_LOCKING_ANDX request is received from the server, this indicates that the server has sent an OpLock Break Notification. This is the only event in which a client receives a request from the server. This message MUST be processed as specified in section 3.2.5.1, except that OpLock Break Notification messages are never signed.
If no entry in the Client.Connection.OpenTable state variable matches the FID supplied in the request, the request is ignored by the client. Otherwise:
The client MUST use the SMB_Parameters.NewOpLockLevel field to determine the type of OpLock now in effect:
If NewOpLockLevel is 0x00, the client no longer possesses an OpLock on the file and the value of Client.Open.OpLock MUST be set to None.
If NewOpLockLevel is 0x01, a Level II OpLock is now in effect and the value of Client.Open.OpLock MUST be set to Level II.
If the client previously held an exclusive or batch OpLock on the file, the client MUST flush any dirty buffers by sending write requests to the server to write changed data to the file.
If the client no longer requires access to the file, the client MAY close the file. (This is common if a batch OpLock is held on the file, the application has closed the file, and the client has cached the application's file close request.) Closing the file is sufficient to acknowledge the OpLock break.
If the client requires continued access to the file, it MUST obtain any cached byte-range locks. This is done by sending a lock request to the server.
The client MUST acknowledge the OpLock Break by sending an OpLock Break Request message to the server. This is done by constructing an SMB_COM_LOCKING_ANDX request with the OPLOCK_RELEASE flag set in the TypeOfLock field. The NumberofRequestedUnlocks field MUST be set to 0x0000. The client MAY use the OpLock Break Request message to request byte-range locks, thus combining this step with the previous step. The OpLock Break Request message is a special case of an SMB_COM_LOCKING_ANDX request used to acknowledge the OpLock Break Notification sent by the server.
In summary, upon receipt of an OpLock Break Notification from the server, the client MUST either:
Close the file, or
Write any unwritten data to the file, obtain any required byte-range locks, and acknowledge the OpLock Break by sending an OpLock Break Request message, which is an SMB_COM_LOCKING_ANDX request with the OPLOCK_RELEASE flag set.
All messages sent to the server in response to the OpLock Break Notification MUST be sent as described in the appropriate section. For example, the OpLock Break Request message must be sent as described in section 3.2.4.16.