1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

ctdb: Make ctdb_lock_timeout_handler() easier to understand

Don't hide the real action inside an if-branch

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
This commit is contained in:
Volker Lendecke 2024-09-19 17:10:58 +02:00
parent f525800613
commit 2fa0eabe64

View File

@ -557,6 +557,7 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev,
bool skip; bool skip;
char *keystr; char *keystr;
const char **args; const char **args;
bool ok;
lock_ctx = talloc_get_type_abort(private_data, struct lock_context); lock_ctx = talloc_get_type_abort(private_data, struct lock_context);
ctdb = lock_ctx->ctdb; ctdb = lock_ctx->ctdb;
@ -595,26 +596,28 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev,
lock_debug: lock_debug:
if (ctdb_set_helper("lock debugging helper", ok = ctdb_set_helper("lock debugging helper",
debug_locks, sizeof(debug_locks), debug_locks,
"CTDB_DEBUG_LOCKS", sizeof(debug_locks),
getenv("CTDB_BASE"), "debug_locks.sh")) { "CTDB_DEBUG_LOCKS",
args = debug_locks_args(lock_ctx, lock_ctx); getenv("CTDB_BASE"),
if (args != NULL) { "debug_locks.sh");
pid = vfork(); if (!ok) {
if (pid == 0) { DBG_WARNING("Unable to setup lock debugging\n");
execvp(debug_locks, discard_const(args)); goto skip_lock_debug;
_exit(0); }
}
talloc_free(args); args = debug_locks_args(lock_ctx, lock_ctx);
ctdb_track_child(ctdb, pid); if (args != NULL) {
} else { pid = vfork();
D_WARNING("No memory for debug locks args\n"); if (pid == 0) {
execvp(debug_locks, discard_const(args));
_exit(0);
} }
talloc_free(args);
ctdb_track_child(ctdb, pid);
} else { } else {
DEBUG(DEBUG_WARNING, D_WARNING("No memory for debug locks args\n");
(__location__
" Unable to setup lock debugging\n"));
} }
skip_lock_debug: skip_lock_debug: