[Samba] Documentation/Feature Clarification Request: Server Side Copy and VFS_FRUIT

Ralph Boehme slow at samba.org
Fri Jun 27 12:19:51 UTC 2025


Hi Andrew,

On 6/27/25 1:54 PM, Andrew Walker wrote:
> Ralph, I looked at MacOS client code recently and saw they're using a 
> compounded CREATE / FSCTL_SRV_REQUEST_RESUME_KEY / CLOSE to determine 
> whether copy-chunk is supported on the SMB server during mount_smbfs 
> operations. Samba is failing with the compounded request with 
> STATUS_INTERNAL_ERROR because of going async in a compounded request. 
> This causes MacOS client to flag samba as not supporting server-side 
> copy. A fairly trivial change to set the defer time for 
> FSCTL_SRV_REQUEST_RESUME_KEY to zero results in MacOS properly 
> identifying support for copy-chunk and server-side copy to work. I'll 
> make a merge request later today.

hm, interesting.

I wonder how this can happen as vfswrap_offload_read_send() calls 
tevent_req_done() at the end so in smbd_smb2_request_pending_queue() we 
should do an early exit at

         if (!tevent_req_is_in_progress(subreq)) {
                 /* 
  

                  * This is a performance optimization, 
  

                  * it avoids one tevent_loop iteration, 
  

                  * which means we avoid one 
  

                  * talloc_stackframe_pool/talloc_free pair. 
  

                  */
                 tevent_req_notify_callback(subreq);
                 return NT_STATUS_OK;
         }

so the later check for "going async in a compound chain"

         if (req->in.vector_count > req->current_idx + 
SMBD_SMB2_NUM_IOV_PER_REQ) {
                 /* 
  

                  * We're trying to go async in a compound request 
  

                  * chain. This is only allowed for opens that cause an 
  

                  * oplock break or for the last operation in the 
  

                  * chain, otherwise it is not allowed. See 
  

                  * [MS-SMB2].pdf note <206> on Section 3.3.5.2.7. 
  

                  */
                 const uint8_t *inhdr = SMBD_SMB2_IN_HDR_PTR(req);

                 if (SVAL(inhdr, SMB2_HDR_OPCODE) != SMB2_OP_CREATE) {
                         /* 
  

                          * Cancel the outstanding request. 
  

                          */
                         bool ok = tevent_req_cancel(req->subreq);
                         if (ok) {
                                 return NT_STATUS_OK;
                         }
                         TALLOC_FREE(req->subreq);
                         return smbd_smb2_request_error(req,
                                 NT_STATUS_INTERNAL_ERROR);
                 }
         }

can never be hit.

*scratches head*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba/attachments/20250627/e875bf92/OpenPGP_signature.sig>


More information about the samba mailing list