changeset 23865:5522547693c2

Merge branch 'upstream_gate' into upstream_merge/2020120401 commit 2e8cdddb34 13333 spellcheck1 doesn't zero table memory commit 8af575c0af 13340 zoneadmd shouldn't rely on autofs commit 553cfb3f8c 13344 loader: zfs_probe_partition should skip EFI System Partition commit a39df08cf5 13194 null/dangling pointer deref somewhere under dmu_objset_upgrade commit 4004e4c5da 13341 crt1.o _start_crt_compiler hook not what gcc expects
author Andy Fiddaman <omnios@citrus-it.co.uk>
date Fri, 04 Dec 2020 20:35:13 +0000
parents 444adcdf1e98 (current diff) bbce4fbe98af (diff)
children 873924caaaf0
files usr/src/boot/lib/libstand/zfs/zfs.c usr/src/boot/sys/boot/forth/illumos-logo.png usr/src/cmd/zoneadmd/vplat.c usr/src/uts/common/fs/zfs/zfs_ioctl.c usr/src/uts/common/fs/zfs/zfs_vfsops.c
diffstat 9 files changed, 77 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/boot/Makefile.version	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/boot/Makefile.version	Fri Dec 04 20:35:13 2020 +0000
@@ -34,4 +34,4 @@
 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
 # The version is processed from left to right, the version number can only
 # be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2020.11.27.2
