Revert "s3:messages: protect against usage of wrapper tevent_context objects for...
authorRalph Boehme <slow@samba.org>
Thu, 27 Dec 2018 11:48:30 +0000 (12:48 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 Jan 2019 22:11:16 +0000 (23:11 +0100)
This reverts commit 7f2afc20e1b6397c364a98d1be006377c95e4665.

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>
source3/lib/messages.c
source3/lib/messages_ctdb.c
source3/lib/messages_ctdb_ref.c
source3/lib/messages_dgm.c
source3/lib/messages_dgm_ref.c

index 864d758..dd19173 100644 (file)
@@ -365,11 +365,6 @@ static bool messaging_alert_event_contexts(struct messaging_context *ctx)
                 * alternatively would be to track whether the
                 * immediate has already been scheduled. For
                 * now, avoid that complexity here.
-                *
-                * reg->ev and ctx->event_ctx can't
-                * be wrapper tevent_context pointers
-                * so we don't need to use
-                * tevent_context_same_loop().
                 */
 
                if (reg->ev == ctx->event_ctx) {
@@ -498,12 +493,6 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
 
        sec_init();
 
-       if (tevent_context_is_wrapper(ev)) {
-               /* This is really a programmer error! */
-               DBG_ERR("Should not be used with a wrapper tevent context\n");
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
        lck_path = lock_path(talloc_tos(), "msg.lock");
        if (lck_path == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -1025,13 +1014,6 @@ struct tevent_req *messaging_filtered_read_send(
        state->filter = filter;
        state->private_data = private_data;
 
-       if (tevent_context_is_wrapper(ev)) {
-               /* This is really a programmer error! */
-               DBG_ERR("Wrapper tevent context doesn't use main context.\n");
-               tevent_req_error(req, EINVAL);
-               return tevent_req_post(req, ev);
-       }
-
        /*
         * We have to defer the callback here, as we might be called from
         * within a different tevent_context than state->ev
@@ -1352,11 +1334,6 @@ static void messaging_dispatch_rec(struct messaging_context *msg_ctx,
        bool consumed;
        size_t i;
 
-       /*
-        * ev and msg_ctx->event_ctx can't be wrapper tevent_context pointers
-        * so we don't need to use tevent_context_same_loop().
-        */
-
        if (ev == msg_ctx->event_ctx) {
                consumed = messaging_dispatch_classic(msg_ctx, rec);
                if (consumed) {
index a1aeb37..d3e2e3f 100644 (file)
@@ -209,14 +209,6 @@ struct messaging_ctdb_fde *messaging_ctdb_register_tevent_context(
                return NULL;
        }
 
-       if (tevent_context_is_wrapper(ev)) {
-               /*
-                * This is really a programmer error!
-                */
-               DBG_ERR("Should not be used with a wrapper tevent context\n");
-               return NULL;
-       }
-
        fde = talloc(mem_ctx, struct messaging_ctdb_fde);
        if (fde == NULL) {
                return NULL;
index 47b4b75..3570ed8 100644 (file)
@@ -52,18 +52,6 @@ void *messaging_ctdb_ref(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 {
        struct msg_ctdb_ref *result, *tmp_refs;
 
-       if (tevent_context_is_wrapper(ev)) {
-               /*
-                * This is really a programmer error!
-                *
-                * The main/raw tevent context should
-                * have been registered first!
-                */
-               DBG_ERR("Should not be used with a wrapper tevent context\n");
-               *err = EINVAL;
-               return NULL;
-       }
-
        result = talloc(mem_ctx, struct msg_ctdb_ref);
        if (result == NULL) {
                *err = ENOMEM;
index a661a16..37eefeb 100644 (file)
@@ -993,12 +993,6 @@ int messaging_dgm_init(struct tevent_context *ev,
                return EEXIST;
        }
 
-       if (tevent_context_is_wrapper(ev)) {
-               /* This is really a programmer error! */
-               DBG_ERR("Should not be used with a wrapper tevent context\n");
-               return EINVAL;
-       }
-
        ctx = talloc_zero(NULL, struct messaging_dgm_context);
        if (ctx == NULL) {
                goto fail_nomem;
@@ -1683,14 +1677,6 @@ struct messaging_dgm_fde *messaging_dgm_register_tevent_context(
                return NULL;
        }
 
-       if (tevent_context_is_wrapper(ev)) {
-               /*
-                * This is really a programmer error!
-                */
-               DBG_ERR("Should not be used with a wrapper tevent context\n");
-               return NULL;
-       }
-
        fde = talloc(mem_ctx, struct messaging_dgm_fde);
        if (fde == NULL) {
                return NULL;
index fd17096..470dfbe 100644 (file)
@@ -55,18 +55,6 @@ void *messaging_dgm_ref(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 {
        struct msg_dgm_ref *result, *tmp_refs;
 
-       if (tevent_context_is_wrapper(ev)) {
-               /*
-                * This is really a programmer error!
-                *
-                * The main/raw tevent context should
-                * have been registered first!
-                */
-               DBG_ERR("Should not be used with a wrapper tevent context\n");
-               *err = EINVAL;
-               return NULL;
-       }
-
        result = talloc(mem_ctx, struct msg_dgm_ref);
        if (result == NULL) {
                *err = ENOMEM;