3.3.4.2 Sending an Interim Response for an Asynchronous Operation

The server MAY choose to send an interim response for any request that is received. It MUST send an interim response for any request that could potentially block for an indefinite amount of time (such as pipe operations, directory change notifications, blocking byte-range-lock operations, and creates blocked by an oplock break). If an operation would require asynchronous processing but resources are constrained, the server MAY <133> choose to fail that operation with STATUS_INSUFFICIENT_RESOURCES. Otherwise the server MUST send an interim response. An interim response indicates to the client that the request has been received and a full response will come later. As noted in section 3.3.4.1.1, it is not mandatory for the server to sign an interim response.

To send an interim response for a request, the server MUST generate an asynchronous identifier for it by some method, as specified in section 3.3.1.1. This identifier MUST be unique for each asynchronous request currently active on this transport connection. The server MUST insert the request in Connection.AsyncCommandList.

The server MUST construct a response packet for the request. The SMB2 header of the response MUST be identical to that in the request with the following changes:

  • It MUST set the Status field in the SMB2 header to STATUS_PENDING.
  • The NextCommand field MUST be set to 0. If this response is later combined with other responses into a compounded response, as specified in section 3.3.4.1.3, this value will change later. The server SHOULD fail requests in a compound chain that try to go async. <134>

  • The server MUST set the SMB2_FLAGS_SERVER_TO_REDIR bit in the Flags field of the SMB2 header.
  • The server MUST set the SMB2_FLAGS_ASYNC_COMMAND bit in the Flags field of the SMB2 header.
  • It MUST set the AsyncId field of the SMB2 header to the value that was generated earlier.
  • It MUST set the CreditsGranted field to the number of credits the server wants to grant for this request, as specified in section 3.3.1.3.

It MUST append an SMB2_ERROR_Response following the SMB2 header, as specified in section 2.2.2, with a ByteCount of zero. It MUST locate the request in Connection.RequestList and set its state to Asynchronous. This response MUST be sent to the client.

When the operation completes, the server MUST set the AsyncId field of the final response to the identifier generated and returned to the client in the interim response. It MUST also set the SMB2_FLAGS_ASYNC_COMMAND bit in the Flags field of the SMB2 header. The server SHOULD set CreditsGranted in the SMB2 header to 0, as credits were granted on the interim response. All other fields of the final response MUST be identical to what is described for the individual operations. The server MUST remove the request from Connection.AsyncCommandList.

Show: