Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

3.2.4.21 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 3.2.4.4. 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.

If Open.Connection is not NULL, the client initializes an SMB2 LOCK Request following the syntax specified in section 2.2.26. The SMB2 header MUST be initialized as follows:

  • The Command field is set to SMB2 LOCK.

  • The MessageId field is set as specified in section 3.2.4.1.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 Open.ResilientHandle is TRUE, the client MUST do the following:

  • The client MUST scan through Open.OperationBuckets and find an element with its Free field set to TRUE. If no such element could be found, an implementation-specific error MUST be returned to the application.

  • Let the zero-based array index of the element chosen above be referred to as BucketIndex, and let BucketNumber = BucketIndex + 1.

  • Set Open.OperationBuckets[BucketIndex].Free = FALSE

  • Let the SequenceNumber of the element chosen above be referred to as BucketSequence.

  • The LockSequence field of the SMB2 lock request MUST be set to (BucketNumber << 4) + BucketSequence.

  • Increment the SequenceNumber of the element chosen above using MOD 16 arithmetic.

The request MUST be sent to the server, and the response from the server MUST be handled as described in section 3.2.5.13.

The status of the response MUST be returned to the application.

 
Show:
© 2014 Microsoft. All rights reserved.