Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Sep 2020 21:31:59 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r365340 - in vendor-sys/openzfs/dist: . cmd/zfs config etc/systemd/system etc/systemd/system-generators include include/os/freebsd/spl/sys include/os/freebsd/zfs/sys include/os/linux/ke...
Message-ID:  <202009042131.084LVxU1017922@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Fri Sep  4 21:31:58 2020
New Revision: 365340
URL: https://svnweb.freebsd.org/changeset/base/365340

Log:
  Update vendor openzfs to fd20a8

Added:
  vendor-sys/openzfs/dist/include/sys/zfs_vfsops.h   (contents, props changed)
  vendor-sys/openzfs/dist/lib/libspl/os/freebsd/zone.c   (contents, props changed)
  vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_nounmount.ksh
Modified:
  vendor-sys/openzfs/dist/cmd/zfs/zfs_main.c
  vendor-sys/openzfs/dist/config/kernel-global_page_state.m4
  vendor-sys/openzfs/dist/config/zfs-build.m4
  vendor-sys/openzfs/dist/etc/systemd/system-generators/zfs-mount-generator.in
  vendor-sys/openzfs/dist/etc/systemd/system/zfs-mount.service.in
  vendor-sys/openzfs/dist/include/libzfs.h
  vendor-sys/openzfs/dist/include/libzfs_impl.h
  vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/cred.h
  vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/zone.h
  vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/Makefile.am
  vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_vfsops.h
  vendor-sys/openzfs/dist/include/os/linux/kernel/linux/page_compat.h
  vendor-sys/openzfs/dist/include/os/linux/spl/sys/vmsystm.h
  vendor-sys/openzfs/dist/include/os/linux/zfs/sys/Makefile.am
  vendor-sys/openzfs/dist/include/sys/Makefile.am
  vendor-sys/openzfs/dist/lib/libspl/Makefile.am
  vendor-sys/openzfs/dist/lib/libspl/include/limits.h
  vendor-sys/openzfs/dist/lib/libspl/include/zone.h
  vendor-sys/openzfs/dist/lib/libspl/zone.c
  vendor-sys/openzfs/dist/lib/libzfs/libzfs_changelist.c
  vendor-sys/openzfs/dist/lib/libzfs/libzfs_dataset.c
  vendor-sys/openzfs/dist/lib/libzpool/kernel.c
  vendor-sys/openzfs/dist/man/man8/zfs-rename.8
  vendor-sys/openzfs/dist/module/avl/avl.c
  vendor-sys/openzfs/dist/module/nvpair/nvpair.c
  vendor-sys/openzfs/dist/module/os/freebsd/spl/spl_kstat.c
  vendor-sys/openzfs/dist/module/os/freebsd/spl/spl_zone.c
  vendor-sys/openzfs/dist/module/os/freebsd/zfs/spa_stats.c
  vendor-sys/openzfs/dist/module/os/freebsd/zfs/zfs_vfsops.c
  vendor-sys/openzfs/dist/module/os/freebsd/zfs/zvol_os.c
  vendor-sys/openzfs/dist/module/os/linux/spl/spl-kstat.c
  vendor-sys/openzfs/dist/module/os/linux/zfs/Makefile.in
  vendor-sys/openzfs/dist/module/os/linux/zfs/arc_os.c
  vendor-sys/openzfs/dist/module/os/linux/zfs/spa_stats.c
  vendor-sys/openzfs/dist/module/os/linux/zfs/zfs_vfsops.c
  vendor-sys/openzfs/dist/module/os/linux/zfs/zpl_super.c
  vendor-sys/openzfs/dist/module/zfs/Makefile.in
  vendor-sys/openzfs/dist/module/zfs/arc.c
  vendor-sys/openzfs/dist/module/zfs/dsl_dir.c
  vendor-sys/openzfs/dist/module/zfs/spa.c
  vendor-sys/openzfs/dist/module/zfs/spa_config.c
  vendor-sys/openzfs/dist/module/zfs/vdev.c
  vendor-sys/openzfs/dist/module/zfs/vdev_indirect.c
  vendor-sys/openzfs/dist/module/zfs/vdev_raidz.c
  vendor-sys/openzfs/dist/module/zfs/zfs_fm.c
  vendor-sys/openzfs/dist/module/zfs/zfs_ioctl.c
  vendor-sys/openzfs/dist/module/zfs/zio.c
  vendor-sys/openzfs/dist/tests/runfiles/common.run
  vendor-sys/openzfs/dist/tests/zfs-tests/include/tunables.cfg
  vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am
  vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_mountpoint.ksh
Directory Properties:
  vendor-sys/openzfs/dist/zfs.release.in   (props changed)

Modified: vendor-sys/openzfs/dist/cmd/zfs/zfs_main.c
==============================================================================
--- vendor-sys/openzfs/dist/cmd/zfs/zfs_main.c	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/cmd/zfs/zfs_main.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -311,7 +311,8 @@ get_usage(zfs_help_t idx)
 	case HELP_RENAME:
 		return (gettext("\trename [-f] <filesystem|volume|snapshot> "
 		    "<filesystem|volume|snapshot>\n"
-		    "\trename [-f] -p <filesystem|volume> <filesystem|volume>\n"
+		    "\trename -p [-f] <filesystem|volume> <filesystem|volume>\n"
+		    "\trename -u [-f] <filesystem> <filesystem>\n"
 		    "\trename -r <snapshot> <snapshot>\n"));
 	case HELP_ROLLBACK:
 		return (gettext("\trollback [-rRf] <snapshot>\n"));
