s3: smbd: Cause SMB2_OP_FLUSH to go synchronous in a compound anywhere but the last...
authorJeremy Allison <jra@samba.org>
Thu, 20 Oct 2022 22:19:05 +0000 (15:19 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 17 Nov 2022 05:55:42 +0000 (05:55 +0000)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Nov 17 05:55:42 UTC 2022 on sn-devel-184

selftest/knownfail.d/compound_async [deleted file]
source3/smbd/smb2_flush.c

diff --git a/selftest/knownfail.d/compound_async b/selftest/knownfail.d/compound_async
deleted file mode 100644 (file)
index e1be976..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^samba3.smb2.compound_async.flush_close\(fileserver\)
-^samba3.smb2.compound_async.flush_flush\(fileserver\)
index e73666f0afc9118f32e75599e72f46e90b2775ba..5c8c171e418e94f1f5f0b7c6059678d0658db92c 100644 (file)
@@ -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);