mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-locking: Set destructor when lock_context is created
There is already code in the destructor to correctly remove it from the pending or the active queue. This also ensures that when lock context is in pending queue and if the lock request gets freed, the lock context is correctly removed from the pending queue. Thanks to Stefan Metzmacher for noticing this and suggesting the fix. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
752ec31bcb
commit
5ae6a8f2ff
@ -816,8 +816,6 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
|
||||
/* Parent process */
|
||||
close(lock_ctx->fd[1]);
|
||||
|
||||
talloc_set_destructor(lock_ctx, ctdb_lock_context_destructor);
|
||||
|
||||
talloc_free(tmp_ctx);
|
||||
|
||||
/* Set up timeout handler */
|
||||
@ -829,7 +827,6 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
|
||||
if (lock_ctx->ttimer == NULL) {
|
||||
ctdb_kill(ctdb, lock_ctx->child, SIGKILL);
|
||||
lock_ctx->child = -1;
|
||||
talloc_set_destructor(lock_ctx, NULL);
|
||||
close(lock_ctx->fd[0]);
|
||||
return;
|
||||
}
|
||||
@ -845,7 +842,6 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
|
||||
TALLOC_FREE(lock_ctx->ttimer);
|
||||
ctdb_kill(ctdb, lock_ctx->child, SIGKILL);
|
||||
lock_ctx->child = -1;
|
||||
talloc_set_destructor(lock_ctx, NULL);
|
||||
close(lock_ctx->fd[0]);
|
||||
return;
|
||||
}
|
||||
@ -943,6 +939,7 @@ static struct lock_request *ctdb_lock_internal(TALLOC_CTX *mem_ctx,
|
||||
request->private_data = private_data;
|
||||
|
||||
talloc_set_destructor(request, ctdb_lock_request_destructor);
|
||||
talloc_set_destructor(lock_ctx, ctdb_lock_context_destructor);
|
||||
|
||||
ctdb_lock_schedule(ctdb);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user