smbd: explain that/why we use the raw tevent_context for oplock_timeout_handler()
authorStefan Metzmacher <metze@samba.org>
Thu, 22 Mar 2018 09:54:41 +0000 (10:54 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Jun 2018 06:59:19 +0000 (08:59 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/oplock.c

index b13aae888202437cf523fd4072d606ab43fb5cf1..f7654176a88081bece5ef97616988abd3c11a997 100644 (file)
@@ -727,6 +727,11 @@ static void oplock_timeout_handler(struct tevent_context *ctx,
 {
        files_struct *fsp = (files_struct *)private_data;
 
+       /*
+        * Note this function doesn't run under any specific impersonation and
+        * is not expected to call any SMB_VFS operation!
+        */
+
        SMB_ASSERT(fsp->sent_oplock_break != NO_BREAK_SENT);
 
        /* Remove the timed event handler. */
@@ -761,8 +766,15 @@ static void add_oplock_timeout_handler(files_struct *fsp)
                          "around\n"));
        }
 
+       /*
+        * For now we keep the logic and use the
+        * raw event context. We're called from
+        * the messaging system from a raw event context.
+        * Also oplock_timeout_handler doesn't invoke
+        * SMB_VFS calls.
+        */
        fsp->oplock_timeout =
-               tevent_add_timer(fsp->conn->sconn->ev_ctx, fsp,
+               tevent_add_timer(fsp->conn->sconn->raw_ev_ctx, fsp,
                                 timeval_current_ofs(OPLOCK_BREAK_TIMEOUT, 0),
                                 oplock_timeout_handler, fsp);