smbd: explain that/why we use the raw tevent_context for do_break_to_none()
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 f7654176a88081bece5ef97616988abd3c11a997..34bebc61f7a758e077e7ed0bdec39a26fff03f43 100644 (file)
@@ -1150,7 +1150,15 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
                TALLOC_FREE(state);
                return;
        }
-       tevent_schedule_immediate(im, sconn->ev_ctx, do_break_to_none, state);
+
+       /*
+        * do_break_to_none() only operates on the
+        * locking.tdb and send network packets to
+        * the client. That doesn't require any
+        * impersonation, so we just use the
+        * raw tevent context here.
+        */
+       tevent_schedule_immediate(im, sconn->raw_ev_ctx, do_break_to_none, state);
 }
 
 static void send_break_to_none(struct messaging_context *msg_ctx,
@@ -1177,6 +1185,11 @@ static void do_break_to_none(struct tevent_context *ctx,
        struct share_mode_lock *lck;
        struct share_mode_data *d;
 
+       /*
+        * Note this function doesn't run under any specific impersonation and
+        * is not expected to call any SMB_VFS operation!
+        */
+
        lck = get_existing_share_mode_lock(talloc_tos(), state->id);
        if (lck == NULL) {
                DEBUG(1, ("%s: failed to lock share mode entry for file %s.\n",