aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorAlek P <[email protected]>2018-06-06 13:14:52 -0400
committerBrian Behlendorf <[email protected]>2018-06-06 10:14:52 -0700
commit6969afcefdfb49fb9c0fcf56240e6eb133a2c4a8 (patch)
tree6f8a0b0e0e24ab47ad7434b297367e42bbaf8b64 /cmd
parent62841115bc77fbd8b55d89f07cbe1cc4fb3bc520 (diff)
Always continue recursive destroy after error
Currently, during a recursive zfs destroy the first error that is encountered will stop the destruction of the datasets. Errors may happen for a variety of reasons including competing deletions and busy datasets. This patch switches recursive destroy to always do a best-effort recursive dataset destroy. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Signed-off-by: Alek Pinchuk <[email protected]> Closes #7574
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 7d81dcaee..b45e93c3f 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -1189,6 +1189,15 @@ destroy_callback(zfs_handle_t *zhp, void *data)
zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 ||
zfs_destroy(zhp, cb->cb_defer_destroy) != 0) {
zfs_close(zhp);
+ /*
+ * When performing a recursive destroy we ignore errors
+ * so that the recursive destroy could continue
+ * destroying past problem datasets
+ */
+ if (cb->cb_recurse) {
+ cb->cb_error = B_TRUE;
+ return (0);
+ }
return (-1);
}
}
@@ -1558,7 +1567,7 @@ zfs_do_destroy(int argc, char **argv)
err = zfs_destroy_snaps_nvl(g_zfs,
cb.cb_batchedsnaps, cb.cb_defer_destroy);
}
- if (err != 0)
+ if (err != 0 || cb.cb_error == B_TRUE)
rv = 1;
}