History log of /freebsd-11-stable/lib/libbe/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
357667 07-Feb-2020 kevans

MFC r357067: Drop "All Rights Reserved" from all libbe/bectl files

357001 22-Jan-2020 kevans

MFC r356876-r356877: add zfs_mount_at

r356876:
libzfs: add zfs_mount_at

This will be used in libbe in place of the internal zmount(); libbe only
wants to be able to mount a dataset at an arbitrary mountpoint without
altering dataset/pool properties. The natural way to do this in a portable
way is by creating a zfs_mount_at() interface that's effectively zfs_mount()
+ a mountpoint parameter. zfs_mount() is now a light wrapper around the new
method.

The interface and implementation have already been accepted into ZFS On
Linux, and the next commit to switch libbe() over to this new interface will
solve the last compatibility issue with ZoL. The next sysutils/openzfs
rebase against ZoL should be able to build libbe/bectl with only minor
adjustments to build glue.

r356877:
libbe: use the new zfs_mount_at()

More background is available in r356876, but this new interface is more
portable across ZFS implementations and cleaner for what libbe is attempting
to achieve anyways.

356593 10-Jan-2020 kevans

MFC r356279: libbe(3): promote dependent clones when destroying a BE

When removing a boot environment iterate over the dependents and process the
snapshots by grabbing any clones. Promote the clones we found and then
remove the target environment.

This fixes the ability to destroy a boot environment when it has been used
to spawn one or more other boot environments.

PR: 242592

355662 12-Dec-2019 kevans

MFC r355460: libbe: fix build against sysutils/openzfs, part 1

This is the half of the changes required that work as-is with both in-tree
ZFS and the new hotness, sysutils/openzfs. Highlights are less dependency
on header pollution (from somewhere) and using 'mnttab' instead of
'extmnttab'. In the in-tree ZFS, the latter is a #define for the former,
but in the port extmnttab is actually a distinct struct that's a super-set
of mnttab. We really want mnttab here anyways, so just use it.

353784 20-Oct-2019 kevans

MFC r353644, r353646, r353663: bectl(8) origin auto-destroy

r353644:
libbe(3): add needed bits for be_destroy to auto-destroy some origins

New BEs can be created from either an existing snapshot or an existing BE.
If an existing BE is chosen (either implicitly via 'bectl create' or
explicitly via 'bectl create -e foo bar', for instance), then bectl will
create a snapshot of the current BE or "foo" with be_snapshot, with a name
formatted like: strftime("%F-%T") and a serial added to it.

This commit adds the needed bits for libbe or consumers to determine if a
snapshot names matches one of these auto-created snapshots (with some light
validation of the date/time/serial), and also a be_destroy flag to specify
that the origin should be automatically destroyed if possible.

A future commit to bectl will specify BE_DESTROY_AUTOORIGIN by default so we
clean up the origin in the most common case, non-user-managed snapshots.

r353646:
bectl(8): destroy: use BE_DESTROY_AUTOORIGIN if -o is not specified

