From 789e71544bfc01c58da2c3bf794742e5f80c604e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 4 Aug 2021 09:52:49 -0700 Subject: [PATCH] s3: smbd: For async FSCTL calls, add the outstanding tevent_reqs to the aio list on the file handle. FSCTL_DUP_EXTENTS_TO_FILE/FSCTL_SRV_COPYCHUNK/FSCTL_SRV_COPYCHUNK_WRITE/FSCTL_SRV_REQUEST_RESUME_KEY can go async on a file handle - so use the existing aio_add_req_to_fsp() call used in all other aio code to let the server know to wait on closing these handles until the request completes. Can't add tests as these calls depend on optional underlying file system features, but submitter of the bug confirms this fixes their issue. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14769 Signed-off-by: Jeremy Allison --- source3/smbd/smb2_ioctl_filesys.c | 5 +++++ source3/smbd/smb2_ioctl_network_fs.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/source3/smbd/smb2_ioctl_filesys.c b/source3/smbd/smb2_ioctl_filesys.c index f5c472c2cd1..cea3e7f5478 100644 --- a/source3/smbd/smb2_ioctl_filesys.c +++ b/source3/smbd/smb2_ioctl_filesys.c @@ -768,6 +768,11 @@ struct tevent_req *smb2_ioctl_filesys(uint32_t ctl_code, tevent_req_set_callback(subreq, smb2_ioctl_filesys_dup_extents_done, req); + /* Ensure any close request knows about this outstanding IO. */ + if (!aio_add_req_to_fsp(state->fsp, req)) { + tevent_req_nterror(req, NT_STATUS_NO_MEMORY); + return tevent_req_post(req, ev); + } return req; break; } diff --git a/source3/smbd/smb2_ioctl_network_fs.c b/source3/smbd/smb2_ioctl_network_fs.c index e0beb6c96fe..2acc608799b 100644 --- a/source3/smbd/smb2_ioctl_network_fs.c +++ b/source3/smbd/smb2_ioctl_network_fs.c @@ -641,6 +641,11 @@ struct tevent_req *smb2_ioctl_network_fs(uint32_t ctl_code, tevent_req_set_callback(subreq, smb2_ioctl_network_fs_copychunk_done, req); + /* Ensure any close request knows about this outstanding IO. */ + if (!aio_add_req_to_fsp(state->fsp, req)) { + tevent_req_nterror(req, NT_STATUS_NO_MEMORY); + return tevent_req_post(req, ev); + } return req; break; case FSCTL_QUERY_NETWORK_INTERFACE_INFO: @@ -689,6 +694,11 @@ struct tevent_req *smb2_ioctl_network_fs(uint32_t ctl_code, } tevent_req_set_callback( subreq, smb2_ioctl_network_fs_offload_read_done, req); + /* Ensure any close request knows about this outstanding IO. */ + if (!aio_add_req_to_fsp(state->fsp, req)) { + tevent_req_nterror(req, NT_STATUS_NO_MEMORY); + return tevent_req_post(req, ev); + } return req; default: { -- 2.30.2