vermaden/beadm — pull request #26 by asaddi (2014-10-21 02:13:06+00:00)
Title: Fix for oddities with ZFS bookmarks

The upcoming FreeBSD 10.1 release adds ZFS bookmarks.

While playing around with bookmarks, I noticed issues with "beadm list", e.g.:

> beadm list
BE Active Mountpoint Space Created
default - - 4.9M 2014-09-22 20:51
10.1-BETA3 - - 109.2M 2014-09-28 18:54
10.1-RC1 NR / 3.6G 2014-10-05 19:15
zroot - / 0.0K 2014-10-05 19:15
10.1-BETA3#incbackup-last - - 0.0K 2014-10-16 20:28
10.1-RC1#incbackup-last - - 0.0K 2014-10-16 20:28
default#incbackup-last - - 0.0K 2014-10-16 20:28

Contrast this to a properly behaving beadm:

> ./beadm list
BE Active Mountpoint Space Created
default - - 4.9M 2014-09-22 20:51
10.1-BETA3 - - 109.2M 2014-09-28 18:54
10.1-RC1 NR / 3.6G 2014-10-05 19:15

The issue seems to stem from the use of the "-t all" option to "zfs list." In older versions of FreeBSD, "-t all" simply was equivalent to "-t filesystem,snapshot,volume." But now it includes bookmarks. My fix simply replaces occurrences of "-t all" with "-t filesystem,snapshot,volume." Arguably, only filesystem and snapshot are relevant to beadm, so the list can probably be reduced down to just those two.

This change would only affect "beadm list" and "beadm destroy." I don't believe the presence of bookmarks would affect "beadm destroy," but I thought it would be safer to replace "-t all" there anyway.