Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Nov 2018 16:03:52 +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: r340454 - stable/12/lib/libbe
Message-ID:  <201811151603.wAFG3qum041124@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Nov 15 16:03:52 2018
New Revision: 340454
URL: https://svnweb.freebsd.org/changeset/base/340454

Log:
  MFC r340334: libbe(3): Set canmount properly when activating a new BE
  
  The previously activated BE should have canmount=noauto set on it upon
  activation of the new BE, but we previously did not touch canmount on either
  old or new BE.
  
  PR:		233113
  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	Thu Nov 15 16:02:45 2018	(r340453)
+++ stable/12/lib/libbe/be.c	Thu Nov 15 16:03:52 2018	(r340454)
@@ -922,7 +922,22 @@ be_set_nextboot(libbe_handle_t *lbh, nvlist_t *config,
 	return (0);
 }
 
+/*
+ * Deactivate old BE dataset; currently just sets canmount=noauto
+ */
+static int
+be_deactivate(libbe_handle_t *lbh, const char *ds)
+{
+	zfs_handle_t *zfs;
 
+	if ((zfs = zfs_open(lbh->lzh, ds, ZFS_TYPE_DATASET)) == NULL)
+		return (1);
+	if (zfs_prop_set(zfs, "canmount", "noauto") != 0)
+		return (1);
+	zfs_close(zfs);
+	return (0);
+}
+
 int
 be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary)
 {
@@ -961,6 +976,9 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, 
 
 		return (be_set_nextboot(lbh, vdevs, pool_guid, buf));
 	} else {
+		if (be_deactivate(lbh, lbh->bootfs) != 0)
+			return (-1);
+
 		/* Obtain bootenv zpool */
 		err = zpool_set_prop(lbh->active_phandle, "bootfs", be_path);
 		if (err)



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