]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
torture3: Enhance g_lock6 to run without CLEAR_IF_FIRST
authorVolker Lendecke <vl@samba.org>
Tue, 14 Aug 2018 11:53:11 +0000 (13:53 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 17 Aug 2018 05:39:17 +0000 (07:39 +0200)
CLEAR_IF_FIRST doesn't really work in the cluster. This needs to be
applied to all tests, but lock6 is what I care about right now.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13195
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/torture/test_g_lock.c

index ed1cd180f549e7af4408201895d9afc257f26e83..6ad421946504de4277dd18eee57a5001b435661e 100644 (file)
@@ -751,6 +751,24 @@ bool run_g_lock6(int dummy)
                return false;
        }
 
+       /*
+        * Wipe all stale locks -- in clustered mode there's no
+        * CLEAR_IF_FIRST
+        */
+       status = g_lock_lock(ctx, lockname, G_LOCK_WRITE,
+                            (struct timeval) { .tv_sec = 1 });
+       if (!NT_STATUS_IS_OK(status)) {
+               fprintf(stderr, "g_lock_lock failed: %s\n",
+                       nt_errstr(status));
+               return false;
+       }
+       status = g_lock_unlock(ctx, lockname);
+       if (!NT_STATUS_IS_OK(status)) {
+               fprintf(stderr, "g_lock_unlock failed: %s\n",
+                       nt_errstr(status));
+               return false;
+       }
+
        nprocs = 2;
        for (i=0; i<nprocs; i++) {