18.104.22.168 Application Requests Unlocking of an Array of Byte Ranges
The application provides:
A handle to the Open identifying a file.
An array of byte ranges to unlock. For each range, the application provides:
A starting offset, in bytes.
A length, in bytes.
If the handle is invalid, or if no Open referenced by the handle is found, the client MUST return an implementation-specific error code. If the handle is valid and Open is found, the client MUST proceed as follows.
If Open.Connection is NULL, and Open.Durable is TRUE, the client SHOULD attempt to reconnect to this open as specified in section 22.214.171.124. If the reconnect succeeds, the unlock MUST be retried. If it fails, the error code MUST be returned to the application.
If Open.Connection is NULL, and Open.Durable is FALSE, the client MUST fail the unlock operation.
The Command field is set to SMB2 LOCK.
The MessageId field is set as specified in section 126.96.36.199.3.
The SessionId field is set to Open.TreeConnect.Session.SessionId.
The TreeId field is set to Open.TreeConnect.TreeConnectId.
The SMB2 LOCK Request MUST be initialized as follows:
The FileId field is set to Open.FileId.
The LockCount field is set to the number of byte ranges being unlocked.
For each range being unlocked, the client creates an SMB2_LOCK_ELEMENT structure and places it in the Locks array of the request, setting the following values:
The offset is set to the offset of the range being unlocked.
The length is set to the length of the range to be unlocked.
The client sets SMB2_LOCKFLAG_UNLOCK to TRUE in the Flags field.
If any of the Booleans Open.ResilientHandle, Open.IsPersistent, or Connection.SupportsMultiChannel are TRUE, the client MUST do the following:
The client MUST scan through Open.OperationBuckets and find an entry with its Free element set to TRUE. If no such entry could be found, an implementation-specific error MUST be returned to the application.
Set the Free element of the chosen entry to FALSE.
The fields of the SMB2 lock request MUST be set as follows:
LockSquenceIndex is set to the index value of the chosen entry.
LockSequenceNumber is set to the SequenceNumber of the chosen entry.
Otherwise the client MUST set LockSequenceIndex and LockSequenceNumber to 0.
The request MUST be sent to the server.