svn commit: r353663 - head/lib/libbe
Kyle Evans
kevans at FreeBSD.org
Wed Oct 16 18:33:32 UTC 2019
Author: kevans
Date: Wed Oct 16 18:33:31 2019
New Revision: 353663
URL: https://svnweb.freebsd.org/changeset/base/353663
Log:
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.
Reported by: lwhsu
Modified:
head/lib/libbe/be.c
Modified: head/lib/libbe/be.c
==============================================================================
--- head/lib/libbe/be.c Wed Oct 16 18:27:27 2019 (r353662)
+++ head/lib/libbe/be.c Wed Oct 16 18:33:31 2019 (r353663)
@@ -229,7 +229,7 @@ be_destroy_cb(zfs_handle_t *zfs_hdl, void *data)
return (0);
}
-#define BE_DESTROY_NEEDORIGIN (BE_DESTROY_ORIGIN | BE_DESTROY_AUTOORIGIN)
+#define BE_DESTROY_WANTORIGIN (BE_DESTROY_ORIGIN | BE_DESTROY_AUTOORIGIN)
/*
* Destroy the boot environment or snapshot specified by the name
* parameter. Options are or'd together with the possible values:
@@ -265,9 +265,10 @@ be_destroy(libbe_handle_t *lbh, const char *name, int
if (fs == NULL)
return (set_error(lbh, BE_ERR_ZFSOPEN));
- if ((options & BE_DESTROY_NEEDORIGIN) != 0 &&
+ if ((options & BE_DESTROY_WANTORIGIN) != 0 &&
zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin),
- NULL, NULL, 0, 1) != 0)
+ NULL, NULL, 0, 1) != 0 &&
+ (options & BE_DESTROY_ORIGIN) != 0)
return (set_error(lbh, BE_ERR_NOORIGIN));
/*
@@ -279,7 +280,7 @@ be_destroy(libbe_handle_t *lbh, const char *name, int
* the caller can determine if it needs to warn about the origin
* not being destroyed or not.
*/
- if ((options & BE_DESTROY_AUTOORIGIN) != 0 &&
+ if ((options & BE_DESTROY_AUTOORIGIN) != 0 && *origin != '\0' &&
be_is_auto_snapshot_name(lbh, origin))
options |= BE_DESTROY_ORIGIN;
More information about the svn-src-all
mailing list