@@ -401,7 +402,7 @@ get_usage(zfs_help_t idx)
 		    "<-a | filesystem|volume>\n"));
 	case HELP_CHANGE_KEY:
 		return (gettext("\tchange-key [-l] [-o keyformat=<value>]\n"
-		    "\t    [-o keylocation=<value>] [-o pbkfd2iters=<value>]\n"
+		    "\t    [-o keylocation=<value>] [-o pbkdf2iters=<value>]\n"
 		    "\t    <filesystem|volume>\n"
 		    "\tchange-key -i [-l] <filesystem|volume>\n"));
 	case HELP_VERSION:
@@ -3603,36 +3604,40 @@ zfs_do_list(int argc, char **argv)
 }
 
 /*
- * zfs rename [-f] <fs | snap | vol> <fs | snap | vol>
+ * zfs rename [-fu] <fs | snap | vol> <fs | snap | vol>
  * zfs rename [-f] -p <fs | vol> <fs | vol>
- * zfs rename -r <snap> <snap>
+ * zfs rename [-u] -r <snap> <snap>
  *
  * Renames the given dataset to another of the same type.
  *
  * The '-p' flag creates all the non-existing ancestors of the target first.
+ * The '-u' flag prevents file systems from being remounted during rename.
  */
 /* ARGSUSED */
 static int
 zfs_do_rename(int argc, char **argv)
 {
 	zfs_handle_t *zhp;
+	renameflags_t flags = { 0 };
 	int c;
 	int ret = 0;
-	boolean_t recurse = B_FALSE;
+	int types;
 	boolean_t parents = B_FALSE;
-	boolean_t force_unmount = B_FALSE;
 
 	/* check options */
-	while ((c = getopt(argc, argv, "prf")) != -1) {
+	while ((c = getopt(argc, argv, "pruf")) != -1) {
 		switch (c) {
 		case 'p':
 			parents = B_TRUE;
 			break;
 		case 'r':
-			recurse = B_TRUE;
+			flags.recursive = B_TRUE;
 			break;
+		case 'u':
+			flags.nounmount = B_TRUE;
+			break;
 		case 'f':
-			force_unmount = B_TRUE;
+			flags.forceunmount = B_TRUE;
 			break;
 		case '?':
 		default:
@@ -3661,20 +3666,32 @@ zfs_do_rename(int argc, char **argv)
 		usage(B_FALSE);
 	}
 
-	if (recurse && parents) {
+	if (flags.recursive && parents) {
 		(void) fprintf(stderr, gettext("-p and -r options are mutually "
 		    "exclusive\n"));
 		usage(B_FALSE);
 	}
 
-	if (recurse && strchr(argv[0], '@') == 0) {
+	if (flags.nounmount && parents) {
+		(void) fprintf(stderr, gettext("-u and -p options are mutually "
+		    "exclusive\n"));
+		usage(B_FALSE);
+	}
+
+	if (flags.recursive && strchr(argv[0], '@') == 0) {
 		(void) fprintf(stderr, gettext("source dataset for recursive "
 		    "rename must be a snapshot\n"));
 		usage(B_FALSE);
 	}
 
-	if ((zhp = zfs_open(g_zfs, argv[0], parents ? ZFS_TYPE_FILESYSTEM |
-	    ZFS_TYPE_VOLUME : ZFS_TYPE_DATASET)) == NULL)
+	if (flags.nounmount)
+		types = ZFS_TYPE_FILESYSTEM;
+	else if (parents)
+		types = ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME;
+	else
+		types = ZFS_TYPE_DATASET;
+
+	if ((zhp = zfs_open(g_zfs, argv[0], types)) == NULL)
 		return (1);
 
 	/* If we were asked and the name looks good, try to create ancestors. */
@@ -3684,7 +3701,7 @@ zfs_do_rename(int argc, char **argv)
 		return (1);
 	}
 
-	ret = (zfs_rename(zhp, argv[1], recurse, force_unmount) != 0);
+	ret = (zfs_rename(zhp, argv[1], flags) != 0);
 
 	zfs_close(zhp);
 	return (ret);

Modified: vendor-sys/openzfs/dist/config/kernel-global_page_state.m4
==============================================================================
--- vendor-sys/openzfs/dist/config/kernel-global_page_state.m4	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/config/kernel-global_page_state.m4	Fri Sep  4 21:31:58 2020	(r365340)
@@ -94,9 +94,6 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY]
 	ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_FILE_PAGES])
 	ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_ANON])
 	ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_INACTIVE_FILE])
-    AS_IF([test -z "$ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B"],[
-	    ZFS_AC_KERNEL_GLOBAL_PAGE_STATE_ENUM_CHECK([NR_SLAB_RECLAIMABLE])
-    ])
 
 	AC_MSG_RESULT(yes)
 ])
@@ -119,18 +116,12 @@ AC_DEFUN([ZFS_AC_KERNEL_GLOBAL_PAGE_STATE], [
 	    [node_stat_item], [$LINUX/include/linux/mmzone.h])
 	ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
 	    [node_stat_item], [$LINUX/include/linux/mmzone.h])
-	ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE],
-	    [node_stat_item], [$LINUX/include/linux/mmzone.h])
-	ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE_B],
-	    [node_stat_item], [$LINUX/include/linux/mmzone.h])
 
 	ZFS_AC_KERNEL_ENUM_MEMBER([NR_FILE_PAGES],
 	    [zone_stat_item], [$LINUX/include/linux/mmzone.h])
 	ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_ANON],
 	    [zone_stat_item], [$LINUX/include/linux/mmzone.h])
 	ZFS_AC_KERNEL_ENUM_MEMBER([NR_INACTIVE_FILE],
-	    [zone_stat_item], [$LINUX/include/linux/mmzone.h])
-	ZFS_AC_KERNEL_ENUM_MEMBER([NR_SLAB_RECLAIMABLE],
 	    [zone_stat_item], [$LINUX/include/linux/mmzone.h])
 
 	ZFS_AC_KERNEL_GLOBAL_ZONE_PAGE_STATE_SANITY

