diff options
author | Bill Pijewski <wdp@joyent.com> | 2012-03-14 15:45:49 -0700 |
---|---|---|
committer | Bill Pijewski <wdp@joyent.com> | 2012-03-14 15:45:49 -0700 |
commit | 6b416d6a0d33a5ed7af8c28539d3b12c465b9268 (patch) | |
tree | a803fcafbad09721acff89811111af0427a3ea9e /usr/src/cmd/zfs | |
parent | c52e66252f6592f05c07eb9492ec717f7e657d46 (diff) | |
download | illumos-joyent-6b416d6a0d33a5ed7af8c28539d3b12c465b9268.tar.gz |
OS-1031 zfs destroy -F doesn't handle EBUSY from zfs_unmount()
Reviewed by: David Pacheco <dap@joyent.com>
Diffstat (limited to 'usr/src/cmd/zfs')
-rw-r--r-- | usr/src/cmd/zfs/zfs_main.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c index af11997405..6dda1db34d 100644 --- a/usr/src/cmd/zfs/zfs_main.c +++ b/usr/src/cmd/zfs/zfs_main.c @@ -1003,9 +1003,6 @@ destroy_callback(zfs_handle_t *zhp, void *data) zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) goto out; - if ((err = zfs_unmount(zhp, NULL, cbp->cb_force ? MS_FORCE : 0)) != 0) - goto out; - if (cbp->cb_wait) libzfs_print_on_error(g_zfs, B_FALSE); @@ -1015,16 +1012,32 @@ destroy_callback(zfs_handle_t *zhp, void *data) * non-EBUSY error code. */ if (!cbp->cb_dryrun) { - while ((err = zfs_destroy(zhp, cbp->cb_defer_destroy)) != 0) { - if (cbp->cb_wait && libzfs_errno(g_zfs) == EZFS_BUSY) { - (void) nanosleep(&ts, NULL); - continue; - } - (void) fprintf(stderr, "%s: %s\n", libzfs_error_action(g_zfs), - libzfs_error_description(g_zfs)); - break; - } - } + while ((err = zfs_unmount(zhp, NULL, + cbp->cb_force ? MS_FORCE : 0)) != 0) { + if (cbp->cb_wait && libzfs_errno(g_zfs) == EZFS_BUSY) { + (void) nanosleep(&ts, NULL); + continue; + } + (void) fprintf(stderr, "%s: %s\n", + libzfs_error_action(g_zfs), + libzfs_error_description(g_zfs)); + break; + } + + if (err != 0) + goto out; + + while ((err = zfs_destroy(zhp, cbp->cb_defer_destroy)) != 0) { + if (cbp->cb_wait && libzfs_errno(g_zfs) == EZFS_BUSY) { + (void) nanosleep(&ts, NULL); + continue; + } + (void) fprintf(stderr, "%s: %s\n", + libzfs_error_action(g_zfs), + libzfs_error_description(g_zfs)); + break; + } + } libzfs_print_on_error(g_zfs, B_TRUE); |