mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-locking: move all auto_mark logic into process_callbacks()
The caller should not dereference lock_ctx after invoking process_callbacks(), it might be destroyed already. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Jun 12 15:28:57 CEST 2015 on sn-devel-104
This commit is contained in:
parent
a2690bc3f4
commit
b3a18d66c0
@ -392,6 +392,8 @@ static void process_callbacks(struct lock_context *lock_ctx, bool locked)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
talloc_free(lock_ctx);
|
||||
}
|
||||
|
||||
|
||||
@ -437,7 +439,6 @@ static void ctdb_lock_handler(struct tevent_context *ev,
|
||||
void *private_data)
|
||||
{
|
||||
struct lock_context *lock_ctx;
|
||||
TALLOC_CTX *tmp_ctx = NULL;
|
||||
char c;
|
||||
bool locked;
|
||||
double t;
|
||||
@ -451,11 +452,6 @@ static void ctdb_lock_handler(struct tevent_context *ev,
|
||||
t = timeval_elapsed(&lock_ctx->start_time);
|
||||
id = lock_bucket_id(t);
|
||||
|
||||
if (lock_ctx->auto_mark) {
|
||||
tmp_ctx = talloc_new(ev);
|
||||
talloc_steal(tmp_ctx, lock_ctx);
|
||||
}
|
||||
|
||||
/* Read the status from the child process */
|
||||
if (sys_read(lock_ctx->fd[0], &c, 1) != 1) {
|
||||
locked = false;
|
||||
@ -487,10 +483,6 @@ static void ctdb_lock_handler(struct tevent_context *ev,
|
||||
}
|
||||
|
||||
process_callbacks(lock_ctx, locked);
|
||||
|
||||
if (lock_ctx->auto_mark) {
|
||||
talloc_free(tmp_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user