-o will force the origin to be destroyed unconditionally.
BE_DESTROY_AUTOORIGIN, on the other hand, will only destroy the origin if it
matches the format used by be_snapshot. This lets us clean up the snapshots
that are clearly not user-managed (because we're creating them) while
leaving user-created snapshots in place and warning that they're still
around when the BE created goes away.

r353663:
libbe(3): Fix destroy of imported BE w/ AUTOORIGIN

Imported BE, much like the activated BE, will not have an origin that we can
fetch/examine for destruction. be_destroy should not return BE_ERR_NOORIGIN
for failure to get the origin property for BE_DESTROY_AUTOORIGIN, because
we don't really know going into it that there's even an origin to be
destroyed.

BE_DESTROY_NEEDORIGIN has been renamed to BE_DESTROY_WANTORIGIN because only
a subset of it *needs* the origin, so 'need' is too strong of verbiage.

This was caught by jenkins and the bectl tests, but kevans failed to run the
bectl tests prior to commit.

352598 22-Sep-2019 avg

MFC r352447,r352449,r352507: MFZoL: Add -vnP support to 'zfs send' for bookmarks

350344 26-Jul-2019 kevans

MFC r349380, r349383, r349455: bectl(8)/libbe(3) fixes

r349380:
libbe(3): mount: the BE dataset is mounted at /

Other parts of libbe(3) were fairly strict on the mountpoint property of the
BE dataset, and be_mount was not much better. It was improved in r347027 to
allow mountpoint=none for depth==0, but this bit was still sensitive to
mountpoint != / and mountpoint != none. Given that other parts of libbe(3)
no longer restrict the mountpoint property here, and the rest of the base
system is generally OK and will assume that a BE is mounted at /, let's do
the same.

r349383:
libbe(3): restructure be_mount, skip canmount check for BE dataset

Further cleanup after r349380; loader and kernel will both ignore canmount
on the root dataset as well, so we should not be so strict about it when
mounting it. be_mount is restructured to make it more clear that depth==0 is
special, and to not try fetching these properties that we won't care about.

r349455:
bectl(8): create non-recursive boot environments

bectl advertises that it has the ability to create recursive and
non-recursive boot environments. This patch implements that functionality
using the be_create_depth API provided by libbe. With this patch, bectl now
works as bectl(8) describes in regards to creating recursive/non-recursive
boot environments.

348133 22-May-2019 kevans

MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none

These datasets will generally be canmount=noauto,mountpoint=none (e.g.
zroot/var) but have children that may need to be mounted. Instead of
skipping that segment for no good reason, descend.

Approved by: re (kib)

347170 06-May-2019 kevans

MFC r347027-r347028: libbe(3) mountpoint handling fixes

r347027:
libbe(3): Properly mount BEs with mountpoint=none

Instead of pretending to successfully mount them while not actually
mounting anything, we'll now actually mount them *and* claim we mounted them
successfully.

Reported by: ler

r347028:
libbe: set mountpoint=none in be_import

If we're going to set a mountpoint at all, mountpoint=none makes more sense
than mountpoint=/.

346802 28-Apr-2019 kevans

MFC r346545-r346546, r346680, r346700, r346705

r346545:
libbe(3): allow creation of arbitrary depth boot environments

libbe currently only provides an API to create a recursive boot environment,
without any formal support for intentionally limiting the depth. This
changeset adds an API, be_create_depth, that may be used to arbitrarily
restrict the depth of the new BE.

r346546:
libbe(3): Add a test for be creation

r346680:
libbe(3): Copy received properties as well

This was inherently broken on send|recv datasets.

r346700:
libbe(3): Fix mis-application of patch (SHLIBDIR)

Rob's patch in D18564 cemented the SHLIBDIR because bsd.own.mk (included by
src.opts.mk) sets it to /usr/lib. r346546 did somehow not apply this part of
the patch, leaving it to get installed to the wrong place and subsequently
removed via ObsoleteFiles.

r346705:
libbe(3): Fix libcompat build

SHLIBDIR should still be optionally set, just before src.opts.mk is included
so that libcompat can properly override it. This fixes lib32 failures
reported by both Jenkins and Michael Butler.

346429 20-Apr-2019 kevans

MFC bectl(8)/libbe(3): r337663-337664,337667,337697-337699,337800,337805,
337915-337918,337921,337924,337947,337993-337995,338221-338222,338303,
338417,339047,339972,339994,340334,340507-340508,340592-340594,
340635-340636,340722-340723,340974,342466,342849,342903,342911,343335,
343543,343977,343993-343994,344034,344067,344084,345302,345769,
345845-345846,345848,346082

There are simply too many small changes to enumerate; in summary:

