From: Jeremy Allison Date: Thu, 20 Oct 2022 22:19:05 +0000 (-0700) Subject: s3: smbd: Cause SMB2_OP_FLUSH to go synchronous in a compound anywhere but the last... X-Git-Tag: samba-4.16.9~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5e39bbc77f5f842b69f0789f3dbfa58bfbdd010;p=thirdparty%2Fsamba.git s3: smbd: Cause SMB2_OP_FLUSH to go synchronous in a compound anywhere but the last operation in the list. Async read and write go synchronous in the same case, so do the same here. Remove knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15172 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu Nov 17 05:55:42 UTC 2022 on sn-devel-184 (cherry picked from commit 26adf3344337f4e8d5d2107e6ba42e5ea7656372) --- diff --git a/selftest/knownfail.d/compound_async b/selftest/knownfail.d/compound_async deleted file mode 100644 index e1be97649f3..00000000000 --- a/selftest/knownfail.d/compound_async +++ /dev/null @@ -1,2 +0,0 @@ -^samba3.smb2.compound_async.flush_close\(fileserver\) -^samba3.smb2.compound_async.flush_flush\(fileserver\) diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c index e73666f0afc..5c8c171e418 100644 --- a/source3/smbd/smb2_flush.c +++ b/source3/smbd/smb2_flush.c @@ -126,6 +126,8 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx, struct tevent_req *subreq; struct smbd_smb2_flush_state *state; struct smb_request *smbreq; + bool is_compound = false; + bool is_last_in_compound = false; req = tevent_req_create(mem_ctx, &state, struct smbd_smb2_flush_state); @@ -195,6 +197,18 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx, tevent_req_set_callback(subreq, smbd_smb2_flush_done, req); + is_compound = smbd_smb2_is_compound(smb2req); + is_last_in_compound = smbd_smb2_is_last_in_compound(smb2req); + + if (is_compound && !is_last_in_compound) { + /* + * Can't go async if we're not the + * last request in a compound request. + * Cause this request to complete synchronously. + */ + smb2_request_set_async_internal(state->smb2req, true); + } + /* Ensure any close request knows about this outstanding IO. */ if (!aio_add_req_to_fsp(fsp, req)) { tevent_req_nterror(req, NT_STATUS_NO_MEMORY);