summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2015-06-02 11:25:44 +1000
committerAmitay Isaacs <amitay@samba.org>2015-06-12 12:40:54 +0200
commitbc747030d435447e62262541cf2e74be4c4229d8 (patch)
tree0d6e52d09967a8d52a2f8f00a8370c4de32d159f
parent2b352ff20597b9e34b3777d35deca1bf56209f8a (diff)
downloadsamba-bc747030d435447e62262541cf2e74be4c4229d8.tar.gz
ctdb-locking: Avoid resetting talloc destructor
Let ctdb_lock_request_destructor() take care of the proper cleanup. If the request if freed from the callback function, then the lock context should not be freed. Setting request->lctx to NULL takes care of that in the destructor. 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>
-rw-r--r--ctdb/server/ctdb_lock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c
index 2377ac0ef80..7b43b1df353 100644
--- a/ctdb/server/ctdb_lock.c
+++ b/ctdb/server/ctdb_lock.c
@@ -353,8 +353,10 @@ static void process_callbacks(struct lock_context *lock_ctx, bool locked)
request = lock_ctx->request;
if (lock_ctx->auto_mark) {
- /* Reset the destructor, so request is not removed from the list */
- talloc_set_destructor(request, NULL);
+ /* Since request may be freed in the callback, unset the lock
+ * context, so request destructor will not free lock context.
+ */
+ request->lctx = NULL;
}
/* Since request may be freed in the callback, unset the request */