mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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 <behlendorf1@llnl.gov> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Alek Pinchuk <apinchuk@datto.com> Closes #7574
This commit is contained in:
+10
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user