3.3.5.16 Receiving an SMB2 CANCEL Request
When the server receives a request with an SMB2 header with a Command value equal to SMB2 CANCEL, message handling proceeds as follows:
An SMB2 CANCEL Request does not contain a sequence number that MUST be checked. Thus, the server MUST NOT process the received packet as specified in section 3.3.5.2.3.
If SMB2_FLAGS_SIGNED bit is set in the Flags field of the SMB2 header of the cancel request, the server MUST verify the session, as specified in section 3.3.5.2.9.
If SMB2_FLAGS_ASYNC_COMMAND is set in the Flags field of the SMB2 header of the cancel request, the server SHOULD<400> search for a request in Connection.AsyncCommandList where Request.AsyncId matches the AsyncId of the incoming cancel request. If SMB2_FLAGS_ASYNC_COMMAND is not set, then the server MUST search for a request in Connection.RequestList where Request.MessageId matches the MessageId of the incoming cancel request.
If a request is not found, the server MUST stop processing for this cancel request. No response is sent.
If a request is found, the server SHOULD<401> attempt to cancel the request that was found, referred to here as the target request. If the target request is successfully canceled, the target request MUST be failed by sending an ERROR response packet as specified in section 2.2.2, with the status field of the SMB2 header (specified in section 2.2.1) set to STATUS_CANCELLED. If the target request is not successfully canceled, processing of the target request MUST continue and no response is sent to the cancel request.
The cancel request indicates that the client is required to get a response for the target request, whether successful or not. The server MUST expedite the cancellation request by following the above steps.