From 2f768a090e0a1f34660227e1aedc0ed03ea98534 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 5 Jul 2019 15:39:23 +1000 Subject: [PATCH] ctdb-mutex: Exit immediately if the lock isn't taken There is no need to wait until the parent kills the helper. The parent will get the initial response, indicating contention or similar, and will then get a separate event indicating that the pipe is gone. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/server/ctdb_mutex_fcntl_helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ctdb/server/ctdb_mutex_fcntl_helper.c b/ctdb/server/ctdb_mutex_fcntl_helper.c index 166d9c2760e..44505047167 100644 --- a/ctdb/server/ctdb_mutex_fcntl_helper.c +++ b/ctdb/server/ctdb_mutex_fcntl_helper.c @@ -101,6 +101,10 @@ int main(int argc, char *argv[]) result = fcntl_lock(file, &fd); sys_write(STDOUT_FILENO, &result, 1); + if (result != '0') { + return 0; + } + ctdb_wait_for_process_to_exit(ppid); if (fd != -1) { -- 2.11.4.GIT