Skip to content

Commit

Permalink
ztest: Fix ASSERT in ztest_objset_destroy_cb()
Browse files Browse the repository at this point in the history
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 <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#13155
  • Loading branch information
behlendorf authored and andrewc12 committed Aug 30, 2022
1 parent fe0cb45 commit 16e6024
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/ztest/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 16e6024

Please sign in to comment.