3.3.5.11 Receiving an SMB2 FLUSH Request
When the server receives a request with an SMB2 header with a Command value equal to SMB2 FLUSH, 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 being flushed 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.IsPersistent is FALSE and Open.IsReplayEligible is TRUE, the server MUST set Open.IsReplayEligible to FALSE.
If the Open is on a file and Open.GrantedAccess includes neither FILE_WRITE_DATA nor FILE_APPEND_DATA, the server MUST fail the request with STATUS_ACCESS_DENIED.
If the Open is on a directory and Open.GrantedAccess includes neither FILE_ADD_FILE nor FILE_ADD_SUBDIRECTORY, the server MUST fail the request with STATUS_ACCESS_DENIED.
If Open.IsPersistent is TRUE, the server MUST succeed the operation and MUST respond with an SMB2 FLUSH Response specified in section 2.2.18.
Otherwise, the server MUST issue a request to the underlying object store to flush any cached data for Open.LocalOpen.<352> If this is a file, the object store MUST propagate any cached data to underlying storage. If this is a named pipe, the server MUST wait for all data written to the pipe to be consumed by a reader. This operation MUST block until the flush is complete. (The server SHOULD<353> choose to handle this request asynchronously, as specified in section 3.3.4.2.)
If the operation succeeds, the server MUST initialize a response following the syntax specified in section 2.2.18.
If the operation fails, the server MUST return the error code to the client.
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_PIPE_BROKEN
STATUS_DISK_FULL
STATUS_CANCELLED