From: Volker Lendecke Date: Mon, 28 Oct 2019 12:50:09 +0000 (+0100) Subject: torture: g_lock will allow duplicate READ locks soon X-Git-Tag: ldb-2.1.0~617 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=859148479b98678ee4bfa8084a6dc56bcc10a4c5;p=thirdparty%2Fsamba.git 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 --- 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;