Modified: vendor-sys/openzfs/dist/config/zfs-build.m4
==============================================================================
--- vendor-sys/openzfs/dist/config/zfs-build.m4	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/config/zfs-build.m4	Fri Sep  4 21:31:58 2020	(r365340)
@@ -418,33 +418,43 @@ dnl # package type for 'make pkg': (rpm | deb | tgz)
 dnl #
 AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
 	AC_MSG_CHECKING([os distribution])
-	if test -f /etc/toss-release ; then
-		VENDOR=toss ;
-	elif test -f /etc/fedora-release ; then
-		VENDOR=fedora ;
-	elif test -f /etc/redhat-release ; then
-		VENDOR=redhat ;
-	elif test -f /etc/gentoo-release ; then
-		VENDOR=gentoo ;
-	elif test -f /etc/arch-release ; then
-		VENDOR=arch ;
-	elif test -f /etc/SuSE-release ; then
-		VENDOR=sles ;
-	elif test -f /etc/slackware-version ; then
-		VENDOR=slackware ;
-	elif test -f /etc/lunar.release ; then
-		VENDOR=lunar ;
-	elif test -f /etc/lsb-release ; then
-		VENDOR=ubuntu ;
-	elif test -f /etc/debian_version ; then
-		VENDOR=debian ;
-	elif test -f /etc/alpine-release ; then
-		VENDOR=alpine ;
-	elif test -f /bin/freebsd-version ; then
-		VENDOR=freebsd ;
-	else
-		VENDOR= ;
-	fi
+	AC_ARG_WITH([vendor],
+		[AS_HELP_STRING([--with-vendor],
+			[Distribution vendor @<:@default=check@:>@])],
+		[with_vendor=$withval],
+		[with_vendor=check])
+	AS_IF([test "x$with_vendor" = "xcheck"],[
+		if test -f /etc/toss-release ; then
+			VENDOR=toss ;
+		elif test -f /etc/fedora-release ; then
+			VENDOR=fedora ;
+		elif test -f /etc/redhat-release ; then
+			VENDOR=redhat ;
+		elif test -f /etc/gentoo-release ; then
+			VENDOR=gentoo ;
+		elif test -f /etc/arch-release ; then
+			VENDOR=arch ;
+		elif test -f /etc/SuSE-release ; then
+			VENDOR=sles ;
+		elif test -f /etc/slackware-version ; then
+			VENDOR=slackware ;
+		elif test -f /etc/lunar.release ; then
+			VENDOR=lunar ;
+		elif test -f /etc/lsb-release ; then
+			VENDOR=ubuntu ;
+		elif test -f /etc/debian_version ; then
+			VENDOR=debian ;
+		elif test -f /etc/alpine-release ; then
+			VENDOR=alpine ;
+		elif test -f /bin/freebsd-version ; then
+			VENDOR=freebsd ;
+		else
+			VENDOR= ;
+		fi],
+		[ test "x${with_vendor}" != x],[
+			VENDOR="$with_vendor" ],
+		[ VENDOR= ; ]
+	)
 	AC_MSG_RESULT([$VENDOR])
 	AC_SUBST(VENDOR)
 

