3.3.5.14.1 Processing Unlocks

For each SMB2_LOCK_ELEMENT entry in the Locks array, if either SMB2_LOCKFLAG_SHARED_LOCK or SMB2_LOCKFLAG_EXCLUSIVE_LOCK is set, the server MUST fail the request with STATUS_INVALID_PARAMETER and stop processing further entries in the Locks array, and all successfully processed unlock operations will not be rolled back.

If SMB2_LOCKFLAG_FAIL_IMMEDIATELY is set, the server MAY<365> ignore this flag.

The server MUST issue the byte-range unlock request to the underlying object store using Open.LocalOpen, and passing the Offset and Length (in bytes) from the SMB2_LOCK_ELEMENT entry.<366> If the unlock operation fails, the server MUST fail the operation with the error code received from the object store and stop processing further entries in the Locks array.

Otherwise, the server MUST decrease Open.LockCount by 1. If there are remaining entries in the Locks array, the server MUST continue processing the next entry in the Locks array as specified above.

After all entries are successfully unlocked, if Connection.Dialect is not "2.0.2" and if Open.IsResilient or Open.IsDurable, or Open.IsPersistent is TRUE or Connection.ServerCapabilities includes the SMB2_GLOBAL_CAP_MULTI_CHANNEL bit, the server MUST set Valid to TRUE and set SequenceNumber to LockSequenceNumber in the entry specified by Open.LockSequenceArray[LockSequenceIndex] to indicate that the unlock request has been successfully processed by the server.

The server MUST construct an SMB2 LOCK Response following the syntax specified in section 2.2.27, and the SMB2 LOCK Response MUST be sent to the client.