From: Martin Schwenke Date: Fri, 5 Jul 2019 05:39:23 +0000 (+1000) Subject: ctdb-mutex: Exit immediately if the lock isn't taken X-Git-Tag: tdb-1.4.2~405 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f768a090e0a1f34660227e1aedc0ed03ea98534;p=thirdparty%2Fsamba.git 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 --- 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) {