aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2023-01-04 16:05:36 -0800
committerBrian Behlendorf <[email protected]>2023-01-10 13:27:48 -0800
commit0c8fbe5b6adcf8a9bf8445eb2d95a3e24531b8d4 (patch)
tree9d4e9e9ab71ce4d00d171029154923f5914157fc /cmd
parent549aafb7c809554fe887e0cb00d280f8e49e9f41 (diff)
ztest: update ztest_dmu_snapshot_create_destroy()
ECHRNG is returned when the channel program encounters a runtime error. For example, this can happen when a snapshot doesn't exist. We handle this error the same way as the existing EEXIST and ENOENT error checks. Additionally, improve the internal debug message to include the error describing why a pool couldn't be opened. Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #14351
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ztest.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd/ztest.c b/cmd/ztest.c
index a4a59ae4e..9dce486ee 100644
--- a/cmd/ztest.c
+++ b/cmd/ztest.c
@@ -4299,7 +4299,7 @@ ztest_snapshot_create(char *osname, uint64_t id)
ztest_record_enospc(FTAG);
return (B_FALSE);
}
- if (error != 0 && error != EEXIST) {
+ if (error != 0 && error != EEXIST && error != ECHRNG) {
fatal(B_FALSE, "ztest_snapshot_create(%s@%s) = %d", osname,
snapname, error);
}
@@ -4316,7 +4316,7 @@ ztest_snapshot_destroy(char *osname, uint64_t id)
osname, id);
error = dsl_destroy_snapshot(snapname, B_FALSE);
- if (error != 0 && error != ENOENT)
+ if (error != 0 && error != ENOENT && error != ECHRNG)
fatal(B_FALSE, "ztest_snapshot_destroy(%s) = %d",
snapname, error);
return (B_TRUE);
@@ -4365,9 +4365,16 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
/*
* Verify that the destroyed dataset is no longer in the namespace.
+ * It may still be present if the destroy above fails with ENOSPC.
*/
- VERIFY3U(ENOENT, ==, ztest_dmu_objset_own(name, DMU_OST_OTHER, B_TRUE,
- B_TRUE, FTAG, &os));
+ error = ztest_dmu_objset_own(name, DMU_OST_OTHER, B_TRUE, B_TRUE,
+ FTAG, &os);
+ if (error == 0) {
+ dmu_objset_disown(os, B_TRUE, FTAG);
+ ztest_record_enospc(FTAG);
+ goto out;
+ }
+ VERIFY3U(ENOENT, ==, error);
/*
* Verify that we can create a new dataset.