Skip to content

zfs destroy's and zfs rollback's error messages do not list blocking snapshots sorted #12751

Closed
@ChristophSchmidpeter

Description

@ChristophSchmidpeter

System information

Type Version/Name
Distribution Name Arch Linux
Distribution Version NA
Kernel Version 5.14.2 (zen)
Architecture x64
OpenZFS Version 2.1.1

Describe the problem you're observing

When multiple snapshots prevent the destruction/rollback of the respective dataset/snapshot/volume via zfs destroy or zfs rollback, the respective error message does not list the blocking snapshots sorted according to their order of creation.

Describe how to reproduce the problem

The commands

zfs create MyPool/Test
zfs snap MyPool/Test@Snap1
zfs snap MyPool/Test@Snap2
zfs snap MyPool/Test@Snap3
zfs snap MyPool/Test@Snap4
zfs snap MyPool/Test@Snap5
zfs snap MyPool/Test@Snap6
zfs destroy MyPool/Test

result in the following error message:

cannot destroy 'ZfsRoot/Test': filesystem has children
use '-r' to destroy the following datasets:
MyPool/Test@Snap3
MyPool/Test@Snap4
MyPool/Test@Snap6
MyPool/Test@Snap1
MyPool/Test@Snap5
MyPool/Test@Snap2

Equivalent behaviour occurs when trying to roll back to a blocked snapshot, e.g. via zfs rollback MyPool/Test@Snap1

Notice how, as mentioned, the resulting error message does not list the snapshots 1-6 in the order of their creation. This results in the error message being somewhat confusing/less intuitive and less informative and thus less useful. It also results in a less uniform behaviour, as zfs list -t snap MyPool/Test in contrast sorts the blocking snapshots in the order of their creation already:

zfs list -t snap MyPool/Test
NAME                 USED  AVAIL     REFER  MOUNTPOINT
MyPool/Test@Snap1     0B      -      304K  -
MyPool/Test@Snap2     0B      -      304K  -
MyPool/Test@Snap3     0B      -      304K  -
MyPool/Test@Snap4     0B      -      304K  -
MyPool/Test@Snap5     0B      -      304K  -
MyPool/Test@Snap6     0B      -      304K  -

Include any warning/errors/backtraces from the system logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bot: Not StaleOverride for the stale botType: DefectIncorrect behavior (e.g. crash, hang)good first issueIndicates a good issue for first-time contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions