2.2.26 SMB2 LOCK Request

The SMB2 LOCK Request packet is sent by the client to either lock or unlock portions of a file. Several different segments of the file can be affected with a single SMB2 LOCK Request packet, but they all MUST be within the same file.

Byte range locks in SMB2 are associated with the handle (SMB2 FileId) on which the lock is taken. It is the client's responsibility to locally resolve lock conflicts across multiple processes on the same client, if any such conflicts exist. This message is composed of an SMB2 header, as specified in section 2.2.1, followed by this acknowledgement structure.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

StructureSize

LockCount

LockSequenceNumber,LockSequenceIndex

FileId

...

...

...

Locks (variable)

...

StructureSize (2 bytes): The client MUST set this to 48, indicating the size of an SMB2 LOCK Request with a single SMB2_LOCK_ELEMENT structure. This value is set regardless of the number of locks that are sent.

LockCount (2 bytes): MUST be set to the number of SMB2_LOCK_ELEMENT structures that are contained in the Locks[] array. The lock count MUST be greater than or equal to 1.

LockSequenceNumber,LockSequenceIndex (4 bytes): A 32-bit unsigned integer. In the SMB 2.0.2 dialect, this field is unused and MUST be reserved. The client MUST set this to 0, and the server MUST ignore it on receipt. In all other dialects, this field is interpreted as LockSequenceNumber and LockSequenceIndex fields.

LockSequenceNumber (4 bits): The 4 least significant bits of this field containing integer value.

LockSequenceIndex (28 bits): A 28-bit integer value that MUST contain a value from 0 to 64, where 0 is reserved.

FileId (16 bytes): An SMB2_FILEID that identifies the file on which to perform the byte range locks or unlocks.

Locks (variable): An array of LockCount (SMB2_LOCK_ELEMENT) structures that define the ranges to be locked or unlocked.