Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
3.3.5.12 Receiving an SMB2 READ Request

3.3.5.12 Receiving an SMB2 READ Request

When the server receives a request with an SMB2 header with a Command value equal to SMB2 READ, message handling proceeds as follows:

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

The server MUST locate the tree connection, as specified in section 3.3.5.2.11.

Next the server MUST locate the open that is being read from, 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 Open.GrantedAccess does not allow for FILE_READ_DATA, the request MUST be failed with STATUS_ACCESS_DENIED.

The server SHOULD<294> fail the request with STATUS_INVALID_PARAMETER if the Length field is greater than Connection.MaxReadSize.

If Connection.SupportsMultiCredit is TRUE the server MUST validate CreditCharge based on Length, as specified in section 3.3.5.2.5. If the validation fails, it MUST fail the read request with STATUS_INVALID_PARAMETER.

If the server implements the SMB 3.0.2 or SMB 3.1.1 dialect, the read is being executed on a named pipe, and the SMB2_READFLAG_READ_UNBUFFERED bit is set in the Flags field, the server MUST fail the request with STATUS_INVALID_PARAMETER.

If Connection.Dialect belongs to the SMB 3.x dialect family and if any of the following conditions are TRUE, the server MUST fail the request with STATUS_INVALID_PARAMETER:

  • Channel is not equal to SMB2_CHANNEL_RDMA_V1_INVALIDATE, SMB2_CHANNEL_RDMA_V1, or SMB2_CHANNEL_NONE.

  • Connection.Dialect is "3.0" and Channel is equal to SMB2_CHANNEL_RDMA_V1_INVALIDATE.

  • Channel is equal to SMB2_CHANNEL_RDMA_V1 or SMB2_CHANNEL_RDMA_V1_INVALIDATE and the underlying Connection is not RDMA.

  • Channel is equal to SMB2_CHANNEL_RDMA_V1 or SMB2_CHANNEL_RDMA_V1_INVALIDATE and Length or ReadChannelInfoOffset or ReadChannelInfoLength is equal to 0.

If the server implements the SMB 3.x dialect family, if Connection.Dialect belongs to the SMB 3.x dialect family, and if Channel is equal to SMB2_CHANNEL_RDMA_V1 or SMB2_CHANNEL_RDMA_V1_INVALIDATE, and if any of the following conditions is TRUE, the server MUST fail the request with STATUS_INVALID_PARAMETER.

  • Underlying Connection is not RDMA.

  • The Length or ReadChannelInfoOffset or ReadChannelInfoLength is equal to 0.

If Open.IsSharedVHDX is TRUE, the server MUST issue a read to Remote Shared Virtual Disk, as specified in [MS-RSVD] section 3.2.5.3, by providing Open.LocalOpen for the length, in bytes, given by Length, at the offset, in bytes, from the beginning of the file, provided in Offset.

If Open.IsSharedVHDX is FALSE, the server MUST issue a read to the underlying object store represented by Open.LocalOpen for the length, in bytes, given by Length, at the offset, in bytes, from the beginning of the file, provided in Offset. If the server implements the SMB 3.0.2 or SMB 3.1.1 dialect and if SMB2_READFLAG_READ_UNBUFFERED bit is set in the Flags field of the request, the server SHOULD<295> indicate to the underlying object store not to buffer the read data.

If the read is being executed on a named pipe, and the pipe is in blocking mode (the default), the operation could block for a long time, so the server MAY<296> choose to handle it asynchronously, as specified in section 3.3.4.2. To query a pipe's blocking mode, use the FilePipeInformation file information class, as specified in [MS-FSCC] section 2.4.29. To change a pipe's blocking mode, use an SMB2 SET_INFO Request with the FilePipeInformation file information class, as specified in [MS-FSCC] section 2.4.29.<297> If the read is not finished in 0.5 milliseconds, the server MUST send an interim response to the client.

If the read fails, the server MUST fail the request using the error code received from the read operation. If the read returns fewer bytes than specified by the MinimumCount field of the request, the server MUST fail the request with STATUS_END_OF_FILE.

If the read succeeds, the server MUST construct a read response using the syntax specified in section 2.2.20 with the following values.

If the request Channel field contains the value SMB2_CHANNEL_NONE, then:

  • DataOffset MUST be set to the offset into the response, in bytes, from the beginning of the SMB2 header where the data is located.

  • The data MUST be copied into the response.

  • DataLength MUST be set to the number of bytes returned.

  • DataRemaining MUST be set to zero.

If the request Channel field contains the value SMB2_CHANNEL_RDMA_V1 or SMB2_CHANNEL_RDMA_V1_INVALIDATE, the data MUST be sent via the processing specified in [MS-SMBD] section 3.1.4.5 RDMA Write to Peer Buffer, providing the Connection, the data, and the array of SMB_DIRECT_BUFFER_DESCRIPTOR_V1 structures passed in the request at offset ReadChannelInfoOffset and of length ReadChannelInfoLength fields.

  • The DataOffset field MUST be set to the offset into the response, in bytes, from the beginning of the SMB2 header to the Buffer field.

  • The data MUST NOT be copied into the response.

  • DataRemaining MUST be set to the number of bytes returned via RDMA.

  • DataLength MUST be set to zero.

The response MUST then be sent to the client. If the request Channel field contains the value SMB2_CHANNEL_RDMA_V1_INVALIDATE, then the Token in the first element of the array of SMB_DIRECT_BUFFER_DESCRIPTOR_V1 structures passed in the request MUST additionally be supplied, as specified in [MS-SMBD] section 3.1.4.2.

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_END_OF_FILE

  • STATUS_PIPE_BROKEN

  • STATUS_BUFFER_OVERFLOW

  • STATUS_CANCELLED

  • STATUS_FILE_LOCK_CONFLICT

Show:
© 2015 Microsoft