bectl(8)/libbe(3) has been introduced from current state in -CURRENT and
added to the stable/11 rescue build. bectl(8) is a tool for managing ZFS
boot environments, largely inspired by beadm. It includes features such as
being able to jail a boot environment or easily mount it for modification.

Relnotes: probably

337663 11-Aug-2018 kevans

Merge libbe(3)/bectl(8) from projects/bectl into head

bectl(8) is an administrative interface for working with ZFS boot
environments, intended to provide a superset of the functionality provided
by sysutils/beadm.

libbe(3) is the back-end library that the required functionality has been
pulled out into for later reuse.

These were originally written for GSoC 2017 under the mentorship of
allanjude@.

bectl(8) has proven pretty stable in my testing, with the known bug
documented in the man page.

Relnotes: yes


337605 11-Aug-2018 kevans

libbe(3): Document the import bug...


337601 11-Aug-2018 kevans

libbe(3): Brain dump...


337598 11-Aug-2018 kevans

libbe(3)/bectl(8): Make igor and mandoc -Tlint a little happier


337597 11-Aug-2018 kevans

libbe(3): Bring man page back into reality


337596 11-Aug-2018 kevans

libbe(3)/bectl(8): Kill off the 'add' functionality for now

The mostly-undocumented 'add' functionality, from initial read-through, is
intended for construction of deep ("bdrewery style") boot environments.
However, it's mostly broken at this point. `#if SOON` it out on both sides
so that we're not exposing a broken API/feature.

Work will resume on it in due time.


337592 10-Aug-2018 kevans

libbe(3): More error handling bits

be_add_child functionality gets split out into separate places as a bonus.
A lot of places here we'll gloss over libzfs errors, because they shouldn't
be happening given the conditions that we're operating under. "Unknown
error" is what I'm intending to use for the moment to indicate an
exceptional circumstance- exceptional enough that we can't tell the consumer
did because we're not so certain that they did anything.


337564 10-Aug-2018 kevans

libbe(3): Plug some holes, do some more proper error returns

For those returning just -1 before, have them set ERR_UNKNOWN for now.


337563 10-Aug-2018 kevans

libbe(3): more small cleanup, const'ify and light style(9)


337446 08-Aug-2018 kevans

libbe(3): Some more light error handling...


337445 08-Aug-2018 kevans

libbe(3): Clarify some errors

While here, fix a bug with 'rename' that checked the wrong name for being
the active BE.


337444 08-Aug-2018 kevans

Catch up on BE_ERR messages


337416 07-Aug-2018 kevans

libbe(3)/bectl(8): Standardize $FreeBSD$ IDs


337414 07-Aug-2018 kevans

libbe(3)/bectl(8): Standardize copyright headers

- File names don't necessarily need to be repeated
- Add SPDX tags
- Add a missing copyright for Kyle Kneitinger in bectl.8, originally written
by him in GSoC 2017; his standard copyright notice has been copied from
other files within the same directory to remain consistent with how he
clearly wished to portray it


337409 07-Aug-2018 kevans

libbe(3): Destroy all children of a BE dataset, too

This fixes destruction of a deep BE returning an EBUSY because child
datasets still exist.


337408 07-Aug-2018 kevans

libbe(3): Document that we'll clobber previous errors set by set_error


337407 07-Aug-2018 kevans

libbe(3): Return some more proper error codes


337406 07-Aug-2018 kevans

libbe(3): Check that dataset is to be mounted at / for be_exists

This makes the be_exists behavior match the comments that assert that we've
already checked that the dataset derived from the BE name is set to mount at
/.

Other changes of note:
- bectl_list sees another change; changing mountpoint based on mount status
turns out to be a bad idea, so instead make the mounted property of the
returned nvlist the path that it's mounted at

- Always return the "mountpoint" property in "mountpoint" if it's ste


337404 07-Aug-2018 kevans

libbe(3): Rename prop_list_builder and snapshot_prop_list_builder


337403 07-Aug-2018 kevans

