From 859148479b98678ee4bfa8084a6dc56bcc10a4c5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 28 Oct 2019 13:50:09 +0100 Subject: [PATCH] torture: g_lock will allow duplicate READ locks soon 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 Reviewed-by: Jeremy Allison --- source3/torture/test_g_lock.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/source3/torture/test_g_lock.c b/source3/torture/test_g_lock.c index 263192baadd..e00432c9915 100644 --- a/source3/torture/test_g_lock.c +++ b/source3/torture/test_g_lock.c @@ -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; -- 2.47.3