]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-mutex: Exit immediately if the lock isn't taken
authorMartin Schwenke <martin@meltin.net>
Fri, 5 Jul 2019 05:39:23 +0000 (15:39 +1000)
committerMartin Schwenke <martins@samba.org>
Fri, 26 Jul 2019 03:34:17 +0000 (03:34 +0000)
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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_mutex_fcntl_helper.c

index 166d9c2760ec00c393588469583eb4f8c7c001c0..44505047167e58c72b17dcbf5daefc4325cfed18 100644 (file)
@@ -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) {