[Bug 236043] bectl can't destroy origin snapshot

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Feb 26 00:00:08 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236043

            Bug ID: 236043
           Summary: bectl can't destroy origin snapshot
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: rob.fx907 at gmail.com

Created attachment 202370
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=202370&action=edit
don't check if a dataset is mounted when destroying a snapshot

How to reproduce:

$ bectl create bootenv

$ bectl list -s | grep -A1 bootenv
bootenv
  zroot/ROOT/bootenv                       -      -          8K    2019-02-25
12:45
    zroot/ROOT/solid at 2019-02-25-12:45:25   -      -          0     2019-02-25
12:45

$ bectl destroy -o bootenv
cannot destroy mounted boot env unless forced

$ bectl list | grep bootenv
/* no output*/

$ zfs list -t snapshot | grep solid at 2019-02-25-12:45:25
zroot/ROOT/solid at 2019-02-25-12:45:25                       0      -  21.7G  -

The bug is in the libbe library, specifically the 'be_destroy' function.
'be_destroy' can destroy
a boot environment by name or snapshot, in either case 'be_destroy' acquires a
zfs handle internally. When
'be_destroy' is given a boot environment name, the zfs handle will be the boot
environment dataset (zroot/ROOT/bootenv).
When 'be_destroy' is given a snapshot name, the zfs handle will be the dataset
that the snapshot was
taken from (zroot/ROOT/solid). After the zfs handle is acquired, a check is
made to see if the dataset
is mounted and bombs if it is (unless forced). In the above case,
'zroot/ROOT/solid' is the current boot environment.

In short - when destroying a snapshot, 'be_destroy' tries to unmount the
dataset that the snapshot was
taken from. The attached fix checks if the dataset is mounted only when that
dataset (i.e. boot environment) will
be destroyed. In other words, the patch doesn't check if a dataset is mounted
when destroying a snapshot.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list