+BOOT_VERSION = $(LOADER_VERSION)-2020.12.04.1
--- a/usr/src/boot/lib/libstand/zfs/zfs.c	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/boot/lib/libstand/zfs/zfs.c	Fri Dec 04 20:35:13 2020 +0000
@@ -642,6 +642,7 @@
 
 	/* filter out partitions *not* used by zfs */
 	switch (part->type) {
+	case PART_EFI:		/* efi system partition */
 	case PART_RESERVED:	/* efi reserverd */
 	case PART_VTOC_BOOT:	/* vtoc boot area */
 	case PART_VTOC_SWAP:
--- a/usr/src/cmd/spell/Makefile	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/cmd/spell/Makefile	Fri Dec 04 20:35:13 2020 +0000
@@ -113,19 +113,19 @@
 	$(RM) $@; cat list local extra | $(_SH_) ./hashmk1 > $@
 
 hlista: american $(HASHPROG) htemp1
-	$(RM) htemp2; ./hashmk1 <american |sort -u - htemp1 >htemp2
-	$(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
-	$(RM) htemp2
+	$(RM) htemp2a; ./hashmk1 <american |sort -u - htemp1 >htemp2a
+	$(RM) $@; ./spellin1 `wc htemp2a|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2a >$@
+	$(RM) htemp2a
 
 hlistb: british $(HASHPROG) htemp1
-	$(RM) htemp2; ./hashmk1 <british |sort -u - htemp1 >htemp2
-	$(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
-	$(RM) htemp2
+	$(RM) htemp2b; ./hashmk1 <british |sort -u - htemp1 >htemp2b
+	$(RM) $@; ./spellin1 `wc htemp2b|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2b >$@
+	$(RM) htemp2b
 
 hstop:	stop $(HASHPROG)
-	$(RM) htemp2; ./hashmk1 <stop | sort -u >htemp2
-	$(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@
-	$(RM) htemp2
+	$(RM) htemp2s; ./hashmk1 <stop | sort -u >htemp2s
+	$(RM) $@; ./spellin1 `wc htemp2s|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2s >$@
+	$(RM) htemp2s
 
 install: all $(ROOTDIRS) $(ROOTBINF) $(ROOTSPELLF) $(ROOTVARADMF)
 
--- a/usr/src/cmd/spell/spellin.c	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/cmd/spell/spellin.c	Fri Dec 04 20:35:13 2020 +0000
@@ -25,11 +25,9 @@
  */
 
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
-/*	  All Rights Reserved  	*/
+/*	  All Rights Reserved   */
 
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -97,7 +95,7 @@
 		(void) fprintf(stderr, gettext("%s: arg count\n"), argv[0]);
 		exit(1);
 	}
-	table = (unsigned *)malloc(ND * sizeof (*table));
+	table = (unsigned *)calloc(ND, sizeof (*table));
 	if (table == 0) {
 		(void) fprintf(stderr, gettext("%s: no space for table\n"),
 		    argv[0]);
@@ -129,8 +127,8 @@
 					break;
 			}
 			if (i > B) {
-				if (!(append((unsigned)(w1>>(long) (i-B)), B) &&
-				    append((unsigned)(w1<<(long) (B+B-i)),
+				if (!(append((unsigned)(w1>>(long)(i-B)), B) &&
+				    append((unsigned)(w1<<(long)(B+B-i)),
 				    i-B)))
 					ignore++;
 			} else
--- a/usr/src/cmd/zoneadmd/vplat.c	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/cmd/zoneadmd/vplat.c	Fri Dec 04 20:35:13 2020 +0000
@@ -24,6 +24,7 @@
  * Copyright 2016, Joyent Inc.
  * Copyright (c) 2015, 2016 by Delphix. All rights reserved.
  * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 RackTop Systems Inc.
  */
 
 /*
@@ -214,10 +215,18 @@
 static int
 autofs_cleanup(zoneid_t zoneid)
 {
+	int r;
+
 	/*
 	 * Ask autofs to unmount all trigger nodes in the given zone.
+	 * Handle ENOSYS in the case that the autofs kernel module is not
+	 * installed.
 	 */
-	return (_autofssys(AUTOFS_UNMOUNTALL, (void *)zoneid));
+	r = _autofssys(AUTOFS_UNMOUNTALL, (void *)zoneid);
+	if (r != 0 && errno == ENOSYS) {
+		return (0);
+	}
+	return (r);
 }
 
 static void
--- a/usr/src/lib/crt/common/common-crt.c	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/lib/crt/common/common-crt.c	Fri Dec 04 20:35:13 2020 +0000
@@ -11,6 +11,7 @@
 
 /*
  * Copyright 2016, Richard Lowe.
+ * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  */
 
 /*
@@ -35,8 +36,8 @@
 extern void _init(void);
 extern void _fini(void);
 
-#pragma weak _start_crt_compiler
-extern void _start_crt_compiler(int argc, char **argv);
+#pragma weak __start_crt_compiler
+extern int __start_crt_compiler(int argc, char **argv);
 
 #if defined(__x86)
 int __longdouble_used = 0;
@@ -80,21 +81,34 @@
 	_environ = argv + (argc + 1);
 	___Argv = argv;
 
-	if (&_start_crt_compiler != NULL)
-		_start_crt_compiler(argc, argv);
+	/*
+	 * __start_crt_compiler() provides a hook for compilers to perform
+	 * extra initialisation before main() is called. For example, gcc uses
+	 * this to initialise profiling code for objects built with its -pg
+	 * option by linking in an extra object that provides this function.
+	 *
+	 * This mechanism replaces the earlier separate gcrt1.o.
+	 *
+	 * If __start_crt_compiler() returns a non-zero value, then the
+	 * process will exit with that value, without main() being called.
+	 */
+	if (&__start_crt_compiler != NULL)
+		ret = __start_crt_compiler(argc, argv);
 
+	if (ret == 0) {
 #if defined(__x86)
-	__fpstart();
+		__fpstart();
 #endif
-#if defined(__i386) 		/* Not amd64 */
-	/*
-	 * Note that Studio cc(1) sets the _value of the symbol_, that is, its
-	 * address.  Not the value _at_ that address.
-	 */
-	__fsr((uintptr_t)&__fsr_init_value);
+#if defined(__i386)		/* Not amd64 */
+		/*
+		 * Note that Studio cc(1) sets the _value of the symbol_, that
+		 * is, its address.  Not the value _at_ that address.
+		 */
+		__fsr((uintptr_t)&__fsr_init_value);
 #endif
-	_init();
-	ret = main(argc, argv, _environ);
+		_init();
+		ret = main(argc, argv, _environ);
+	}
 	exit(ret);
 	_exit(ret);
 }
--- a/usr/src/uts/common/fs/zfs/dmu_objset.c	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/uts/common/fs/zfs/dmu_objset.c	Fri Dec 04 20:35:13 2020 +0000
@@ -28,6 +28,7 @@
  * Copyright (c) 2015, STRATO AG, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2017 Nexenta Systems, Inc.
+ * Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
  */
 
 /* Portions Copyright 2010 Robert Milkowski */
@@ -81,6 +82,8 @@
  */
 int dmu_rescan_dnode_threshold = 131072;
 
+static char *upgrade_tag = "upgrade_tag";
+
 static void dmu_objset_find_dp_cb(void *arg);
 
 static void dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb);
@@ -1484,6 +1487,7 @@
 	os->os_upgrade_exit = B_TRUE;
 	os->os_upgrade_id = 0;
 	mutex_exit(&os->os_upgrade_lock);
+	dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
 }
 
 static void
@@ -1492,6 +1496,9 @@
 	if (os->os_upgrade_id != 0)
 		return;
 
+	ASSERT(dsl_pool_config_held(dmu_objset_pool(os)));
+	dsl_dataset_long_hold(dmu_objset_ds(os), upgrade_tag);
+
 	mutex_enter(&os->os_upgrade_lock);
 	if (os->os_upgrade_id == 0 && os->os_upgrade_status == 0) {
 		os->os_upgrade_exit = B_FALSE;
@@ -1499,8 +1506,10 @@
 		os->os_upgrade_id = taskq_dispatch(
 		    os->os_spa->spa_upgrade_taskq,
 		    dmu_objset_upgrade_task_cb, os, TQ_SLEEP);
-		if (os->os_upgrade_id == 0)
+		if (os->os_upgrade_id == TASKQID_INVALID) {
+			dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
 			os->os_upgrade_status = ENOMEM;
+		}
 	}
 	mutex_exit(&os->os_upgrade_lock);
 }
@@ -1511,10 +1520,12 @@
 	mutex_enter(&os->os_upgrade_lock);
 	os->os_upgrade_exit = B_TRUE;
 	if (os->os_upgrade_id != 0) {
+		taskqid_t tid = os->os_upgrade_id;
+
 		os->os_upgrade_id = 0;
 		mutex_exit(&os->os_upgrade_lock);
 
-		taskq_wait(os->os_spa->spa_upgrade_taskq);
+		taskq_wait_id(os->os_spa->spa_upgrade_taskq, tid);
 	} else {
 		mutex_exit(&os->os_upgrade_lock);
 	}
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Fri Dec 04 20:35:13 2020 +0000
@@ -5627,9 +5627,6 @@
 	if (error != 0)
 		return (error);
 
-	dsl_dataset_long_hold(dmu_objset_ds(os), FTAG);
-	dsl_pool_rele(dmu_objset_pool(os), FTAG);
-
 	if (dmu_objset_userobjspace_upgradable(os) ||
 	    dmu_objset_projectquota_upgradable(os)) {
 		mutex_enter(&os->os_upgrade_lock);
@@ -5643,11 +5640,14 @@
 			mutex_exit(&os->os_upgrade_lock);
 		}
 
+		dsl_pool_rele(dmu_objset_pool(os), FTAG);
+
 		taskq_wait_id(os->os_spa->spa_upgrade_taskq, os->os_upgrade_id);
 		error = os->os_upgrade_status;
-	}
-
-	dsl_dataset_long_rele(dmu_objset_ds(os), FTAG);
+	} else {
+		dsl_pool_rele(dmu_objset_pool(os), FTAG);
+	}
+
 	dsl_dataset_rele(dmu_objset_ds(os), FTAG);
 
 	return (error);
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c	Thu Dec 03 11:07:56 2020 +0100
+++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c	Fri Dec 04 20:35:13 2020 +0000
@@ -924,8 +924,13 @@
 	int err;
 
 	if (!dmu_objset_userobjspace_present(zfsvfs->z_os)) {
-		if (dmu_objset_userobjspace_upgradable(zfsvfs->z_os))
+		if (dmu_objset_userobjspace_upgradable(zfsvfs->z_os)) {
+			dsl_pool_config_enter(
+			    dmu_objset_pool(zfsvfs->z_os), FTAG);
 			dmu_objset_id_quota_upgrade(zfsvfs->z_os);
+			dsl_pool_config_exit(
+			    dmu_objset_pool(zfsvfs->z_os), FTAG);
+		}
 		return (B_FALSE);
 	}