diff options
author | Amitay Isaacs <amitay@gmail.com> | 2015-06-02 00:22:07 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2015-06-12 12:40:54 +0200 |
commit | 5ae6a8f2fff5b5f4d46f496fd83f555be4b3d448 (patch) | |
tree | b559d07f1f99df4f6fc045b153332e0f6f75e224 /ctdb | |
parent | 752ec31bcbbfe9f5b3b1c5dde4179d69f41cb53c (diff) | |
download | samba-5ae6a8f2fff5b5f4d46f496fd83f555be4b3d448.tar.gz |
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>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/server/ctdb_lock.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c index d5eb7176813..3e5208e6867 100644 --- a/ctdb/server/ctdb_lock.c +++ b/ctdb/server/ctdb_lock.c @@ -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); |