This snippet is no longer from zfsbootcfg


337402 07-Aug-2018 kevans

libbe(3): Rewrite activate temp bits to rely less on loader

Loader is still relied upon at the beginning of libbe to specify the be
root, but we can derive from that the primary zpool and any vdevs that we
need to set nextboot bits on.

This lets me successfully `bectl activate -t test`, but UEFI loader doesn't
quite yet understand so it's effectively defunct.


337358 05-Aug-2018 kevans

bectl(8): Implement `bectl list -s`

be_get_dataset_snapshots has been added to libbe(3), effectively returning
the same information as be_get_bootenv_props but for snapshots of the given
dataset. The assumption is that one will have the BE dataset name before
wanting to grab snapshots.


337343 05-Aug-2018 kevans

bectl: Implement -D ("space if origin datasets were deleted")

This also accomplishes the following:

- Proxy through zfs_nicenum as be_nicenum, because it looks better than
humanize_number and would presumably be useful to other libbe consumers.

- Rename be_get_snapshot_props to be_get_dataset_props, make it more useful


337228 03-Aug-2018 kevans

bectl(8): Take origin snapshot into account when calculating used space

This more closely matches the behavior for beadm. The associated libbe(3)
API is still getting worked out a little bit.


337224 03-Aug-2018 kevans

libbe(3): Fix checking of zfs_prop_get's return value

Rather than a boolean_t, it returns an int != 0 for error or 0 for OK.


336729 26-Jul-2018 kevans

libbe(3): Add be_mounted_at to check a mount point

At a bare minimum, this function will return 0 if a BE is mounted at the
given path or non-zero otherwise. If the optional 'details' nvlist is
supplied, it is filled with an nvpair containing just the information about
the BE mounted at the path. This nvpair is structured just as it is for
be_get_bootenv_props, except limited to just the single mount point.


336715 25-Jul-2018 kevans

libbe(3)/bectl(8): Provide and use proper alloc/free for property lists


336713 25-Jul-2018 kevans

libbe(3): Use zfs_is_mounted to check mounted and mountpoint


336710 25-Jul-2018 kevans

libbe(3)/be(8): Drop WARNS overrides, fix all fallout

Based on the idea that we shouldn't have all-new library and utility going
into base that need WARNS=1...

- Decent amount of constification
- Lots of parentheses
- Minor other nits


336709 25-Jul-2018 kevans

libbe(3): Add nextboot flag to returned BE information


336708 25-Jul-2018 kevans

bectl(8): Start dumping out BE information with `bectl list`

For the moment, this is a primitive nvlist dump of what we get back from
be_get_bootenv_props as a proof-of-concept and to make sure that we're
getting back the kind of information we want to see from list.


336701 25-Jul-2018 kevans

libbe(3): make style consistent with what I'll use going forward


336699 25-Jul-2018 kevans

libbe(3): Find rootfs instead by enumerating child datasets of BE root

This makes us more resilient to a rename of the bootfs, but still wouldn't
withstand pool renames or guid renames. More importantly, this allows `bectl
create <foo>` work out of the box to create a boot environment based on the
currently booted one.


336696 25-Jul-2018 kevans

libbe(3): Disambiguate 'active' a little bit, add 'bootfs'

- Rename 'active' to 'rootfs', which is used in other places to describe the
currently booted (or about to be booted) BE.

- Add 'bootfs', which indicates the next boot environment to be booted. This
is pulled from the BOOTFS zpool property.

- Go ahead and keep an open handle to the active zpool. We might need to
enumerate datasets, get properties, and set properties (e.g. bootfs)
throughout other libbe bits, and a single handle isn't overly expensive.


336673 24-Jul-2018 kevans

libbe(3): Add to cddl build, adjust src.libnames.mk as needed


336668 24-Jul-2018 kevans

Import libbe(3)/be(1) from socsvn/soc2017/kneitinger/libbe-head