]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
torture: g_lock will allow duplicate READ locks soon
authorVolker Lendecke <vl@samba.org>
Mon, 28 Oct 2019 12:50:09 +0000 (13:50 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 22 Nov 2019 23:57:48 +0000 (23:57 +0000)
In the future, g_lock will not check for duplicate READ locks anymore,
as there might be many of them and the check might be expensive

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/torture/test_g_lock.c

index 263192baaddebb6d54ef6df420561d89df5c6879..e00432c9915619cabd8db95d2e79719272397f9a 100644 (file)
@@ -68,7 +68,7 @@ bool run_g_lock1(int dummy)
                goto fail;
        }
 
-       status = g_lock_lock(ctx, string_term_tdb_data(lockname), G_LOCK_READ,
+       status = g_lock_lock(ctx, string_term_tdb_data(lockname), G_LOCK_WRITE,
                             (struct timeval) { .tv_sec = 1 });
        if (!NT_STATUS_IS_OK(status)) {
                fprintf(stderr, "g_lock_lock failed: %s\n",
@@ -76,7 +76,7 @@ bool run_g_lock1(int dummy)
                goto fail;
        }
 
-       status = g_lock_lock(ctx, string_term_tdb_data(lockname), G_LOCK_READ,
+       status = g_lock_lock(ctx, string_term_tdb_data(lockname), G_LOCK_WRITE,
                             (struct timeval) { .tv_sec = 1 });
        if (!NT_STATUS_EQUAL(status, NT_STATUS_WAS_LOCKED)) {
                fprintf(stderr, "Double lock got %s\n",
@@ -287,14 +287,6 @@ bool run_g_lock3(int dummy)
                goto fail;
        }
 
-       status = g_lock_lock(ctx, string_term_tdb_data(lockname), G_LOCK_READ,
-                            (struct timeval) { .tv_sec = 1 });
-       if (!NT_STATUS_EQUAL(status, NT_STATUS_WAS_LOCKED)) {
-               fprintf(stderr, "g_lock_lock returned %s, expected %s\n",
-                       nt_errstr(status), nt_errstr(NT_STATUS_WAS_LOCKED));
-               goto fail;
-       }
-
        state.lock_type = G_LOCK_READ;
        state.ok = false;