[PATCH] Extend torture3 g-lock6 test for lock upgrades
Volker Lendecke
Volker.Lendecke at SerNet.DE
Tue Aug 14 12:57:13 UTC 2018
Hi!
Apply the additional test from the 4.7 patch in bug 13195 also to
master to avoid this to happen again.
Review appreciated!
Thanks, Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
Meet us at Storage Developer Conference (SDC)
Santa Clara, CA USA, September 24th-27th 2018
-------------- next part --------------
From 77ee2bda7dd4223c7c2f4a7e84644074b8b7319d Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 14 Aug 2018 13:52:11 +0200
Subject: [PATCH 1/3] torture3: Simplify the g_lock6 test
Do string_term_tdb_data just once, this is a leftover from a sweeping
change from "char *" to TDB_DATA as g_lock key.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/torture/test_g_lock.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/source3/torture/test_g_lock.c b/source3/torture/test_g_lock.c
index 43e699fb173..ed1cd180f54 100644
--- a/source3/torture/test_g_lock.c
+++ b/source3/torture/test_g_lock.c
@@ -730,7 +730,7 @@ bool run_g_lock6(int dummy)
struct tevent_context *ev = NULL;
struct messaging_context *msg = NULL;
struct g_lock_ctx *ctx = NULL;
- const char *lockname = "lock6";
+ TDB_DATA lockname = string_term_tdb_data("lock6");
pid_t child;
int exit_pipe[2], ready_pipe[2];
NTSTATUS status;
@@ -780,7 +780,7 @@ bool run_g_lock6(int dummy)
exit(1);
}
status = g_lock_lock(ctx,
- string_term_tdb_data(lockname),
+ lockname,
G_LOCK_READ,
(struct timeval) { .tv_sec = 1 });
if (!NT_STATUS_IS_OK(status)) {
@@ -824,8 +824,7 @@ bool run_g_lock6(int dummy)
{
struct lock6_parser_state state;
- status = g_lock_dump(ctx, string_term_tdb_data(lockname),
- lock6_parser, &state);
+ status = g_lock_dump(ctx, lockname, lock6_parser, &state);
if (!NT_STATUS_IS_OK(status)) {
fprintf(stderr, "g_lock_dump returned %s\n",
nt_errstr(status));
@@ -838,7 +837,8 @@ bool run_g_lock6(int dummy)
return false;
}
- status = g_lock_lock(ctx, string_term_tdb_data(lockname),
+ status = g_lock_lock(ctx,
+ lockname,
G_LOCK_WRITE,
(struct timeval) { .tv_sec = 1 });
if (!NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
--
2.11.0
From eef23848271363df55386f34ea4cab29ccc79bf7 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 14 Aug 2018 13:53:11 +0200
Subject: [PATCH 2/3] torture3: Enhance g_lock6 to run without CLEAR_IF_FIRST
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.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/torture/test_g_lock.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/source3/torture/test_g_lock.c b/source3/torture/test_g_lock.c
index ed1cd180f54..6ad42194650 100644
--- a/source3/torture/test_g_lock.c
+++ b/source3/torture/test_g_lock.c
@@ -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++) {
--
2.11.0
From 5bc76f10f88474a19feb19c1d4e3c5cd8fb79f9e Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 14 Aug 2018 13:54:56 +0200
Subject: [PATCH 3/3] torture3: Extend the g_lock6 test to also cover upgrades
The fixes for #13195 were incomplete and did not cover upgrades
properly. It's all gone in master with the new code.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/torture/test_g_lock.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/source3/torture/test_g_lock.c b/source3/torture/test_g_lock.c
index 6ad42194650..624f7cdd46e 100644
--- a/source3/torture/test_g_lock.c
+++ b/source3/torture/test_g_lock.c
@@ -865,6 +865,14 @@ bool run_g_lock6(int dummy)
nt_errstr(status));
return false;
}
+
+ status = g_lock_lock(ctx, lockname, G_LOCK_READ,
+ (struct timeval) { .tv_sec = 1 });
+ if (!NT_STATUS_IS_OK(status)) {
+ fprintf(stderr, "g_lock_lock failed: %s\n",
+ nt_errstr(status));
+ return false;
+ }
}
close(exit_pipe[1]);
@@ -878,6 +886,14 @@ bool run_g_lock6(int dummy)
}
}
+ 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;
+ }
+
return true;
}
--
2.11.0
More information about the samba-technical
mailing list