Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Aug 2018 20:44:59 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338303 - in head: . lib/libbe sbin/bectl tools/build/mk
Message-ID:  <201808242044.w7OKixi5091059@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Fri Aug 24 20:44:58 2018
New Revision: 338303
URL: https://svnweb.freebsd.org/changeset/base/338303

Log:
  libbe(3)/bectl(8): Make consistent with beadm
  
  vermaden (maintainer of beadm) points out the following inconsistencies:
  - "missing command" is not printed prior to usage if the error is simply a
     missing command; this should be obvious from the context
  - "bectl rename" isn't using the "don't unmount" flag (zfs rename -u), so
     the active BE can't be renamed. It doesn't make sense in our context to
     *not* use -u, so use it.
  
  Documentation updates reflect the above and note an inconsistency with the
  'destroy' command that is consistent with other parts of the base system.
  
  A fix for libbe(3) not properly being installed to /lib is included.
  SHLIBDIR should have been added when it was moved in r337995.
  
  Approved by:	re (kib)

Modified:
  head/ObsoleteFiles.inc
  head/lib/libbe/Makefile
  head/lib/libbe/be.c
  head/lib/libbe/libbe.3
  head/sbin/bectl/bectl.8
  head/sbin/bectl/bectl.c
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Fri Aug 24 18:47:50 2018	(r338302)
+++ head/ObsoleteFiles.inc	Fri Aug 24 20:44:58 2018	(r338303)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20180824: libbe(3) SHLIBDIR fixed to reflect correct location
+OLD_LIBS+=usr/lib/libbe.so.1
 # 20180819: Remove deprecated arc4random(3) stir/addrandom interfaces
 OLD_FILES+=usr/share/man/man3/arc4random_addrandom.3.gz
 OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz

Modified: head/lib/libbe/Makefile
==============================================================================
--- head/lib/libbe/Makefile	Fri Aug 24 18:47:50 2018	(r338302)
+++ head/lib/libbe/Makefile	Fri Aug 24 20:44:58 2018	(r338303)
@@ -2,6 +2,7 @@
 
 PACKAGE=	lib${LIB}
 LIB=		be
+SHLIBDIR?= /lib
 SHLIB_MAJOR=	1
 SHLIB_MINOR=	0
 

Modified: head/lib/libbe/be.c
==============================================================================
--- head/lib/libbe/be.c	Fri Aug 24 18:47:50 2018	(r338302)
+++ head/lib/libbe/be.c	Fri Aug 24 20:44:58 2018	(r338303)
@@ -623,10 +623,6 @@ be_rename(libbe_handle_t *lbh, const char *old, const 
 	if ((err = be_root_concat(lbh, new, full_new)) != 0)
 		return (set_error(lbh, err));
 
-	/* Check if old is active BE */
-	if (strcmp(full_old, be_active_path(lbh)) == 0)
-		return (set_error(lbh, BE_ERR_MOUNTED));
-
 	if (!zfs_dataset_exists(lbh->lzh, full_old, ZFS_TYPE_DATASET))
 		return (set_error(lbh, BE_ERR_NOENT));
 
@@ -637,14 +633,10 @@ be_rename(libbe_handle_t *lbh, const char *old, const 
 	    ZFS_TYPE_FILESYSTEM)) == NULL)
 		return (set_error(lbh, BE_ERR_ZFSOPEN));
 
-	/* XXX TODO: Allow a force flag */
-	if (zfs_is_mounted(zfs_hdl, NULL)) {
-		zfs_close(zfs_hdl);
-		return (set_error(lbh, BE_ERR_MOUNTED));
-	}
-
 	/* recurse, nounmount, forceunmount */
-	struct renameflags flags = { 0, 0, 0 };
+	struct renameflags flags = {
+		.nounmount = 1,
+	};
 
 	err = zfs_rename(zfs_hdl, NULL, full_new, flags);
 

Modified: head/lib/libbe/libbe.3
==============================================================================
--- head/lib/libbe/libbe.3	Fri Aug 24 18:47:50 2018	(r338302)
+++ head/lib/libbe/libbe.3	Fri Aug 24 20:44:58 2018	(r338303)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 16, 2018
+.Dd August 24, 2018
 .Dt LIBBE 3
 .Os
 .Sh NAME
@@ -222,7 +222,12 @@ snapshot.
 .Pp
 The
 .Fn be_rename
-function renames a boot environment.
+function renames a boot environment without unmounting it, as if renamed with
+the
+.Fl u
+argument were passed to
+.Nm zfs
+.Cm rename
 .Pp
 The
 .Fn be_activate

Modified: head/sbin/bectl/bectl.8
==============================================================================
--- head/sbin/bectl/bectl.8	Fri Aug 24 18:47:50 2018	(r338302)
+++ head/sbin/bectl/bectl.8	Fri Aug 24 20:44:58 2018	(r338303)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 22, 2018
+.Dd August 24, 2018
 .Dt BECTL 8
 .Os
 .Sh NAME
@@ -132,7 +132,8 @@ Destroys the given
 .Ar beName
 boot environment or
 .Ar beName@snapshot
-snapshot.
+snapshot without confirmation, unlike in
+.Nm beadm .
 Specifying
 .Fl F
 will automatically unmount without confirmation.
@@ -239,10 +240,11 @@ Mount at the specified
 .Ar mountpoint
 if provided.
 .It Cm rename Ar origBeName newBeName
-Renames the given nonactive
+Renames the given
 .Ar origBeName
 to the given
 .Ar newBeName .
+The boot environment will not be unmounted in order for this rename to occur.
 .It Cm unjail Brq Ar jailID | jailName | beName
 Destroys the jail created from the given boot environment.
 .It Xo

Modified: head/sbin/bectl/bectl.c
==============================================================================
--- head/sbin/bectl/bectl.c	Fri Aug 24 18:47:50 2018	(r338302)
+++ head/sbin/bectl/bectl.c	Fri Aug 24 20:44:58 2018	(r338303)
@@ -491,10 +491,8 @@ main(int argc, char *argv[])
 	const char *command;
 	int command_index, rc;
 
-	if (argc < 2) {
-		fprintf(stderr, "missing command\n");
+	if (argc < 2)
 		return (usage(false));
-	}
 
 	command = argv[1];
 

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- head/tools/build/mk/OptionalObsoleteFiles.inc	Fri Aug 24 18:47:50 2018	(r338302)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc	Fri Aug 24 20:44:58 2018	(r338303)
@@ -1288,7 +1288,7 @@ OLD_FILES+=usr/bin/ztest
 OLD_FILES+=usr/lib/libbe.a
 OLD_FILES+=usr/lib/libbe_p.a
 OLD_FILES+=usr/lib/libbe.so
-OLD_LIBS+=usr/lib/libbe.so.1
+OLD_LIBS+=lib/libbe.so.1
 OLD_FILES+=usr/lib/libzfs.a
 OLD_LIBS+=usr/lib/libzfs.so
 OLD_FILES+=usr/lib/libzfs_core.a



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