From: Martin Schwenke Date: Tue, 8 Feb 2022 01:23:42 +0000 (+1100) Subject: ctdb-mutex: Test the lock by locking a 2nd byte range X-Git-Tag: samba-4.17.0rc1~247 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=061315cc795d8615fd94d4b23934ca1bf3aecebc;p=thirdparty%2Fsamba.git ctdb-mutex: Test the lock by locking a 2nd byte range 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 07f111a0d6b..84d3790db57 100644 --- a/ctdb/server/ctdb_mutex_fcntl_helper.c +++ b/ctdb/server/ctdb_mutex_fcntl_helper.c @@ -265,6 +265,23 @@ static void lock_io_check_loop(struct tevent_req *subreq) goto done; } + /* + * Attempt to lock a 2nd byte range. Using a blocking lock + * encourages ping timeouts if the cluster filesystem is in a + * bad state. It also makes testing easier. + */ + ret = fcntl_lock_fd(fd, true, 1); + if (ret != 0) { + fprintf(stderr, + "%s: " + "lock fail - lock file \"%s\" test lock error (%d)\n", + progname, + state->lock_file, + ret); + goto done; + } + + /* Unlock occurs on close */ close(fd); subreq = tevent_wakeup_send(