Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Nov 2018 18:12:41 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r340154 - stable/12/lib/libbe
Message-ID:  <201811051812.wA5ICfSI040558@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Mon Nov  5 18:12:41 2018
New Revision: 340154
URL: https://svnweb.freebsd.org/changeset/base/340154

Log:
  MFC r339994: libbe(3): Don't promote non-cloned BEs
  
  Most easily reproducible by attempting to activate the currently activated
  BE, one would get a "not a cloned filesystem" error instead of success or a
  sane message.
  
  PR:		232488
  Approved by:	re (gjb)

Modified:
  stable/12/lib/libbe/be.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libbe/be.c
==============================================================================
--- stable/12/lib/libbe/be.c	Mon Nov  5 18:11:38 2018	(r340153)
+++ stable/12/lib/libbe/be.c	Mon Nov  5 18:12:41 2018	(r340154)
@@ -928,7 +928,8 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, 
 {
 	char be_path[BE_MAXPATHLEN];
 	char buf[BE_MAXPATHLEN];
-	nvlist_t *config, *vdevs;
+	nvlist_t *config, *dsprops, *vdevs;
+	char *origin;
 	uint64_t pool_guid;
 	zfs_handle_t *zhp;
 	int err;
@@ -969,7 +970,18 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, 
 		if (zhp == NULL)
 			return (-1);
 
-		err = zfs_promote(zhp);
+		if (be_prop_list_alloc(&dsprops) != 0)
+			return (-1);
+
+		if (be_get_dataset_props(lbh, be_path, dsprops) != 0) {
+			nvlist_free(dsprops);
+			return (-1);
+		}
+
+		if (nvlist_lookup_string(dsprops, "origin", &origin) == 0)
+			err = zfs_promote(zhp);
+		nvlist_free(dsprops);
+
 		zfs_close(zhp);
 
 		if (err)



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