Export (0) Print
Expand All

3.3.5.14 Receiving an SMB2 LOCK Request

When the server receives a request that has an SMB2 header (section 2.2.1) with a Command value equal to SMB2 LOCK, message handling proceeds as follows:

The server MAY<292> validate the open before session verification.

The server MUST locate the Session, as specified in section 3.3.5.2.9.

The server MUST locate the Tree Connect, as specified in section 3.3.5.2.11.

Next, the server MUST locate the Open on which the client is requesting a lock or unlock by performing a lookup in the Session.OpenTable, using the FileId.Volatile of the request as the lookup key. If no Open is found, or if Open.DurableFileId is not equal to FileId.Persistent, the server MUST fail the request with STATUS_FILE_CLOSED. Otherwise, the server MUST locate the Request in Connection.RequestList for which Request.MessageId matches the MessageId value in the SMB2 header, and set Request.Open to the Open.

If the LockSequence value in the SMB2 LOCK Request (section 2.2.26) is not zero, and either one of the following conditions is TRUE, the server SHOULD verify whether the lock/unlock request with that LockSequence value has been successfully processed before.

  • Connection.Dialect is "2.100" and Open.IsResilient is TRUE.

  • Connection.Dialect belongs to the SMB 3.x dialect family.<293>

The server verifies the LockSequence by performing the following steps:

  1. The server MUST compute ((LockSequence >> 4)-1) to use as an index into Open.LockSequenceArray[] in order to locate the sequence number entry (1 byte). If the index exceeds the maximum extent of the Open.LockSequenceArray[], the server MUST skip step 2 and continue lock/unlock processing.

  2. The server MUST take the 4 least significant bits of LockSequence as the lock sequence number and compare it to the entry retrieved from step 1. If the sequence numbers are equal, the server MUST complete the lock/unlock request with success. Otherwise, the server MUST set the entry value to 0xFF and continue lock/unlock processing.

If the flags of the initial SMB2_LOCK_ELEMENT in the Locks array of the request has SMB2_LOCKFLAG_UNLOCK set, the server MUST process the lock array as a series of unlocks. Otherwise, it MUST process the lock array as a series of lock requests.

The status code returned by this operation MUST be one of those defined in [MS-ERREF]. Common status codes returned by this operation include:

  • STATUS_SUCCESS

  • STATUS_INSUFFICIENT_RESOURCES

  • STATUS_ACCESS_DENIED

  • STATUS_FILE_CLOSED

  • STATUS_NETWORK_NAME_DELETED

  • STATUS_USER_SESSION_DELETED

  • STATUS_NETWORK_SESSION_EXPIRED

  • STATUS_INVALID_PARAMETER

  • STATUS_FILE_LOCK_CONFLICT

  • STATUS_CANCELLED

  • STATUS_LOCK_NOT_GRANTED

  • STATUS_RANGE_NOT_LOCKED

 
Show:
© 2014 Microsoft