Modified: vendor-sys/openzfs/dist/etc/systemd/system-generators/zfs-mount-generator.in
==============================================================================
--- vendor-sys/openzfs/dist/etc/systemd/system-generators/zfs-mount-generator.in	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/etc/systemd/system-generators/zfs-mount-generator.in	Fri Sep  4 21:31:58 2020	(r365340)
@@ -38,8 +38,6 @@ do_fail() {
 is_known() {
   query="$1"
   IFS=' '
-  # protect against special characters
-  set -f
   for element in $2 ; do
     if [ "$query" = "$element" ] ; then
       return 0
@@ -54,8 +52,7 @@ is_known() {
 create_dependencies() {
   unitfile="$1"
   suffix="$2"
-  # protect against special characters
-  set -f
+  IFS=' '
   for target in $3 ; do
     target_dir="${dest_norm}/${target}.${suffix}/"
     mkdir -p "${target_dir}"
@@ -72,6 +69,7 @@ else
   do_fail "zero or three arguments required"
 fi
 
+pools=$(zpool list -H -o name || true)
 
 # All needed information about each ZFS is available from
 # zfs list -H -t filesystem -o <properties>
@@ -83,11 +81,11 @@ process_line() {
   # zfs list -H -o name,...
   # fields are tab separated
   IFS="$(printf '\t')"
-  # protect against special characters in, e.g., mountpoints
-  set -f
   # shellcheck disable=SC2086
   set -- $1
+
   dataset="${1}"
+  pool="${dataset%%/*}"
   p_mountpoint="${2}"
   p_canmount="${3}"
   p_atime="${4}"
@@ -120,6 +118,25 @@ process_line() {
   requiredby=""
   noauto="off"
 
+  # If the pool is already imported, zfs-import.target is not needed.  This
+  # avoids a dependency loop on root-on-ZFS systems:
+  # systemd-random-seed.service After (via RequiresMountsFor) var-lib.mount
+  # After zfs-import.target After zfs-import-{cache,scan}.service After
+  # cryptsetup.service After systemd-random-seed.service.
+  #
+  # Pools are newline-separated and may contain spaces in their names.
+  # There is no better portable way to set IFS to just a newline.  Using
+  # $(printf '\n') doesn't work because $(...) strips trailing newlines.
+  IFS="
+"
+  for p in $pools ; do
+    if [ "$p" = "$pool" ] ; then
+      after=""
+      wants=""
+      break
+    fi
+  done
+
   if [ -n "${p_systemd_after}" ] && \
       [ "${p_systemd_after}" != "-" ] ; then
     after="${p_systemd_after} ${after}"
@@ -204,6 +221,10 @@ ${keymountdep}
 [Service]
 Type=oneshot
 RemainAfterExit=yes
+# This avoids a dependency loop involving systemd-journald.socket if this
+# dataset is a parent of the root filesystem.
+StandardOutput=null
+StandardError=null
 ExecStart=${keyloadcmd}
 ExecStop=${keyunloadcmd}"   > "${dest_norm}/${keyloadunit}"
     fi
@@ -438,6 +459,8 @@ Options=defaults${opts},zfsutil" > "${dest_norm}/${mou
 }
 
 for cachefile in "${FSLIST}/"* ; do
+  # Disable glob expansion to protect against special characters when parsing.
+  set -f
   # Sort cachefile's lines by canmount, "on" before "noauto"
   # and feed each line into process_line
   sort -t "$(printf '\t')" -k 3 -r "${cachefile}" | \

Modified: vendor-sys/openzfs/dist/etc/systemd/system/zfs-mount.service.in
==============================================================================
--- vendor-sys/openzfs/dist/etc/systemd/system/zfs-mount.service.in	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/etc/systemd/system/zfs-mount.service.in	Fri Sep  4 21:31:58 2020	(r365340)
@@ -6,7 +6,6 @@ After=systemd-udev-settle.service
 After=zfs-import.target
 After=systemd-remount-fs.service
 Before=local-fs.target
-Before=systemd-random-seed.service
 ConditionPathIsDirectory=/sys/module/zfs
 
 [Service]

Modified: vendor-sys/openzfs/dist/include/libzfs.h
==============================================================================
--- vendor-sys/openzfs/dist/include/libzfs.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/libzfs.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -642,7 +642,19 @@ extern int zfs_snapshot(libzfs_handle_t *, const char 
 extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps,
     nvlist_t *props);
 extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
-extern int zfs_rename(zfs_handle_t *, const char *, boolean_t, boolean_t);
+
+typedef struct renameflags {
+	/* recursive rename */
+	int recursive : 1;
+
+	/* don't unmount file systems */
+	int nounmount : 1;
+
+	/* force unmount file systems */
+	int forceunmount : 1;
+} renameflags_t;
+
+extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t);
 
 typedef struct sendflags {
 	/* Amount of extra information to print. */

Modified: vendor-sys/openzfs/dist/include/libzfs_impl.h
==============================================================================
--- vendor-sys/openzfs/dist/include/libzfs_impl.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/libzfs_impl.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -166,6 +166,10 @@ int zprop_expand_list(libzfs_handle_t *hdl, zprop_list
  * changelist_gather() flag to force it to iterate on mounted datasets only
  */
 #define	CL_GATHER_ITER_MOUNTED	2
+/*
+ * Use this changelist_gather() flag to prevent unmounting of file systems.
+ */
+#define	CL_GATHER_DONT_UNMOUNT	4
 
 typedef struct prop_changelist prop_changelist_t;
 

Modified: vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/cred.h
==============================================================================
--- vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/cred.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/cred.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -93,7 +93,7 @@ extern cred_t *zone_kcred(void);
 extern gid_t crgetrgid(const cred_t *);
 extern gid_t crgetsgid(const cred_t *);
 
-#define	crgetzoneid(x) (0)
+#define	crgetzoneid(cr) ((cr)->cr_prison->pr_id)
 extern projid_t crgetprojid(const cred_t *);
 
 extern cred_t *crgetmapped(const cred_t *);

Modified: vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/zone.h
==============================================================================
--- vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/zone.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/zone.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -29,6 +29,8 @@
 #ifndef _OPENSOLARIS_SYS_ZONE_H_
 #define	_OPENSOLARIS_SYS_ZONE_H_
 
+#include <sys/jail.h>
+
 /*
  * Macros to help with zone visibility restrictions.
  */
@@ -36,12 +38,9 @@
 #define	GLOBAL_ZONEID	0
 
 /*
- * Is thread in the global zone?
+ * Is proc in the global zone?
  */
-#define	INGLOBALZONE(p)	in_globalzone((p))
-
-
-extern boolean_t in_globalzone(struct proc *);
+#define	INGLOBALZONE(proc)	(!jailed((proc)->p_ucred))
 
 /*
  * Attach the given dataset to the given jail.

Modified: vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/Makefile.am
==============================================================================
--- vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/Makefile.am	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/Makefile.am	Fri Sep  4 21:31:58 2020	(r365340)
@@ -6,7 +6,7 @@ KERNEL_H = \
 	zfs_ctldir.h \
 	zfs_dir.h \
 	zfs_ioctl_compat.h \
-	zfs_vfsops.h \
+	zfs_vfsops_os.h \
 	zfs_vnops.h \
 	zfs_znode_impl.h \
 	zpl.h

Modified: vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_vfsops.h
==============================================================================
--- vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_vfsops.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_vfsops.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -168,7 +168,6 @@ extern boolean_t zfs_is_readonly(zfsvfs_t *zfsvfs);
 extern int zfs_get_temporary_prop(struct dsl_dataset *ds, zfs_prop_t zfs_prop,
     uint64_t *val, char *setpoint);
 extern int zfs_busy(void);
-extern void zfsvfs_update_fromname(const char *oldname, const char *newname);
 
 #ifdef	__cplusplus
 }

Modified: vendor-sys/openzfs/dist/include/os/linux/kernel/linux/page_compat.h
==============================================================================
--- vendor-sys/openzfs/dist/include/os/linux/kernel/linux/page_compat.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/os/linux/kernel/linux/page_compat.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -35,16 +35,6 @@
 #else
 #define	nr_inactive_file_pages() global_zone_page_state(NR_INACTIVE_FILE)
 #endif
-#if	defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B)
-#define	nr_slab_reclaimable_pages() \
-	global_node_page_state(NR_SLAB_RECLAIMABLE_B)
-#else
-#if	defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE)
-#define	nr_slab_reclaimable_pages() global_node_page_state(NR_SLAB_RECLAIMABLE)
-#else
-#define	nr_slab_reclaimable_pages() global_zone_page_state(NR_SLAB_RECLAIMABLE)
-#endif
-#endif
 
 #elif	defined(ZFS_GLOBAL_NODE_PAGE_STATE)
 
@@ -64,16 +54,6 @@
 #else
 #define	nr_inactive_file_pages() global_page_state(NR_INACTIVE_FILE)
 #endif
-#if	defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B)
-#define	nr_slab_reclaimable_pages() \
-	global_node_page_state(NR_SLAB_RECLAIMABLE_B)
-#else
-#if	defined(ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE)
-#define	nr_slab_reclaimable_pages() global_node_page_state(NR_SLAB_RECLAIMABLE)
-#else
-#define	nr_slab_reclaimable_pages() global_page_state(NR_SLAB_RECLAIMABLE)
-#endif
-#endif
 
 #else
 
@@ -81,11 +61,6 @@
 #define	nr_file_pages()			global_page_state(NR_FILE_PAGES)
 #define	nr_inactive_anon_pages()	global_page_state(NR_INACTIVE_ANON)
 #define	nr_inactive_file_pages()	global_page_state(NR_INACTIVE_FILE)
-#ifdef ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B
-#define	nr_slab_reclaimable_pages()	global_page_state(NR_SLAB_RECLAIMABLE_B)
-#else
-#define	nr_slab_reclaimable_pages()	global_page_state(NR_SLAB_RECLAIMABLE)
-#endif /* ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B */
 
 #endif /* ZFS_GLOBAL_ZONE_PAGE_STATE */
 

Modified: vendor-sys/openzfs/dist/include/os/linux/spl/sys/vmsystm.h
==============================================================================
--- vendor-sys/openzfs/dist/include/os/linux/spl/sys/vmsystm.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/os/linux/spl/sys/vmsystm.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -47,17 +47,6 @@
 
 #define	membar_producer()		smp_wmb()
 #define	physmem				zfs_totalram_pages
-#ifdef ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B
-#define	freemem			(nr_free_pages() + \
-				global_page_state(NR_INACTIVE_FILE) + \
-				global_page_state(NR_INACTIVE_ANON) + \
-				global_page_state(NR_SLAB_RECLAIMABLE_B))
-#else
-#define	freemem			(nr_free_pages() + \
-				global_page_state(NR_INACTIVE_FILE) + \
-				global_page_state(NR_INACTIVE_ANON) + \
-				global_page_state(NR_SLAB_RECLAIMABLE))
-#endif /* ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B */
 
 #define	xcopyin(from, to, size)		copy_from_user(to, from, size)
 #define	xcopyout(from, to, size)	copy_to_user(to, from, size)

Modified: vendor-sys/openzfs/dist/include/os/linux/zfs/sys/Makefile.am
==============================================================================
--- vendor-sys/openzfs/dist/include/os/linux/zfs/sys/Makefile.am	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/os/linux/zfs/sys/Makefile.am	Fri Sep  4 21:31:58 2020	(r365340)
@@ -19,7 +19,7 @@ KERNEL_H = \
 	zfs_context_os.h \
 	zfs_ctldir.h \
 	zfs_dir.h \
-	zfs_vfsops.h \
+	zfs_vfsops_os.h \
 	zfs_vnops.h \
 	zfs_znode_impl.h \
 	zpl.h

Modified: vendor-sys/openzfs/dist/include/sys/Makefile.am
==============================================================================
--- vendor-sys/openzfs/dist/include/sys/Makefile.am	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/include/sys/Makefile.am	Fri Sep  4 21:31:58 2020	(r365340)
@@ -115,6 +115,7 @@ COMMON_H = \
 	zfs_sa.h \
 	zfs_stat.h \
 	zfs_sysfs.h \
+	zfs_vfsops.h \
 	zfs_znode.h \
 	zil.h \
 	zil_impl.h \

Added: vendor-sys/openzfs/dist/include/sys/zfs_vfsops.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor-sys/openzfs/dist/include/sys/zfs_vfsops.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Portions Copyright 2020 iXsystems, Inc.
+ */
+
+#ifndef _SYS_ZFS_VFSOPS_H
+#define	_SYS_ZFS_VFSOPS_H
+
+#ifdef _KERNEL
+#include <sys/zfs_vfsops_os.h>
+#endif
+
+extern void zfsvfs_update_fromname(const char *, const char *);
+
+#endif /* _SYS_ZFS_VFSOPS_H */

Modified: vendor-sys/openzfs/dist/lib/libspl/Makefile.am
==============================================================================
--- vendor-sys/openzfs/dist/lib/libspl/Makefile.am	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/lib/libspl/Makefile.am	Fri Sep  4 21:31:58 2020	(r365340)
@@ -27,7 +27,6 @@ USER_C = \
 	strlcat.c \
 	strlcpy.c \
 	timestamp.c \
-	zone.c \
 	include/sys/list.h \
 	include/sys/list_impl.h
 
@@ -35,7 +34,8 @@ if BUILD_LINUX
 USER_C += \
 	os/linux/getexecname.c \
 	os/linux/gethostid.c \
-	os/linux/getmntany.c
+	os/linux/getmntany.c \
+	os/linux/zone.c
 endif
 
 if BUILD_FREEBSD
@@ -43,7 +43,8 @@ USER_C += \
 	os/freebsd/getexecname.c \
 	os/freebsd/gethostid.c \
 	os/freebsd/getmntany.c \
-	os/freebsd/mnttab.c
+	os/freebsd/mnttab.c \
+	os/freebsd/zone.c
 endif
 
 libspl_la_SOURCES = \

Modified: vendor-sys/openzfs/dist/lib/libspl/include/limits.h
==============================================================================
--- vendor-sys/openzfs/dist/lib/libspl/include/limits.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/lib/libspl/include/limits.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -25,16 +25,21 @@
  */
 
 #include_next <limits.h>
+#include <float.h>
 
 #ifndef _LIBSPL_LIMITS_H
 #define	_LIBSPL_LIMITS_H
 
+#ifndef DBL_DIG
 #define	DBL_DIG		15
 #define	DBL_MAX		1.7976931348623157081452E+308
 #define	DBL_MIN		2.2250738585072013830903E-308
+#endif
 
+#ifndef FLT_DIG
 #define	FLT_DIG		6
 #define	FLT_MAX		3.4028234663852885981170E+38F
 #define	FLT_MIN		1.1754943508222875079688E-38F
+#endif
 
 #endif /* _LIBSPL_LIMITS_H */

Modified: vendor-sys/openzfs/dist/lib/libspl/include/zone.h
==============================================================================
--- vendor-sys/openzfs/dist/lib/libspl/include/zone.h	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/lib/libspl/include/zone.h	Fri Sep  4 21:31:58 2020	(r365340)
@@ -26,25 +26,16 @@
 #ifndef _LIBSPL_ZONE_H
 #define	_LIBSPL_ZONE_H
 
-
-
 #include <sys/types.h>
 #include <sys/zone.h>
-#include <sys/priv.h>
 
 #ifdef	__cplusplus
 extern "C" {
 #endif
 
 #define	GLOBAL_ZONEID		0
-#define	GLOBAL_ZONEID_NAME	"global"
 
-/*
- * Functions for mapping between id and name for active zones.
- */
 extern zoneid_t		getzoneid(void);
-extern zoneid_t		getzoneidbyname(const char *);
-extern ssize_t		getzonenamebyid(zoneid_t, char *, size_t);
 
 #ifdef	__cplusplus
 }

Added: vendor-sys/openzfs/dist/lib/libspl/os/freebsd/zone.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor-sys/openzfs/dist/lib/libspl/os/freebsd/zone.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <zone.h>
+
+zoneid_t
+getzoneid(void)
+{
+	size_t size;
+	int jailid;
+
+	/* Information that we are in jail or not is enough for our needs. */
+	size = sizeof (jailid);
+	if (sysctlbyname("security.jail.jailed", &jailid, &size, NULL, 0) == -1)
+		assert(!"No security.jail.jailed sysctl!");
+	return ((zoneid_t)jailid);
+}

Modified: vendor-sys/openzfs/dist/lib/libspl/zone.c
==============================================================================
--- vendor-sys/openzfs/dist/lib/libspl/zone.c	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/lib/libspl/zone.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -24,40 +24,9 @@
  */
 
 #include <zone.h>
-#include <string.h>
-#include <errno.h>
 
 zoneid_t
 getzoneid()
 {
 	return (GLOBAL_ZONEID);
-}
-
-zoneid_t
-getzoneidbyname(const char *name)
-{
-	if (name == NULL)
-		return (GLOBAL_ZONEID);
-
-	if (strcmp(name, GLOBAL_ZONEID_NAME) == 0)
-		return (GLOBAL_ZONEID);
-
-	return (EINVAL);
-}
-
-ssize_t
-getzonenamebyid(zoneid_t id, char *buf, size_t buflen)
-{
-	if (id != GLOBAL_ZONEID)
-		return (EINVAL);
-
-	ssize_t ret = strlen(GLOBAL_ZONEID_NAME) + 1;
-
-	if (buf == NULL || buflen == 0)
-		return (ret);
-
-	strncpy(buf, GLOBAL_ZONEID_NAME, buflen);
-	buf[buflen - 1] = '\0';
-
-	return (ret);
 }

Modified: vendor-sys/openzfs/dist/lib/libzfs/libzfs_changelist.c
==============================================================================
--- vendor-sys/openzfs/dist/lib/libzfs/libzfs_changelist.c	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/lib/libzfs/libzfs_changelist.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -128,6 +128,8 @@ changelist_prefix(prop_changelist_t *clp)
 			 */
 			switch (clp->cl_prop) {
 			case ZFS_PROP_MOUNTPOINT:
+				if (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT)
+					break;
 				if (zfs_unmount(cn->cn_handle, NULL,
 				    clp->cl_mflags) != 0) {
 					ret = -1;
@@ -184,7 +186,8 @@ changelist_postfix(prop_changelist_t *clp)
 	if ((cn = uu_avl_last(clp->cl_tree)) == NULL)
 		return (0);
 
-	if (clp->cl_prop == ZFS_PROP_MOUNTPOINT)
+	if (clp->cl_prop == ZFS_PROP_MOUNTPOINT &&
+	    !(clp->cl_gflags & CL_GATHER_DONT_UNMOUNT))
 		remove_mountpoint(cn->cn_handle);
 
 	/*
@@ -235,7 +238,8 @@ changelist_postfix(prop_changelist_t *clp)
 		needs_key = (zfs_prop_get_int(cn->cn_handle,
 		    ZFS_PROP_KEYSTATUS) == ZFS_KEYSTATUS_UNAVAILABLE);
 
-		mounted = zfs_is_mounted(cn->cn_handle, NULL);
+		mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) ||
+		    zfs_is_mounted(cn->cn_handle, NULL);
 
 		if (!mounted && !needs_key && (cn->cn_mounted ||
 		    ((sharenfs || sharesmb || clp->cl_waslegacy) &&

Modified: vendor-sys/openzfs/dist/lib/libzfs/libzfs_dataset.c
==============================================================================
--- vendor-sys/openzfs/dist/lib/libzfs/libzfs_dataset.c	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/lib/libzfs/libzfs_dataset.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -4370,14 +4370,14 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo
  * Renames the given dataset.
  */
 int
-zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive,
-    boolean_t force_unmount)
+zfs_rename(zfs_handle_t *zhp, const char *target, renameflags_t flags)
 {
 	int ret = 0;
 	zfs_cmd_t zc = {"\0"};
 	char *delim;
 	prop_changelist_t *cl = NULL;
 	char parent[ZFS_MAX_DATASET_NAME_LEN];
+	char property[ZFS_MAXPROPLEN];
 	libzfs_handle_t *hdl = zhp->zfs_hdl;
 	char errbuf[1024];
 
@@ -4429,7 +4429,7 @@ zfs_rename(zfs_handle_t *zhp, const char *target, bool
 		if (!zfs_validate_name(hdl, target, zhp->zfs_type, B_TRUE))
 			return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
 	} else {
-		if (recursive) {
+		if (flags.recursive) {
 			zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
 			    "recursive rename must be a snapshot"));
 			return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
@@ -4470,8 +4470,19 @@ zfs_rename(zfs_handle_t *zhp, const char *target, bool
 		return (zfs_error(hdl, EZFS_ZONED, errbuf));
 	}
 
-	if (recursive) {
-		zfs_handle_t *zhrp;
+	/*
+	 * Avoid unmounting file systems with mountpoint property set to
+	 * 'legacy' or 'none' even if -u option is not given.
+	 */
+	if (zhp->zfs_type == ZFS_TYPE_FILESYSTEM &&
+	    !flags.recursive && !flags.nounmount &&
+	    zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, property,
+	    sizeof (property), NULL, NULL, 0, B_FALSE) == 0 &&
+	    (strcmp(property, "legacy") == 0 ||
+	    strcmp(property, "none") == 0)) {
+		flags.nounmount = B_TRUE;
+	}
+	if (flags.recursive) {
 		char *parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name);
 		if (parentname == NULL) {
 			ret = -1;
@@ -4479,7 +4490,8 @@ zfs_rename(zfs_handle_t *zhp, const char *target, bool
 		}
 		delim = strchr(parentname, '@');
 		*delim = '\0';
-		zhrp = zfs_open(zhp->zfs_hdl, parentname, ZFS_TYPE_DATASET);
+		zfs_handle_t *zhrp = zfs_open(zhp->zfs_hdl, parentname,
+		    ZFS_TYPE_DATASET);
 		free(parentname);
 		if (zhrp == NULL) {
 			ret = -1;
@@ -4488,8 +4500,9 @@ zfs_rename(zfs_handle_t *zhp, const char *target, bool
 		zfs_close(zhrp);
 	} else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) {
 		if ((cl = changelist_gather(zhp, ZFS_PROP_NAME,
+		    flags.nounmount ? CL_GATHER_DONT_UNMOUNT :
 		    CL_GATHER_ITER_MOUNTED,
-		    force_unmount ? MS_FORCE : 0)) == NULL)
+		    flags.forceunmount ? MS_FORCE : 0)) == NULL)
 			return (-1);
 
 		if (changelist_haszonedchild(cl)) {
@@ -4513,7 +4526,8 @@ zfs_rename(zfs_handle_t *zhp, const char *target, bool
 	(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
 	(void) strlcpy(zc.zc_value, target, sizeof (zc.zc_value));
 
-	zc.zc_cookie = recursive;
+	zc.zc_cookie = !!flags.recursive;
+	zc.zc_cookie |= (!!flags.nounmount) << 1;
 
 	if ((ret = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_RENAME, &zc)) != 0) {
 		/*
@@ -4523,7 +4537,7 @@ zfs_rename(zfs_handle_t *zhp, const char *target, bool
 		(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
 		    "cannot rename '%s'"), zc.zc_name);
 
-		if (recursive && errno == EEXIST) {
+		if (flags.recursive && errno == EEXIST) {
 			zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
 			    "a child dataset already has a snapshot "
 			    "with the new name"));

Modified: vendor-sys/openzfs/dist/lib/libzpool/kernel.c
==============================================================================
--- vendor-sys/openzfs/dist/lib/libzpool/kernel.c	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/lib/libzpool/kernel.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -41,6 +41,7 @@
 #include <sys/utsname.h>
 #include <sys/zfs_context.h>
 #include <sys/zfs_onexit.h>
+#include <sys/zfs_vfsops.h>
 #include <sys/zstd/zstd.h>
 #include <sys/zvol.h>
 #include <zfs_fletcher.h>
@@ -1407,4 +1408,9 @@ void
 zfs_file_put(int fd)
 {
 	abort();
+}
+
+void
+zfsvfs_update_fromname(const char *oldname, const char *newname)
+{
 }

Modified: vendor-sys/openzfs/dist/man/man8/zfs-rename.8
==============================================================================
--- vendor-sys/openzfs/dist/man/man8/zfs-rename.8	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/man/man8/zfs-rename.8	Fri Sep  4 21:31:58 2020	(r365340)
@@ -44,9 +44,16 @@
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
 .Nm
 .Cm rename
-.Op Fl fp
+.Fl p
+.Op Fl f
 .Ar filesystem Ns | Ns Ar volume
 .Ar filesystem Ns | Ns Ar volume
+.Nm
+.Cm rename
+.Fl u
+.Op Fl f
+.Ar filesystem
+.Ar filesystem
 .Sh DESCRIPTION
 .Bl -tag -width ""
 .It Xo
@@ -59,10 +66,19 @@
 .It Xo
 .Nm
 .Cm rename
-.Op Fl fp
+.Fl p
+.Op Fl f
 .Ar filesystem Ns | Ns Ar volume
 .Ar filesystem Ns | Ns Ar volume
 .Xc
+.It Xo
+.Nm
+.Cm rename
+.Fl u
+.Op Fl f
+.Ar filesystem
+.Ar filesystem
+.Xc
 Renames the given dataset.
 The new target can be located anywhere in the ZFS hierarchy, with the exception
 of snapshots.
@@ -73,12 +89,24 @@ Renamed file systems can inherit new mount points, in 
 unmounted and remounted at the new mount point.
 .Bl -tag -width "-a"
 .It Fl f
-Force unmount any filesystems that need to be unmounted in the process.
+Force unmount any file systems that need to be unmounted in the process.
+This flag has no effect if used together with the
+.Fl u
+flag.
 .It Fl p
 Creates all the nonexistent parent datasets.
 Datasets created in this manner are automatically mounted according to the
 .Sy mountpoint
 property inherited from their parent.
+.It Fl u
+Do not remount file systems during rename.
+If a file system's
+.Sy mountpoint
+property is set to
+.Sy legacy
+or
+.Sy none ,
+the file system is not unmounted even if this option is not given.
 .El
 .It Xo
 .Nm

Modified: vendor-sys/openzfs/dist/module/avl/avl.c
==============================================================================
--- vendor-sys/openzfs/dist/module/avl/avl.c	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/module/avl/avl.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -96,6 +96,9 @@
  * which each have their own compilation environments and subsequent
  * requirements. Each of these environments must be considered when adding
  * dependencies from avl.c.
+ *
+ * Link to Illumos.org for more information on avl function:
+ * [1] https://illumos.org/man/9f/avl
  */
 
 #include <sys/types.h>

Modified: vendor-sys/openzfs/dist/module/nvpair/nvpair.c
==============================================================================
--- vendor-sys/openzfs/dist/module/nvpair/nvpair.c	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/module/nvpair/nvpair.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -25,6 +25,15 @@
  * Copyright 2018 RackTop Systems.
  */
 
+/*
+ * Links to Illumos.org for more information on Interface Libraries:
+ * [1] https://illumos.org/man/3lib/libnvpair
+ * [2] https://illumos.org/man/3nvpair/nvlist_alloc
+ * [3] https://illumos.org/man/9f/nvlist_alloc
+ * [4] https://illumos.org/man/9f/nvlist_next_nvpair
+ * [5] https://illumos.org/man/9f/nvpair_value_byte
+ */
+
 #include <sys/debug.h>
 #include <sys/isa_defs.h>
 #include <sys/nvpair.h>

Modified: vendor-sys/openzfs/dist/module/os/freebsd/spl/spl_kstat.c
==============================================================================
--- vendor-sys/openzfs/dist/module/os/freebsd/spl/spl_kstat.c	Fri Sep  4 21:21:23 2020	(r365339)
+++ vendor-sys/openzfs/dist/module/os/freebsd/spl/spl_kstat.c	Fri Sep  4 21:31:58 2020	(r365340)
@@ -22,6 +22,10 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
+ * Links to Illumos.org for more information on kstat function:
+ * [1] https://illumos.org/man/1M/kstat
+ * [2] https://illumos.org/man/9f/kstat_create
  */
 
 #include <sys/cdefs.h>
@@ -34,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/sysctl.h>
 #include <sys/kstat.h>
+#include <sys/sbuf.h>
 
 static MALLOC_DEFINE(M_KSTAT, "kstat_data", "Kernel statistics");
 
@@ -61,6 +66,156 @@ kstat_default_update(kstat_t *ksp, int rw)
 	return (0);
 }
 
+static int
+kstat_resize_raw(kstat_t *ksp)
+{
+	if (ksp->ks_raw_bufsize == KSTAT_RAW_MAX)
+		return (ENOMEM);
+
+	free(ksp->ks_raw_buf, M_TEMP);
+	ksp->ks_raw_bufsize = MIN(ksp->ks_raw_bufsize * 2, KSTAT_RAW_MAX);
+	ksp->ks_raw_buf = malloc(ksp->ks_raw_bufsize, M_TEMP, M_WAITOK);
+
+	return (0);
+}
+
+static void *
+kstat_raw_default_addr(kstat_t *ksp, loff_t n)
+{
+	if (n == 0)
+		return (ksp->ks_data);
+	return (NULL);
+}
+
+static int
+kstat_sysctl(SYSCTL_HANDLER_ARGS)
+{

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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