共用方式為


3.2.4.3.5 Application Requests Creating a File Opened for Durable Operation

To request durable operation on a file being opened or created, in addition to the parameters that are specified in section 3.2.4.3, the application provides a Boolean indicating whether durability is requested.

If the application is requesting durability, the client MUST do the following:

  • If Connection.Dialect belongs to the SMB 3.x dialect family, the client MUST construct a create context by using the syntax specified in section 2.2.13.2.11, with the following values set:

    • Timeout MUST be set to an implementation-specific value <149>.

    • If TreeConnect.IsCAShare is TRUE, the client MUST set the SMB2_DHANDLE_FLAG_PERSISTENT bit in the Flags field. Otherwise, the client SHOULD perform one of the following:

      • Request a batch oplock by setting RequestedOplockLevel in the create request to SMB2_OPLOCK_LEVEL_BATCH.

      • Request a handle caching lease by including an SMB2_CREATE_REQUEST_LEASE or SMB2_CREATE_REQUEST_LEASE_V2 Create Context in the create request with a LeaseState that includes SMB2_LEASE_HANDLE_CACHING.

    • Reserved MUST be set to zero.

    • CreateGuid MUST be set to a newly generated GUID.

  • Otherwise, the client MUST construct a create context using the syntax specified in section 2.2.13.2.3. The client SHOULD perform one of the following:

    • Request a batch oplock by setting RequestedOplockLevel in the create request to SMB2_OPLOCK_LEVEL_BATCH.

    • Request a handle caching lease by including an SMB2_CREATE_REQUEST_LEASE Create Context in the create request with a LeaseState that includes SMB2_LEASE_HANDLE_CACHING.

  • The client MUST append the newly constructed create context to any other create contexts being issued with this CREATE request.

If the application is not requesting durability, the client MUST follow the normal processing, as specified in section 3.2.4.3.