Revert "smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event...
authorRalph Boehme <slow@samba.org>
Thu, 27 Dec 2018 14:18:55 +0000 (15:18 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 Jan 2019 22:11:16 +0000 (23:11 +0100)
This reverts commit 894e5001c747ce765dad5517778dda55d7d1f4d9.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
25 files changed:
source3/include/vfs.h
source3/smbd/aio.c
source3/smbd/globals.h
source3/smbd/ipc.c
source3/smbd/open.c
source3/smbd/pipes.c
source3/smbd/process.c
source3/smbd/reply.c
source3/smbd/smb2_break.c
source3/smbd/smb2_close.c
source3/smbd/smb2_create.c
source3/smbd/smb2_flush.c
source3/smbd/smb2_getinfo.c
source3/smbd/smb2_glue.c
source3/smbd/smb2_ioctl.c
source3/smbd/smb2_ioctl_named_pipe.c
source3/smbd/smb2_lock.c
source3/smbd/smb2_notify.c
source3/smbd/smb2_query_directory.c
source3/smbd/smb2_read.c
source3/smbd/smb2_server.c
source3/smbd/smb2_sesssetup.c
source3/smbd/smb2_setinfo.c
source3/smbd/smb2_tcon.c
source3/smbd/smb2_write.c

index 959dd4059151f799abfc6d973d58df7c3b777150..1a05283fe6cce364938f0d282d46ad7fef145e4f 100644 (file)
@@ -518,8 +518,6 @@ struct smb_request {
 
        size_t unread_bytes;
        bool encrypted;
-       /* the tevent_context (wrapper) the request operates on */
-       struct tevent_context *ev_ctx;
        connection_struct *conn;
        struct smbd_server_connection *sconn;
        struct smbXsrv_connection *xconn;
index 29723d23fa52ad0ef4192f734f8ce8b0a72c8314..8ac3ef7278ec30348c7742f6049f39350e31dd06 100644 (file)
@@ -206,7 +206,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
        aio_ex->nbyte = smb_maxcnt;
        aio_ex->offset = startpos;
 
-       req = SMB_VFS_PREAD_SEND(aio_ex, smbreq->ev_ctx,
+       req = SMB_VFS_PREAD_SEND(aio_ex, fsp->conn->sconn->ev_ctx,
                                 fsp,
                                 smb_buf(aio_ex->outbuf.data) + 1 /* pad */,
                                 smb_maxcnt, startpos);
@@ -459,7 +459,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
        aio_ex->nbyte = numtowrite;
        aio_ex->offset = startpos;
 
-       req = pwrite_fsync_send(aio_ex, smbreq->ev_ctx, fsp,
+       req = pwrite_fsync_send(aio_ex, fsp->conn->sconn->ev_ctx, fsp,
                                data, numtowrite, startpos,
                                aio_ex->write_through);
        if (req == NULL) {
@@ -705,7 +705,7 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
        aio_ex->nbyte = smb_maxcnt;
        aio_ex->offset = startpos;
 
-       req = SMB_VFS_PREAD_SEND(aio_ex, smbreq->ev_ctx, fsp,
+       req = SMB_VFS_PREAD_SEND(aio_ex, fsp->conn->sconn->ev_ctx, fsp,
                                 preadbuf->data, smb_maxcnt, startpos);
        if (req == NULL) {
                DEBUG(0, ("smb2: SMB_VFS_PREAD_SEND failed. "
@@ -846,7 +846,7 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
        aio_ex->nbyte = in_data.length;
        aio_ex->offset = in_offset;
 
-       req = pwrite_fsync_send(aio_ex, smbreq->ev_ctx, fsp,
+       req = pwrite_fsync_send(aio_ex, fsp->conn->sconn->ev_ctx, fsp,
                                in_data.data, in_data.length, in_offset,
                                write_through);
        if (req == NULL) {
index a13916e230ab3a0f100acc4a5d87d6aa67f5eec7..a273cdb3651ee169172cf2c823040521a6f81679 100644 (file)
@@ -705,9 +705,6 @@ struct smbd_smb2_request {
        struct smbXsrv_tcon *tcon;
        uint32_t last_tid;
 
-       /* the tevent_context (wrapper) the request operates on */
-       struct tevent_context *ev_ctx;
-
        int current_idx;
        bool do_signing;
        /* Was the request encrypted? */
index 85236e0102f28ab524d6f98f255410e22b475902..f1c8ea0c2ed43d3e3e4740a10ce36dd458f04bb0 100644 (file)
@@ -281,7 +281,7 @@ static void api_dcerpc_cmd(connection_struct *conn, struct smb_request *req,
        state->num_data = length;
        state->max_read = max_read;
 
-       subreq = np_write_send(state, req->ev_ctx, state->handle,
+       subreq = np_write_send(state, req->sconn->ev_ctx, state->handle,
                               state->data, length);
        if (subreq == NULL) {
                TALLOC_FREE(state);
@@ -330,7 +330,7 @@ static void api_dcerpc_cmd_write_done(struct tevent_req *subreq)
                goto send;
        }
 
-       subreq = np_read_send(state, req->ev_ctx,
+       subreq = np_read_send(state, req->sconn->ev_ctx,
                              state->handle, state->data, state->max_read);
        if (subreq == NULL) {
                reply_nterror(req, NT_STATUS_NO_MEMORY);
index a3df8a1b7363bb2dfdbf1013fdd1e2c1dea1f263..bab9286751f5e5dc325f484c02ecca446ab4749f 100644 (file)
@@ -2408,7 +2408,7 @@ static void defer_open(struct share_mode_lock *lck,
        DBG_DEBUG("defering mid %" PRIu64 "\n", req->mid);
 
        watch_req = dbwrap_watched_watch_send(watch_state,
-                                             req->ev_ctx,
+                                             req->sconn->ev_ctx,
                                              lck->data->record,
                                              (struct server_id){0});
        if (watch_req == NULL) {
@@ -2416,7 +2416,7 @@ static void defer_open(struct share_mode_lock *lck,
        }
        tevent_req_set_callback(watch_req, defer_open_done, watch_state);
 
-       ok = tevent_req_set_endtime(watch_req, req->ev_ctx, abs_timeout);
+       ok = tevent_req_set_endtime(watch_req, req->sconn->ev_ctx, abs_timeout);
        if (!ok) {
                exit_server("tevent_req_set_endtime failed");
        }
@@ -2508,7 +2508,7 @@ static void setup_kernel_oplock_poll_open(struct timeval request_time,
         * As this timer event is owned by req, it will
         * disappear if req it talloc_freed.
         */
-       open_rec->te = tevent_add_timer(req->ev_ctx,
+       open_rec->te = tevent_add_timer(req->sconn->ev_ctx,
                                        req,
                                        timeval_current_ofs(1, 0),
                                        kernel_oplock_poll_open_timer,
@@ -2695,7 +2695,7 @@ static void schedule_async_open(struct timeval request_time,
                exit_server("push_deferred_open_message_smb failed");
        }
 
-       open_rec->te = tevent_add_timer(req->ev_ctx,
+       open_rec->te = tevent_add_timer(req->sconn->ev_ctx,
                                        req,
                                        timeval_current_ofs(20, 0),
                                        schedule_async_open_timer,
index c945f0f6177661259262c04f1881375b0a95d8be..4be57bc2a5f0dea80515419bdaa2d8763be60958 100644 (file)
@@ -67,7 +67,7 @@ NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
                         conn->sconn->remote_address,
                         conn->sconn->local_address,
                         conn->session_info,
-                        smb_req->ev_ctx,
+                        conn->sconn->ev_ctx,
                         conn->sconn->msg_ctx,
                         &fsp->fake_file_handle);
        if (!NT_STATUS_IS_OK(status)) {
@@ -206,7 +206,7 @@ void reply_pipe_write(struct smb_request *req)
        DEBUG(6, ("reply_pipe_write: %s, name: %s len: %d\n", fsp_fnum_dbg(fsp),
                  fsp_str_dbg(fsp), (int)state->numtowrite));
 
-       subreq = np_write_send(state, req->ev_ctx,
+       subreq = np_write_send(state, req->sconn->ev_ctx,
                               fsp->fake_file_handle, data, state->numtowrite);
        if (subreq == NULL) {
                TALLOC_FREE(state);
@@ -322,7 +322,7 @@ void reply_pipe_write_and_X(struct smb_request *req)
                state->numtowrite -= 2;
        }
 
-       subreq = np_write_send(state, req->ev_ctx,
+       subreq = np_write_send(state, req->sconn->ev_ctx,
                               fsp->fake_file_handle, data, state->numtowrite);
        if (subreq == NULL) {
                TALLOC_FREE(state);
@@ -435,7 +435,7 @@ void reply_pipe_read_and_X(struct smb_request *req)
        state->outbuf = req->outbuf;
        req->outbuf = NULL;
 
-       subreq = np_read_send(state, req->ev_ctx,
+       subreq = np_read_send(state, req->sconn->ev_ctx,
                              fsp->fake_file_handle, data,
                              state->smb_maxcnt);
        if (subreq == NULL) {
index e730676ef3615b38f51b2deab50216207e68100f..d2553049cd2568e24e78e39f43c374d95a0825e6 100644 (file)
@@ -1506,8 +1506,6 @@ static connection_struct *switch_message(uint8_t type, struct smb_request *req)
 
        errno = 0;
 
-       req->ev_ctx = NULL;
-
        if (!xconn->smb1.negprot.done) {
                switch (type) {
                        /*
@@ -1642,8 +1640,6 @@ static connection_struct *switch_message(uint8_t type, struct smb_request *req)
                        reply_nterror(req, NT_STATUS_ACCESS_DENIED);
                        return conn;
                }
-
-               req->ev_ctx = conn->user_ev_ctx;
        } else if (flags & AS_GUEST) {
                /*
                 * Does this protocol need to be run as guest? (Only archane
@@ -1653,13 +1649,9 @@ static connection_struct *switch_message(uint8_t type, struct smb_request *req)
                        reply_nterror(req, NT_STATUS_ACCESS_DENIED);
                        return conn;
                }
-
-               req->ev_ctx = req->sconn->guest_ev_ctx;
        } else {
                /* This call needs to be run as root */
                change_to_root_user();
-
-               req->ev_ctx = req->sconn->root_ev_ctx;
        }
 
        /* load service specific parameters */
index f2617fab3b3719ceb748d1d870e329a09cdd149d..405bd6ce00462768f3feddcb4fd7eb6a3008fdef 100644 (file)
@@ -5417,7 +5417,7 @@ void reply_close(struct smb_request *req)
                 */
 
                fsp->deferred_close = tevent_wait_send(
-                       fsp, req->ev_ctx);
+                       fsp, fsp->conn->sconn->ev_ctx);
                if (fsp->deferred_close == NULL) {
                        status = NT_STATUS_NO_MEMORY;
                        goto done;
index ec9c0f1376b7c0e77f95ad5a14f019112487f40c..ae6b9214b229c46e8091973a5c82ae5f071828f3 100644 (file)
@@ -86,7 +86,7 @@ NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
        }
 
-       subreq = smbd_smb2_oplock_break_send(req, req->ev_ctx,
+       subreq = smbd_smb2_oplock_break_send(req, req->sconn->ev_ctx,
                                             req, in_fsp, in_oplock_level);
        if (subreq == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
@@ -265,7 +265,7 @@ static NTSTATUS smbd_smb2_request_process_lease_break(
        in_lease_key.data[1] = BVAL(inbody, 16);
        in_lease_state = IVAL(inbody, 24);
 
-       subreq = smbd_smb2_lease_break_send(req, req->ev_ctx, req,
+       subreq = smbd_smb2_lease_break_send(req, req->sconn->ev_ctx, req,
                                            in_lease_key, in_lease_state);
        if (subreq == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
index 1888736e4ae3397e0f899c7af8d1e84d342058a6..dea9512dfc6e7a9f2274d7326a548359782098c0 100644 (file)
@@ -70,7 +70,7 @@ NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_close_send(req, req->ev_ctx,
+       subreq = smbd_smb2_close_send(req, req->sconn->ev_ctx,
                                      req, in_fsp, in_flags);
        if (subreq == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
index fdd04ac0331f1239a80ff2ee3e18b2c3dba8662a..9de7cef6f10888ebd41c773d3a78f326677f4c2c 100644 (file)
@@ -228,7 +228,7 @@ NTSTATUS smbd_smb2_request_process_create(struct smbd_smb2_request *smb2req)
        }
 
        tsubreq = smbd_smb2_create_send(smb2req,
-                                      smb2req->ev_ctx,
+                                      smb2req->sconn->ev_ctx,
                                       smb2req,
                                       in_oplock_level,
                                       in_impersonation_level,
@@ -1759,7 +1759,7 @@ bool schedule_deferred_open_message_smb2(
                (unsigned long long)mid ));
 
        tevent_schedule_immediate(state->im,
-                       smb2req->ev_ctx,
+                       smb2req->sconn->ev_ctx,
                        smbd_smb2_create_request_dispatch_immediate,
                        smb2req);
 
@@ -1791,7 +1791,7 @@ static bool smbd_smb2_create_cancel(struct tevent_req *req)
 
        remove_deferred_open_message_smb2_internal(smb2req, mid);
 
-       tevent_req_defer_callback(req, smb2req->ev_ctx);
+       tevent_req_defer_callback(req, smb2req->sconn->ev_ctx);
        tevent_req_nterror(req, NT_STATUS_CANCELLED);
        return true;
 }
index 4f815a6f5b0c57df164bb97e02e59dafc4a202b7..470a8df494420215d0aaeb7c85611dc3a90e79e6 100644 (file)
@@ -58,7 +58,7 @@ NTSTATUS smbd_smb2_request_process_flush(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_flush_send(req, req->ev_ctx,
+       subreq = smbd_smb2_flush_send(req, req->sconn->ev_ctx,
                                      req, in_fsp);
        if (subreq == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
index 314f44e858cf00a3b957c10d532067834e6c7bcc..29625fc1ba70cbfcd0f5edd7c202c2e9f69c2a74 100644 (file)
@@ -122,7 +122,7 @@ NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_getinfo_send(req, req->ev_ctx,
+       subreq = smbd_smb2_getinfo_send(req, req->sconn->ev_ctx,
                                        req, in_fsp,
                                        in_info_type,
                                        in_file_info_class,
index cccc763c3425a011a544a0182eaf4bda43973595..6a73ec050e246139cc688f3ac323916168394457 100644 (file)
@@ -46,7 +46,6 @@ struct smb_request *smbd_smb2_fake_smb_request(struct smbd_smb2_request *req)
        smbreq->conn = req->tcon->compat;
        smbreq->sconn = req->sconn;
        smbreq->xconn = req->xconn;
-       smbreq->ev_ctx = req->ev_ctx;
        smbreq->smbpid = (uint16_t)IVAL(inhdr, SMB2_HDR_PID);
        smbreq->flags2 = FLAGS2_UNICODE_STRINGS |
                         FLAGS2_32_BIT_ERROR_CODES |
index 451733c1a6593186c5b3c030a89542e34d72d046..be70e3a091285e44407394d67a023b7b34787efa 100644 (file)
@@ -217,7 +217,7 @@ NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req)
                break;
        }
 
-       subreq = smbd_smb2_ioctl_send(req, req->ev_ctx,
+       subreq = smbd_smb2_ioctl_send(req, req->sconn->ev_ctx,
                                      req, in_fsp,
                                      in_ctl_code,
                                      in_input_buffer,
index f8012ae1920346c0b30eba9e18930c6ebd0e0347..f9e3dec049c087eebbbc7d3ce452cb6e95205189 100644 (file)
@@ -143,7 +143,7 @@ static void smbd_smb2_ioctl_pipe_write_done(struct tevent_req *subreq)
                (unsigned int)state->out_output.length ));
 
        subreq = np_read_send(state->smbreq->conn,
-                             state->smb2req->ev_ctx,
+                             state->smb2req->sconn->ev_ctx,
                              state->fsp->fake_file_handle,
                              state->out_output.data,
                              state->out_output.length);
index da5a54df623349c15e38ea829ff0384559c84a1e..3cc591089a42a5df7f0f51edf7247874b08b9c2a 100644 (file)
@@ -134,7 +134,7 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_lock_send(req, req->ev_ctx,
+       subreq = smbd_smb2_lock_send(req, req->sconn->ev_ctx,
                                     req, in_fsp,
                                     in_lock_count,
                                     in_locks);
@@ -368,7 +368,7 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
        }
 
        if (async) {
-               tevent_req_defer_callback(req, smb2req->ev_ctx);
+               tevent_req_defer_callback(req, smb2req->sconn->ev_ctx);
                SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(smb2req->profile);
                return req;
        }
index e49e76d9641316da147a18ff91e363a9b2fde325..242415625567f070e83d6ea66ecb0bbfeec3a5ac 100644 (file)
@@ -94,7 +94,7 @@ NTSTATUS smbd_smb2_request_process_notify(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_notify_send(req, req->ev_ctx,
+       subreq = smbd_smb2_notify_send(req, req->sconn->ev_ctx,
                                       req, in_fsp,
                                       in_flags,
                                       in_output_buffer_length,
@@ -355,7 +355,7 @@ static void smbd_smb2_notify_reply(struct smb_request *smbreq,
                }
        }
 
-       tevent_req_defer_callback(req, state->smb2req->ev_ctx);
+       tevent_req_defer_callback(req, state->smb2req->sconn->ev_ctx);
 
        if (!NT_STATUS_IS_OK(state->status)) {
                tevent_req_nterror(req, state->status);
index ab6c3dc788eec8a18920378a603073aacbf8c1de..a80c9f596770979b086e949ed68a29acd2ef36f1 100644 (file)
@@ -125,7 +125,7 @@ NTSTATUS smbd_smb2_request_process_query_directory(struct smbd_smb2_request *req
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_query_directory_send(req, req->ev_ctx,
+       subreq = smbd_smb2_query_directory_send(req, req->sconn->ev_ctx,
                                     req, in_fsp,
                                     in_file_info_class,
                                     in_flags,
index 065a5cd5fc69b6ddd1ca3257113d3aec4821de1a..a7d2496bc6f30e4a7f425fa9fe9a0d53116f1b66 100644 (file)
@@ -97,7 +97,7 @@ NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_read_send(req, req->ev_ctx,
+       subreq = smbd_smb2_read_send(req, req->sconn->ev_ctx,
                                     req, in_fsp,
                                     in_flags,
                                     in_length,
index e36db1e55f5e3ce12b888927aac053e45e27e3e1..1e9ed331aa6a41b93d79795587bc309afe221e61 100644 (file)
@@ -2620,10 +2620,8 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
                SMB_ASSERT(call->fileid_ofs == 0);
                /* This call needs to be run as root */
                change_to_root_user();
-               req->ev_ctx = req->sconn->root_ev_ctx;
        } else {
                SMB_ASSERT(call->need_tcon);
-               req->ev_ctx = req->tcon->compat->user_ev_ctx;
        }
 
 #define _INBYTES(_r) \
index 5420d4f09bbdab4f6a4cc4ca5734fca0279a940e..2c24e7a1abcb66d823c2981cdabaefc0cd2b10b0 100644 (file)
@@ -95,7 +95,7 @@ NTSTATUS smbd_smb2_request_process_sesssetup(struct smbd_smb2_request *smb2req)
        in_security_buffer.length = in_security_length;
 
        subreq = smbd_smb2_session_setup_wrap_send(smb2req,
-                                                  smb2req->ev_ctx,
+                                                  smb2req->sconn->ev_ctx,
                                                   smb2req,
                                                   in_session_id,
                                                   in_flags,
@@ -1218,7 +1218,7 @@ NTSTATUS smbd_smb2_request_process_logoff(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, status);
        }
 
-       subreq = smbd_smb2_logoff_send(req, req->ev_ctx, req);
+       subreq = smbd_smb2_logoff_send(req, req->sconn->ev_ctx, req);
        if (subreq == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
        }
index 7c1f84bd79de5d876153072b784ec18d102783c6..b19cbb150a7f64bc2c2333d3e7339339cfe71e08 100644 (file)
@@ -108,7 +108,7 @@ NTSTATUS smbd_smb2_request_process_setinfo(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_setinfo_send(req, req->ev_ctx,
+       subreq = smbd_smb2_setinfo_send(req, req->sconn->ev_ctx,
                                        req, in_fsp,
                                        in_info_type,
                                        in_file_info_class,
index 3a4a15d3059ecc3229d4163ba1499ebdb659792e..ebd31602efcd8b2349f2e81fe2c1ac29e756e0eb 100644 (file)
@@ -94,7 +94,7 @@ NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req)
        }
 
        subreq = smbd_smb2_tree_connect_send(req,
-                                            req->ev_ctx,
+                                            req->sconn->ev_ctx,
                                             req,
                                             in_path_string);
        if (subreq == NULL) {
@@ -491,7 +491,7 @@ NTSTATUS smbd_smb2_request_process_tdis(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, status);
        }
 
-       subreq = smbd_smb2_tdis_send(req, req->ev_ctx, req);
+       subreq = smbd_smb2_tdis_send(req, req->sconn->ev_ctx, req);
        if (subreq == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
        }
index d5ab12ecc21ac8ab8292a0f1b2c31f582de552b7..ee95bd317aefff1ad614b446ec6e179ab4918f07 100644 (file)
@@ -109,7 +109,7 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
                return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
        }
 
-       subreq = smbd_smb2_write_send(req, req->ev_ctx,
+       subreq = smbd_smb2_write_send(req, req->sconn->ev_ctx,
                                      req, in_fsp,
                                      in_data_buffer,
                                      in_offset,