summaryrefslogtreecommitdiffstats
path: root/cmd/ztest
diff options
context:
space:
mode:
authorTom Caputi <[email protected]>2018-11-07 18:46:50 -0500
committerBrian Behlendorf <[email protected]>2018-11-07 15:46:50 -0800
commita2d88f778a31111fcf98ecf3a690888bab07055e (patch)
treef85e9f7edd278ba070028dd34c24a16e9344df9e /cmd/ztest
parent20eb30d08e24c2240a5d66e2e62893e784f586af (diff)
Fix !zilog_is_dirty() assert during ztest
ztest occasionally hits an assert that !zilog_is_dirty() during zil_close(). This is caused by an interaction between 2 threads. First, ztest_run() waits for each test thread to complete and closes the associated dataset as soon as the thread joins. At the same time, the ztest_vdev_add_remove() test may attempt to remove the slog, which will open, dirty, and reset the logs on every dataset in the pool (including those of other threads). This patch simply ensures that we always join all of the test threads before closing any datasets. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tom Caputi <[email protected]> Closes #8094
Diffstat (limited to 'cmd/ztest')
-rw-r--r--cmd/ztest/ztest.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 36647c4ff..eab8940fb 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -6918,11 +6918,17 @@ ztest_run(ztest_shared_t *zs)
}
/*
- * Wait for all of the tests to complete. We go in reverse order
- * so we don't close datasets while threads are still using them.
+ * Wait for all of the tests to complete.
*/
- for (t = ztest_opts.zo_threads - 1; t >= 0; t--) {
+ for (t = 0; t < ztest_opts.zo_threads; t++)
VERIFY0(thread_join(run_threads[t]));
+
+ /*
+ * Close all datasets. This must be done after all the threads
+ * are joined so we can be sure none of the datasets are in-use
+ * by any of the threads.
+ */
+ for (t = 0; t < ztest_opts.zo_threads; t++) {
if (t < ztest_opts.zo_datasets)
ztest_dataset_close(t);
}