3.3.5.2.7.2 Handling Compounded Related Requests

If SMB2_FLAGS_RELATED_OPERATIONS is set in the Flags field of the SMB2 header of all requests except the first one, the received request MUST be handled as a series of compounded related operations. If the first operation has SMB2_FLAGS_RELATED_OPERATIONS set, the server SHOULD<265> fail processing the compound chain request.

The server MUST handle each individual operation that is described in the chain in order. For the first operation, the identifiers for FileId, SessionId, and TreeId MUST be taken from the received operation. For every subsequent operation, the values used for FileId, SessionId, and TreeId MUST be the ones used in processing the previous operation or generated for the previous resulting response.

When the current operation requires a SessionId or TreeId, and if the previous operation failed to create SessionId or TreeId, or the previous operation does not contain a SessionId or TreeId, the server MUST fail the current operation and all subsequent operations with STATUS_INVALID_PARAMETER.

When the current operation requires a FileId, and if the previous operation neither contains nor generates a FileId, the server MUST fail the current operation and all subsequent operations with STATUS_INVALID_HANDLE.

When the current operation requires a FileId and the previous operation either contains or generates a FileId, if the previous operation fails with an error, the server SHOULD<266> fail the current operation with the same error code returned by the previous operation.

When an operation requires asynchronous processing, all the subsequent operations MUST also be processed asynchronously. The server MUST send an interim response for all such operations as specified in section 3.3.4.2.

When all operations are complete, the responses SHOULD be compounded into a single response to return to the client. If the responses are compounded, the server MUST set SMB2_FLAGS_RELATED_OPERATIONS in the Flags field of the SMB2 header of all responses except the first one. This indicates that the response was part of a compounded chain.