From ce91f973ec7cddeb825b900e8114886fc5ec9952 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sat, 26 Feb 2022 11:20:32 -0800 Subject: [PATCH] ztest: Fix ASSERT in ztest_objset_destroy_cb() The dsl_destroy_snapshot() call in ztest_objset_destroy_cb() may encounter a runtime error when the pool is out of space. This is similar to the error handling for the dsl_destroy_head() case, but since dsl_destroy_snapshot() is implemented as a channel program ECHRNG is returned instead of ENOSPC. ECHRNG may also be returned instead of EBUSY if there is a hold on the snapshot. Reviewed by: George Melikov Signed-off-by: Brian Behlendorf Closes #13155 --- cmd/ztest/ztest.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 0daaab69c7..73ed704714 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -4273,7 +4273,15 @@ ztest_objset_destroy_cb(const char *name, void *arg) * Destroy the dataset. */ if (strchr(name, '@') != NULL) { - VERIFY0(dsl_destroy_snapshot(name, B_TRUE)); + error = dsl_destroy_snapshot(name, B_TRUE); + if (error != ECHRNG) { + /* + * The program was executed, but encountered a runtime + * error, such as insufficient slop, or a hold on the + * dataset. + */ + ASSERT0(error); + } } else { error = dsl_destroy_head(name); if (error == ENOSPC) {