Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Feb 2019 00:00:05 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 236043] bectl can't destroy origin snapshot
Message-ID:  <bug-236043-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236043

            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@FreeBSD.org
          Reporter: rob.fx907@gmail.com

Created attachment 202370
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D202370&action=
=3Dedit
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@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@2019-02-25-12:45:25
zroot/ROOT/solid@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' acquire=
s a
zfs handle internally. When
'be_destroy' is given a boot environment name, the zfs handle will be the b=
oot
environment dataset (zroot/ROOT/bootenv).
When 'be_destroy' is given a snapshot name, the zfs handle will be the data=
set
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 mount=
ed
when destroying a snapshot.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236043-227>