Sort the blocking snapshots list #12751 (#17264)

When multiple snapshots prevent the destruction/rollback of the
respective dataset/snapshot/volume via zfs destroy or zfs rollback,
the error message does not list the blocking snapshots sorted
according to their order of creation. This causes inconvenience and can
lead to confusion, and also creates a contrast with a returned message
from zfs list -t snap function.

Closes: #12751

Signed-off-by: Artem-OSSRevival <artem.vlasenko@ossrevival.org>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
This commit is contained in:
Artem 2025-05-02 03:40:23 +03:00 committed by GitHub
parent aa46cc9812
commit 27f3d94940
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -4443,7 +4443,7 @@ zfs_do_rollback(int argc, char **argv)
if (cb.cb_create > 0) if (cb.cb_create > 0)
min_txg = cb.cb_create; min_txg = cb.cb_create;
if ((ret = zfs_iter_snapshots_v2(zhp, 0, rollback_check, &cb, if ((ret = zfs_iter_snapshots_sorted_v2(zhp, 0, rollback_check, &cb,
min_txg, 0)) != 0) min_txg, 0)) != 0)
goto out; goto out;
if ((ret = zfs_iter_bookmarks_v2(zhp, 0, rollback_check, &cb)) != 0) if ((ret = zfs_iter_bookmarks_v2(zhp, 0, rollback_check, &cb)) != 0)

View File

@ -570,7 +570,7 @@ iter_dependents_cb(zfs_handle_t *zhp, void *arg)
err = zfs_iter_filesystems_v2(zhp, ida->flags, err = zfs_iter_filesystems_v2(zhp, ida->flags,
iter_dependents_cb, ida); iter_dependents_cb, ida);
if (err == 0) if (err == 0)
err = zfs_iter_snapshots_v2(zhp, ida->flags, err = zfs_iter_snapshots_sorted_v2(zhp, ida->flags,
iter_dependents_cb, ida, 0, 0); iter_dependents_cb, ida, 0, 0);
ida->stack = isf.next; ida->stack = isf.next;
} }