From owner-svn-src-all@freebsd.org Fri Sep 18 22:55:14 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 095ED3F2D26; Fri, 18 Sep 2020 22:55:14 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BtTgj6ks7z4Gnv; Fri, 18 Sep 2020 22:55:13 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAC6122796; Fri, 18 Sep 2020 22:55:13 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08IMtDLm059032; Fri, 18 Sep 2020 22:55:13 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08IMt5uB058991; Fri, 18 Sep 2020 22:55:05 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <202009182255.08IMt5uB058991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Fri, 18 Sep 2020 22:55:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r365892 - in vendor-sys/openzfs/dist: . cmd/mount_zfs cmd/zdb cmd/zfs cmd/zgenhostid cmd/zpool config contrib/dracut/90zfs include include/os/freebsd/spl/sys include/os/freebsd/zfs/sys ... X-SVN-Group: vendor-sys X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in vendor-sys/openzfs/dist: . cmd/mount_zfs cmd/zdb cmd/zfs cmd/zgenhostid cmd/zpool config contrib/dracut/90zfs include include/os/freebsd/spl/sys include/os/freebsd/zfs/sys include/os/linux/kernel/l... X-SVN-Commit-Revision: 365892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Sep 2020 22:55:14 -0000 Author: mmacy Date: Fri Sep 18 22:55:05 2020 New Revision: 365892 URL: https://svnweb.freebsd.org/changeset/base/365892 Log: Update openzfs to 2.0.0-rc2-g4ce06f Added: vendor-sys/openzfs/dist/cmd/zgenhostid/.gitignore vendor-sys/openzfs/dist/cmd/zgenhostid/zgenhostid.c (contents, props changed) vendor-sys/openzfs/dist/include/libzfsbootenv.h (contents, props changed) vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_bootenv_os.h (contents, props changed) vendor-sys/openzfs/dist/include/os/linux/zfs/sys/zfs_bootenv_os.h (contents, props changed) vendor-sys/openzfs/dist/include/sys/zfs_bootenv.h (contents, props changed) vendor-sys/openzfs/dist/lib/libzfsbootenv/ vendor-sys/openzfs/dist/lib/libzfsbootenv/.gitignore vendor-sys/openzfs/dist/lib/libzfsbootenv/Makefile.am (contents, props changed) vendor-sys/openzfs/dist/lib/libzfsbootenv/libzfsbootenv.pc.in (contents, props changed) vendor-sys/openzfs/dist/lib/libzfsbootenv/lzbe_device.c (contents, props changed) vendor-sys/openzfs/dist/lib/libzfsbootenv/lzbe_pair.c (contents, props changed) vendor-sys/openzfs/dist/lib/libzfsbootenv/lzbe_util.c (contents, props changed) vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_events/.gitignore vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_events/ereports.c (contents, props changed) vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh Deleted: vendor-sys/openzfs/dist/cmd/zgenhostid/zgenhostid Modified: vendor-sys/openzfs/dist/META vendor-sys/openzfs/dist/cmd/mount_zfs/mount_zfs.c vendor-sys/openzfs/dist/cmd/zdb/zdb.c vendor-sys/openzfs/dist/cmd/zfs/zfs_main.c vendor-sys/openzfs/dist/cmd/zgenhostid/Makefile.am vendor-sys/openzfs/dist/cmd/zpool/zpool_main.c vendor-sys/openzfs/dist/config/deb.am vendor-sys/openzfs/dist/config/find_system_library.m4 vendor-sys/openzfs/dist/config/rpm.am vendor-sys/openzfs/dist/config/zfs-build.m4 vendor-sys/openzfs/dist/configure.ac vendor-sys/openzfs/dist/contrib/dracut/90zfs/module-setup.sh.in vendor-sys/openzfs/dist/contrib/dracut/90zfs/parse-zfs.sh.in vendor-sys/openzfs/dist/include/Makefile.am vendor-sys/openzfs/dist/include/libzfs.h vendor-sys/openzfs/dist/include/libzfs_core.h vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/ccompile.h vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/condvar.h vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/Makefile.am vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_context_os.h vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_vfsops_os.h vendor-sys/openzfs/dist/include/os/linux/kernel/linux/mod_compat.h vendor-sys/openzfs/dist/include/os/linux/spl/sys/condvar.h vendor-sys/openzfs/dist/include/os/linux/zfs/sys/Makefile.am vendor-sys/openzfs/dist/include/sys/Makefile.am vendor-sys/openzfs/dist/include/sys/dsl_synctask.h vendor-sys/openzfs/dist/include/sys/fm/fs/zfs.h vendor-sys/openzfs/dist/include/sys/fm/util.h vendor-sys/openzfs/dist/include/sys/fs/zfs.h vendor-sys/openzfs/dist/include/sys/spa.h vendor-sys/openzfs/dist/include/sys/vdev.h vendor-sys/openzfs/dist/include/sys/vdev_impl.h vendor-sys/openzfs/dist/include/sys/zfs_context.h vendor-sys/openzfs/dist/include/sys/zfs_ioctl.h vendor-sys/openzfs/dist/include/sys/zio.h vendor-sys/openzfs/dist/lib/Makefile.am vendor-sys/openzfs/dist/lib/libefi/rdwr_efi.c vendor-sys/openzfs/dist/lib/libshare/os/linux/nfs.c vendor-sys/openzfs/dist/lib/libspl/include/os/freebsd/sys/stat.h vendor-sys/openzfs/dist/lib/libzfs/libzfs.pc.in vendor-sys/openzfs/dist/lib/libzfs/libzfs_dataset.c vendor-sys/openzfs/dist/lib/libzfs/libzfs_pool.c vendor-sys/openzfs/dist/lib/libzfs/libzfs_sendrecv.c vendor-sys/openzfs/dist/lib/libzfs/libzfs_util.c vendor-sys/openzfs/dist/lib/libzfs/os/linux/libzfs_pool_os.c vendor-sys/openzfs/dist/lib/libzfs_core/libzfs_core.c vendor-sys/openzfs/dist/lib/libzfs_core/libzfs_core.pc.in vendor-sys/openzfs/dist/lib/libzpool/Makefile.am vendor-sys/openzfs/dist/lib/libzutil/Makefile.am vendor-sys/openzfs/dist/man/man5/zfs-module-parameters.5 vendor-sys/openzfs/dist/man/man8/zfs-rename.8 vendor-sys/openzfs/dist/man/man8/zfsprops.8 vendor-sys/openzfs/dist/man/man8/zgenhostid.8 vendor-sys/openzfs/dist/man/man8/zpoolprops.8 vendor-sys/openzfs/dist/module/os/freebsd/zfs/kmod_core.c vendor-sys/openzfs/dist/module/os/freebsd/zfs/sysctl_os.c vendor-sys/openzfs/dist/module/os/freebsd/zfs/vdev_file.c vendor-sys/openzfs/dist/module/os/freebsd/zfs/zfs_file_os.c vendor-sys/openzfs/dist/module/os/freebsd/zfs/zfs_vfsops.c vendor-sys/openzfs/dist/module/os/freebsd/zfs/zfs_vnops.c vendor-sys/openzfs/dist/module/os/freebsd/zfs/zfs_znode.c vendor-sys/openzfs/dist/module/os/linux/spl/spl-condvar.c vendor-sys/openzfs/dist/module/os/linux/zfs/vdev_disk.c vendor-sys/openzfs/dist/module/os/linux/zfs/vdev_file.c vendor-sys/openzfs/dist/module/os/linux/zfs/zfs_acl.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/os/linux/zfs/zpl_xattr.c vendor-sys/openzfs/dist/module/zcommon/zfs_prop.c vendor-sys/openzfs/dist/module/zfs/arc.c vendor-sys/openzfs/dist/module/zfs/dbuf.c vendor-sys/openzfs/dist/module/zfs/dmu_redact.c vendor-sys/openzfs/dist/module/zfs/dnode.c vendor-sys/openzfs/dist/module/zfs/dsl_scan.c vendor-sys/openzfs/dist/module/zfs/dsl_synctask.c vendor-sys/openzfs/dist/module/zfs/fm.c vendor-sys/openzfs/dist/module/zfs/metaslab.c vendor-sys/openzfs/dist/module/zfs/mmp.c vendor-sys/openzfs/dist/module/zfs/range_tree.c vendor-sys/openzfs/dist/module/zfs/spa.c vendor-sys/openzfs/dist/module/zfs/spa_config.c vendor-sys/openzfs/dist/module/zfs/spa_history.c vendor-sys/openzfs/dist/module/zfs/txg.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_initialize.c vendor-sys/openzfs/dist/module/zfs/vdev_label.c vendor-sys/openzfs/dist/module/zfs/vdev_mirror.c vendor-sys/openzfs/dist/module/zfs/vdev_raidz.c vendor-sys/openzfs/dist/module/zfs/vdev_rebuild.c vendor-sys/openzfs/dist/module/zfs/vdev_removal.c vendor-sys/openzfs/dist/module/zfs/vdev_trim.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/module/zfs/zthr.c vendor-sys/openzfs/dist/rpm/generic/zfs.spec.in vendor-sys/openzfs/dist/scripts/zfs-tests.sh vendor-sys/openzfs/dist/tests/runfiles/common.run vendor-sys/openzfs/dist/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am vendor-sys/openzfs/dist/tests/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c vendor-sys/openzfs/dist/tests/zfs-tests/include/commands.cfg vendor-sys/openzfs/dist/tests/zfs-tests/include/tunables.cfg vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/acl/posix/setup.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_add/add-o_ashift.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_prop_ashift.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_root/zpool_set/zpool_set_ashift.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/history/history_002_pos.ksh vendor-sys/openzfs/dist/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh Modified: vendor-sys/openzfs/dist/META ============================================================================== --- vendor-sys/openzfs/dist/META Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/META Fri Sep 18 22:55:05 2020 (r365892) @@ -2,7 +2,7 @@ Meta: 1 Name: zfs Branch: 1.0 Version: 2.0.0 -Release: rc1 +Release: rc2 Release-Tags: relext License: CDDL Author: OpenZFS Modified: vendor-sys/openzfs/dist/cmd/mount_zfs/mount_zfs.c ============================================================================== --- vendor-sys/openzfs/dist/cmd/mount_zfs/mount_zfs.c Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/cmd/mount_zfs/mount_zfs.c Fri Sep 18 22:55:05 2020 (r365892) @@ -182,6 +182,7 @@ main(int argc, char **argv) int error, c; (void) setlocale(LC_ALL, ""); + (void) setlocale(LC_NUMERIC, "C"); (void) textdomain(TEXT_DOMAIN); opterr = 0; Modified: vendor-sys/openzfs/dist/cmd/zdb/zdb.c ============================================================================== --- vendor-sys/openzfs/dist/cmd/zdb/zdb.c Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/cmd/zdb/zdb.c Fri Sep 18 22:55:05 2020 (r365892) @@ -5340,11 +5340,6 @@ load_unflushed_svr_segs_cb(spa_t *spa, space_map_entry if (txg < metaslab_unflushed_txg(ms)) return (0); - vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping; - ASSERT(vim != NULL); - if (offset >= vdev_indirect_mapping_max_offset(vim)) - return (0); - if (sme->sme_type == SM_ALLOC) range_tree_add(svr->svr_allocd_segs, offset, size); else @@ -5406,9 +5401,6 @@ zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb) range_tree_t *allocs = range_tree_create(NULL, RANGE_SEG64, NULL, 0, 0); for (uint64_t msi = 0; msi < vd->vdev_ms_count; msi++) { metaslab_t *msp = vd->vdev_ms[msi]; - - if (msp->ms_start >= vdev_indirect_mapping_max_offset(vim)) - break; ASSERT0(range_tree_space(allocs)); if (msp->ms_sm != NULL) Modified: vendor-sys/openzfs/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor-sys/openzfs/dist/cmd/zfs/zfs_main.c Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/cmd/zfs/zfs_main.c Fri Sep 18 22:55:05 2020 (r365892) @@ -8468,6 +8468,7 @@ main(int argc, char **argv) char **newargv; (void) setlocale(LC_ALL, ""); + (void) setlocale(LC_NUMERIC, "C"); (void) textdomain(TEXT_DOMAIN); opterr = 0; Added: vendor-sys/openzfs/dist/cmd/zgenhostid/.gitignore ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/openzfs/dist/cmd/zgenhostid/.gitignore Fri Sep 18 22:55:05 2020 (r365892) @@ -0,0 +1 @@ +/zgenhostid Modified: vendor-sys/openzfs/dist/cmd/zgenhostid/Makefile.am ============================================================================== --- vendor-sys/openzfs/dist/cmd/zgenhostid/Makefile.am Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/cmd/zgenhostid/Makefile.am Fri Sep 18 22:55:05 2020 (r365892) @@ -1 +1,5 @@ -dist_bin_SCRIPTS = zgenhostid +include $(top_srcdir)/config/Rules.am + +bin_PROGRAMS = zgenhostid + +zgenhostid_SOURCES = zgenhostid.c Added: vendor-sys/openzfs/dist/cmd/zgenhostid/zgenhostid.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/openzfs/dist/cmd/zgenhostid/zgenhostid.c Fri Sep 18 22:55:05 2020 (r365892) @@ -0,0 +1,152 @@ +/* + * 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 + */ + +/* + * Copyright (c) 2020, Georgy Yakovlev. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void usage(void); + +static void +usage(void) +{ + (void) fprintf(stderr, + "usage: zgenhostid [-fh] [-o path] [value]\n\n" + " -f\t\t force hostid file write\n" + " -h\t\t print this usage and exit\n" + " -o \t write hostid to this file\n\n" + "If hostid file is not present, store a hostid in it.\n" + "The optional value must be an 8-digit hex number between" + "1 and 2^32-1.\n" + "If no value is provided, a random one will" + "be generated.\n" + "The value must be unique among your systems.\n"); + exit(EXIT_FAILURE); + /* NOTREACHED */ +} + +int +main(int argc, char **argv) +{ + /* default file path, can be optionally set by user */ + char path[PATH_MAX] = "/etc/hostid"; + /* holds converted user input or lrand48() generated value */ + unsigned long input_i = 0; + + int opt; + int pathlen; + int force_fwrite = 0; + while ((opt = getopt_long(argc, argv, "fo:h?", 0, 0)) != -1) { + switch (opt) { + case 'f': + force_fwrite = 1; + break; + case 'o': + pathlen = snprintf(path, sizeof (path), "%s", optarg); + if (pathlen >= sizeof (path)) { + fprintf(stderr, "%s\n", strerror(EOVERFLOW)); + exit(EXIT_FAILURE); + } else if (pathlen < 1) { + fprintf(stderr, "%s\n", strerror(EINVAL)); + exit(EXIT_FAILURE); + } + break; + case 'h': + case '?': + usage(); + } + } + + char *in_s = argv[optind]; + if (in_s != NULL) { + /* increment pointer by 2 if string is 0x prefixed */ + if (strncasecmp("0x", in_s, 2) == 0) { + in_s += 2; + } + + /* need to be exactly 8 characters */ + const char *hex = "0123456789abcdefABCDEF"; + if (strlen(in_s) != 8 || strspn(in_s, hex) != 8) { + fprintf(stderr, "%s\n", strerror(ERANGE)); + usage(); + } + + input_i = strtoul(in_s, NULL, 16); + if (errno != 0) { + perror("strtoul"); + exit(EXIT_FAILURE); + } + + if (input_i < 0x1 || input_i > UINT32_MAX) { + fprintf(stderr, "%s\n", strerror(ERANGE)); + usage(); + } + } + + struct stat fstat; + if (force_fwrite == 0 && stat(path, &fstat) == 0 && + S_ISREG(fstat.st_mode)) { + fprintf(stderr, "%s: %s\n", path, strerror(EEXIST)); + exit(EXIT_FAILURE); + } + + /* + * generate if not provided by user + * also handle unlikely zero return from lrand48() + */ + while (input_i == 0) { + srand48(getpid() ^ time(NULL)); + input_i = lrand48(); + } + + FILE *fp = fopen(path, "wb"); + if (!fp) { + perror("fopen"); + exit(EXIT_FAILURE); + } + + /* + * we need just 4 bytes in native endianess + * not using sethostid() because it may be missing or just a stub + */ + uint32_t hostid = input_i; + int written = fwrite(&hostid, 1, 4, fp); + if (written != 4) { + perror("fwrite"); + exit(EXIT_FAILURE); + } + + fclose(fp); + exit(EXIT_SUCCESS); +} Modified: vendor-sys/openzfs/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor-sys/openzfs/dist/cmd/zpool/zpool_main.c Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/cmd/zpool/zpool_main.c Fri Sep 18 22:55:05 2020 (r365892) @@ -2654,6 +2654,13 @@ show_import(nvlist_t *config) errata); break; + case ZPOOL_STATUS_NON_NATIVE_ASHIFT: + printf_color(ANSI_BOLD, gettext("status: ")); + printf_color(ANSI_YELLOW, gettext("One or more devices are " + "configured to use a non-native block size.\n" + "\tExpect reduced performance.\n")); + break; + default: /* * No other status can be seen when importing pools. @@ -10229,6 +10236,7 @@ main(int argc, char **argv) char **newargv; (void) setlocale(LC_ALL, ""); + (void) setlocale(LC_NUMERIC, "C"); (void) textdomain(TEXT_DOMAIN); srand(time(NULL)); Modified: vendor-sys/openzfs/dist/config/deb.am ============================================================================== --- vendor-sys/openzfs/dist/config/deb.am Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/config/deb.am Fri Sep 18 22:55:05 2020 (r365892) @@ -35,7 +35,7 @@ deb-dkms: deb-local rpm-dkms fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1 || exit 1; \ $(RM) $$pkg1 -deb-utils: deb-local rpm-utils +deb-utils: deb-local rpm-utils-initramfs name=${PACKAGE}; \ version=${VERSION}-${RELEASE}; \ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ Modified: vendor-sys/openzfs/dist/config/find_system_library.m4 ============================================================================== --- vendor-sys/openzfs/dist/config/find_system_library.m4 Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/config/find_system_library.m4 Fri Sep 18 22:55:05 2020 (r365892) @@ -11,10 +11,12 @@ AC_DEFUN([ZFS_AC_FIND_SYSTEM_LIBRARY], [ _header_found= _library_found= + _pc_found= AS_IF([test -n "$2"], [PKG_CHECK_MODULES([$1], [$2], [ _header_found=1 _library_found=1 + _pc_found=1 ], [:])]) # set _header_found/_library_found if the user passed in CFLAGS/LIBS @@ -82,6 +84,9 @@ AC_DEFUN([ZFS_AC_FIND_SYSTEM_LIBRARY], [ AS_IF([test "x$_header_found" = "x1" && test "x$_library_found" = "x1"], [ AC_SUBST([$1]_CFLAGS) AC_SUBST([$1]_LIBS) + AS_IF([test "x$_pc_found" = "x1"], [ + AC_SUBST([$1]_PC, [$2]) + ]) AC_DEFINE([HAVE_][$1], [1], [Define if you have [$5]]) $7 ],[dnl ELSE Modified: vendor-sys/openzfs/dist/config/rpm.am ============================================================================== --- vendor-sys/openzfs/dist/config/rpm.am Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/config/rpm.am Fri Sep 18 22:55:05 2020 (r365892) @@ -7,7 +7,7 @@ ############################################################################### PHONY += srpm srpms srpm-kmod srpm-dkms srpm-utils -PHONY += rpm rpms rpm-kmod rpm-dkms rpm-utils +PHONY += rpm rpms rpm-kmod rpm-dkms rpm-utils rpm-utils-initramfs PHONY += srpm-common rpm-common rpm-local srpm-kmod srpm-dkms srpm-utils: dist @@ -35,9 +35,21 @@ rpm-dkms: srpm-dkms $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \ def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_DKMS}' rpm-common +# The rpm-utils and rpm-utils-initramfs targets are identical except for the +# zfs-initramfs package: rpm-utils never includes it, rpm-utils-initramfs +# includes it if detected at configure time. The zfs-initramfs package does +# not work on any known RPM-based distribution and the resulting RPM is only +# used to create a Debian package. The rpm-utils-initramfs target is not +# intended to be specified by the user directly, it is provided as a +# dependency of the deb-utils target. + rpm-utils: srpm-utils $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \ def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_UTIL}' rpm-common + +rpm-utils-initramfs: srpm-utils + $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \ + def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_UTIL} ${RPM_DEFINE_INITRAMFS}' rpm-common rpm: rpm-kmod rpm-dkms rpm-utils rpms: rpm-kmod rpm-dkms rpm-utils Modified: vendor-sys/openzfs/dist/config/zfs-build.m4 ============================================================================== --- vendor-sys/openzfs/dist/config/zfs-build.m4 Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/config/zfs-build.m4 Fri Sep 18 22:55:05 2020 (r365892) @@ -282,7 +282,6 @@ AC_DEFUN([ZFS_AC_RPM], [ AS_IF([test -n "$udevruledir" ], [ RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_udevruledir $(udevruledir)"' ]) - RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_INITRAMFS)' RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_SYSTEMD)' RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYZFS)' RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PAM)' @@ -542,13 +541,13 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ AC_MSG_CHECKING([whether initramfs-tools is available]) if test -d /usr/share/initramfs-tools ; then - DEFINE_INITRAMFS='--define "_initramfs 1"' + RPM_DEFINE_INITRAMFS='--define "_initramfs 1"' AC_MSG_RESULT([yes]) else - DEFINE_INITRAMFS='' + RPM_DEFINE_INITRAMFS='' AC_MSG_RESULT([no]) fi - AC_SUBST(DEFINE_INITRAMFS) + AC_SUBST(RPM_DEFINE_INITRAMFS) ]) dnl # Modified: vendor-sys/openzfs/dist/configure.ac ============================================================================== --- vendor-sys/openzfs/dist/configure.ac Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/configure.ac Fri Sep 18 22:55:05 2020 (r365892) @@ -161,6 +161,8 @@ AC_CONFIG_FILES([ lib/libuutil/Makefile lib/libzfs/Makefile lib/libzfs/libzfs.pc + lib/libzfsbootenv/Makefile + lib/libzfsbootenv/libzfsbootenv.pc lib/libzfs_core/Makefile lib/libzfs_core/libzfs_core.pc lib/libzpool/Makefile Modified: vendor-sys/openzfs/dist/contrib/dracut/90zfs/module-setup.sh.in ============================================================================== --- vendor-sys/openzfs/dist/contrib/dracut/90zfs/module-setup.sh.in Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/contrib/dracut/90zfs/module-setup.sh.in Fri Sep 18 22:55:05 2020 (r365892) @@ -5,7 +5,7 @@ check() { [ "${1}" = "-d" ] && return 0 # Verify the zfs tool chain - for tool in "@sbindir@/zpool" "@sbindir@/zfs" "@mounthelperdir@/mount.zfs" ; do + for tool in "@bindir@/zgenhostid" "@sbindir@/zpool" "@sbindir@/zfs" "@mounthelperdir@/mount.zfs" ; do test -x "$tool" || return 1 done # Verify grep exists @@ -38,6 +38,7 @@ install() { inst_rules @udevruledir@/60-zvol.rules dracut_install hostid dracut_install grep + dracut_install @bindir@/zgenhostid dracut_install @sbindir@/zfs dracut_install @sbindir@/zpool # Workaround for zfsonlinux/zfs#4749 by ensuring libgcc_s.so(.1) is included @@ -83,11 +84,7 @@ install() { fi # Synchronize initramfs and system hostid - AA=`hostid | cut -b 1,2` - BB=`hostid | cut -b 3,4` - CC=`hostid | cut -b 5,6` - DD=`hostid | cut -b 7,8` - echo -ne "\\x${DD}\\x${CC}\\x${BB}\\x${AA}" > "${initdir}/etc/hostid" + zgenhostid -o "${initdir}/etc/hostid" "$(hostid)" if dracut_module_included "systemd"; then mkdir -p "${initdir}/$systemdsystemunitdir/zfs-import.target.wants" Modified: vendor-sys/openzfs/dist/contrib/dracut/90zfs/parse-zfs.sh.in ============================================================================== --- vendor-sys/openzfs/dist/contrib/dracut/90zfs/parse-zfs.sh.in Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/contrib/dracut/90zfs/parse-zfs.sh.in Fri Sep 18 22:55:05 2020 (r365892) @@ -6,11 +6,7 @@ spl_hostid=$(getarg spl_hostid=) if [ -n "${spl_hostid}" ] ; then info "ZFS: Using hostid from command line: ${spl_hostid}" - AA=$(echo "${spl_hostid}" | cut -b 1,2) - BB=$(echo "${spl_hostid}" | cut -b 3,4) - CC=$(echo "${spl_hostid}" | cut -b 5,6) - DD=$(echo "${spl_hostid}" | cut -b 7,8) - echo -ne "\\x${DD}\\x${CC}\\x${BB}\\x${AA}" >/etc/hostid + zgenhostid -f "${spl_hostid}" elif [ -f "/etc/hostid" ] ; then info "ZFS: Using hostid from /etc/hostid: $(hostid)" else Modified: vendor-sys/openzfs/dist/include/Makefile.am ============================================================================== --- vendor-sys/openzfs/dist/include/Makefile.am Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/Makefile.am Fri Sep 18 22:55:05 2020 (r365892) @@ -15,6 +15,7 @@ USER_H = \ libuutil.h \ libuutil_impl.h \ libzfs.h \ + libzfsbootenv.h \ libzfs_core.h \ libzfs_impl.h \ libzutil.h \ Modified: vendor-sys/openzfs/dist/include/libzfs.h ============================================================================== --- vendor-sys/openzfs/dist/include/libzfs.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/libzfs.h Fri Sep 18 22:55:05 2020 (r365892) @@ -892,8 +892,8 @@ extern int zpool_in_use(libzfs_handle_t *, int, pool_s * Label manipulation. */ extern int zpool_clear_label(int); -extern int zpool_set_bootenv(zpool_handle_t *, const char *); -extern int zpool_get_bootenv(zpool_handle_t *, char *, size_t, off_t); +extern int zpool_set_bootenv(zpool_handle_t *, const nvlist_t *); +extern int zpool_get_bootenv(zpool_handle_t *, nvlist_t **); /* * Management interfaces for SMB ACL files Modified: vendor-sys/openzfs/dist/include/libzfs_core.h ============================================================================== --- vendor-sys/openzfs/dist/include/libzfs_core.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/libzfs_core.h Fri Sep 18 22:55:05 2020 (r365892) @@ -135,7 +135,7 @@ int lzc_wait(const char *, zpool_wait_activity_t, bool int lzc_wait_tag(const char *, zpool_wait_activity_t, uint64_t, boolean_t *); int lzc_wait_fs(const char *, zfs_wait_activity_t, boolean_t *); -int lzc_set_bootenv(const char *, const char *); +int lzc_set_bootenv(const char *, const nvlist_t *); int lzc_get_bootenv(const char *, nvlist_t **); #ifdef __cplusplus } Added: vendor-sys/openzfs/dist/include/libzfsbootenv.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/openzfs/dist/include/libzfsbootenv.h Fri Sep 18 22:55:05 2020 (r365892) @@ -0,0 +1,41 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2020 Toomas Soome + */ + +#ifndef _LIBZFSBOOTENV_H +#define _LIBZFSBOOTENV_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum lzbe_flags { + lzbe_add, /* add data to existing nvlist */ + lzbe_replace /* replace current nvlist */ +} lzbe_flags_t; + +extern int lzbe_nvlist_get(const char *, const char *, void **); +extern int lzbe_nvlist_set(const char *, const char *, void *); +extern void lzbe_nvlist_free(void *); +extern int lzbe_add_pair(void *, const char *, const char *, void *, size_t); +extern int lzbe_remove_pair(void *, const char *); +extern int lzbe_set_boot_device(const char *, lzbe_flags_t, const char *); +extern int lzbe_get_boot_device(const char *, char **); +extern int lzbe_bootenv_print(const char *, const char *, FILE *); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBZFSBOOTENV_H */ Modified: vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/ccompile.h ============================================================================== --- vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/ccompile.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/ccompile.h Fri Sep 18 22:55:05 2020 (r365892) @@ -206,8 +206,10 @@ typedef int enum_t; #define __XSI_VISIBLE 1000 #endif #define ARRAY_SIZE(a) (sizeof (a) / sizeof (a[0])) -#define open64 open #define mmap64 mmap +/* Note: this file can be used on linux/macOS when bootstrapping tools. */ +#if defined(__FreeBSD__) +#define open64 open #define pwrite64 pwrite #define ftruncate64 ftruncate #define lseek64 lseek @@ -217,6 +219,7 @@ typedef int enum_t; #define statfs64 statfs #define readdir64 readdir #define dirent64 dirent +#endif #define P2ALIGN(x, align) ((x) & -(align)) #define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) #define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1) Modified: vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/condvar.h ============================================================================== --- vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/condvar.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/os/freebsd/spl/sys/condvar.h Fri Sep 18 22:55:05 2020 (r365892) @@ -142,8 +142,14 @@ cv_timedwait_sig(kcondvar_t *cvp, kmutex_t *mp, clock_ return (1); } -#define cv_timedwait_io cv_timedwait -#define cv_timedwait_sig_io cv_timedwait_sig +#define cv_timedwait_io cv_timedwait +#define cv_timedwait_idle cv_timedwait +#define cv_timedwait_sig_io cv_timedwait_sig +#define cv_wait_io cv_wait +#define cv_wait_io_sig cv_wait_sig +#define cv_wait_idle cv_wait +#define cv_timedwait_io_hires cv_timedwait_hires +#define cv_timedwait_idle_hires cv_timedwait_hires static inline int cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, 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 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/Makefile.am Fri Sep 18 22:55:05 2020 (r365892) @@ -2,6 +2,7 @@ KERNEL_H = \ freebsd_crypto.h \ sha2.h \ vdev_os.h \ + zfs_bootenv_os.h \ zfs_context_os.h \ zfs_ctldir.h \ zfs_dir.h \ Added: vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_bootenv_os.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_bootenv_os.h Fri Sep 18 22:55:05 2020 (r365892) @@ -0,0 +1,29 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2020 Toomas Soome + */ + +#ifndef _ZFS_BOOTENV_OS_H +#define _ZFS_BOOTENV_OS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define BOOTENV_OS BE_FREEBSD_VENDOR + +#ifdef __cplusplus +} +#endif + +#endif /* _ZFS_BOOTENV_OS_H */ Modified: vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_context_os.h ============================================================================== --- vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_context_os.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_context_os.h Fri Sep 18 22:55:05 2020 (r365892) @@ -41,9 +41,6 @@ #include #include -#define cv_wait_io(cv, mp) cv_wait(cv, mp) -#define cv_wait_io_sig(cv, mp) cv_wait_sig(cv, mp) - #define cond_resched() kern_yield(PRI_USER) #define taskq_create_sysdc(a, b, d, e, p, dc, f) \ @@ -75,7 +72,7 @@ extern struct mtx zfs_debug_mtx; } \ } while (0) -#define MSEC_TO_TICK(msec) ((msec) / (MILLISEC / hz)) +#define MSEC_TO_TICK(msec) (howmany((hrtime_t)(msec) * hz, MILLISEC)) extern int hz; extern int tick; typedef int fstrans_cookie_t; @@ -84,7 +81,6 @@ typedef int fstrans_cookie_t; #define signal_pending(x) SIGPENDING(x) #define current curthread #define thread_join(x) -#define cv_wait_io(cv, mp) cv_wait(cv, mp) typedef struct opensolaris_utsname utsname_t; extern utsname_t *utsname(void); extern int spa_import_rootpool(const char *name, bool checkpointrewind); Modified: vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_vfsops_os.h ============================================================================== --- vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Fri Sep 18 22:55:05 2020 (r365892) @@ -27,18 +27,31 @@ #ifndef _SYS_FS_ZFS_VFSOPS_H #define _SYS_FS_ZFS_VFSOPS_H +#if __FreeBSD_version >= 1300109 +#define TEARDOWN_INACTIVE_RMS +#endif + #include #include #include #include #include #include +#ifdef TEARDOWN_INACTIVE_RMS +#include +#endif #include #ifdef __cplusplus extern "C" { #endif +#ifdef TEARDOWN_INACTIVE_RMS +typedef struct rmslock zfs_teardown_lock_t; +#else +#define zfs_teardown_lock_t krwlock_t +#endif + typedef struct zfsvfs zfsvfs_t; struct znode; @@ -67,7 +80,7 @@ struct zfsvfs { boolean_t z_atime; /* enable atimes mount option */ boolean_t z_unmounted; /* unmounted */ rrmlock_t z_teardown_lock; - krwlock_t z_teardown_inactive_lock; + zfs_teardown_lock_t z_teardown_inactive_lock; list_t z_all_znodes; /* all vnodes in the fs */ uint64_t z_nr_znodes; /* number of znodes in the fs */ kmutex_t z_znodes_lock; /* lock for z_all_znodes */ @@ -97,6 +110,56 @@ struct zfsvfs { kmutex_t z_hold_mtx[ZFS_OBJ_MTX_SZ]; /* znode hold locks */ struct task z_unlinked_drain_task; }; + +#ifdef TEARDOWN_INACTIVE_RMS +#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \ + rms_init(&(zfsvfs)->z_teardown_inactive_lock, "zfs teardown inactive") + +#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \ + rms_destroy(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rms_try_rlock(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rms_rlock(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rms_runlock(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rms_wlock(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rms_wunlock(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \ + rms_wowned(&(zfsvfs)->z_teardown_inactive_lock) +#else +#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \ + rw_init(&(zfsvfs)->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL) + +#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \ + rw_destroy(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER) + +#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER) + +#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rw_exit(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER) + +#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ + rw_exit(&(zfsvfs)->z_teardown_inactive_lock) + +#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \ + RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock) +#endif #define ZSB_XATTR 0x0001 /* Enable user xattrs */ /* Modified: vendor-sys/openzfs/dist/include/os/linux/kernel/linux/mod_compat.h ============================================================================== --- vendor-sys/openzfs/dist/include/os/linux/kernel/linux/mod_compat.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/os/linux/kernel/linux/mod_compat.h Fri Sep 18 22:55:05 2020 (r365892) @@ -21,6 +21,7 @@ /* * Copyright (C) 2016 Gvozden Neskovic . + * Copyright (c) 2020 by Delphix. All rights reserved. */ #ifndef _MOD_COMPAT_H @@ -71,6 +72,7 @@ enum scope_prefix_types { zfs_txg, zfs_vdev, zfs_vdev_cache, + zfs_vdev_file, zfs_vdev_mirror, zfs_zevent, zfs_zio, Modified: vendor-sys/openzfs/dist/include/os/linux/spl/sys/condvar.h ============================================================================== --- vendor-sys/openzfs/dist/include/os/linux/spl/sys/condvar.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/os/linux/spl/sys/condvar.h Fri Sep 18 22:55:05 2020 (r365892) @@ -80,15 +80,19 @@ extern void __cv_init(kcondvar_t *, char *, kcv_type_t extern void __cv_destroy(kcondvar_t *); extern void __cv_wait(kcondvar_t *, kmutex_t *); extern void __cv_wait_io(kcondvar_t *, kmutex_t *); +extern void __cv_wait_idle(kcondvar_t *, kmutex_t *); extern int __cv_wait_io_sig(kcondvar_t *, kmutex_t *); extern int __cv_wait_sig(kcondvar_t *, kmutex_t *); extern int __cv_timedwait(kcondvar_t *, kmutex_t *, clock_t); extern int __cv_timedwait_io(kcondvar_t *, kmutex_t *, clock_t); extern int __cv_timedwait_sig(kcondvar_t *, kmutex_t *, clock_t); +extern int __cv_timedwait_idle(kcondvar_t *, kmutex_t *, clock_t); extern int cv_timedwait_hires(kcondvar_t *, kmutex_t *, hrtime_t, hrtime_t res, int flag); extern int cv_timedwait_sig_hires(kcondvar_t *, kmutex_t *, hrtime_t, hrtime_t res, int flag); +extern int cv_timedwait_idle_hires(kcondvar_t *, kmutex_t *, hrtime_t, + hrtime_t res, int flag); extern void __cv_signal(kcondvar_t *); extern void __cv_broadcast(kcondvar_t *c); @@ -96,6 +100,7 @@ extern void __cv_broadcast(kcondvar_t *c); #define cv_destroy(cvp) __cv_destroy(cvp) #define cv_wait(cvp, mp) __cv_wait(cvp, mp) #define cv_wait_io(cvp, mp) __cv_wait_io(cvp, mp) +#define cv_wait_idle(cvp, mp) __cv_wait_idle(cvp, mp) #define cv_wait_io_sig(cvp, mp) __cv_wait_io_sig(cvp, mp) #define cv_wait_sig(cvp, mp) __cv_wait_sig(cvp, mp) #define cv_signal(cvp) __cv_signal(cvp) @@ -109,5 +114,7 @@ extern void __cv_broadcast(kcondvar_t *c); #define cv_timedwait(cvp, mp, t) __cv_timedwait(cvp, mp, t) #define cv_timedwait_io(cvp, mp, t) __cv_timedwait_io(cvp, mp, t) #define cv_timedwait_sig(cvp, mp, t) __cv_timedwait_sig(cvp, mp, t) +#define cv_timedwait_idle(cvp, mp, t) __cv_timedwait_idle(cvp, mp, t) + #endif /* _SPL_CONDVAR_H */ 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 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/os/linux/zfs/sys/Makefile.am Fri Sep 18 22:55:05 2020 (r365892) @@ -16,6 +16,7 @@ KERNEL_H = \ trace_zil.h \ trace_zio.h \ trace_zrlock.h \ + zfs_bootenv_os.h \ zfs_context_os.h \ zfs_ctldir.h \ zfs_dir.h \ Added: vendor-sys/openzfs/dist/include/os/linux/zfs/sys/zfs_bootenv_os.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/openzfs/dist/include/os/linux/zfs/sys/zfs_bootenv_os.h Fri Sep 18 22:55:05 2020 (r365892) @@ -0,0 +1,29 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2020 Toomas Soome + */ + +#ifndef _ZFS_BOOTENV_OS_H +#define _ZFS_BOOTENV_OS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define BOOTENV_OS BE_LINUX_VENDOR + +#ifdef __cplusplus +} +#endif + +#endif /* _ZFS_BOOTENV_OS_H */ Modified: vendor-sys/openzfs/dist/include/sys/Makefile.am ============================================================================== --- vendor-sys/openzfs/dist/include/sys/Makefile.am Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/Makefile.am Fri Sep 18 22:55:05 2020 (r365892) @@ -102,6 +102,7 @@ COMMON_H = \ zcp_set.h \ zfeature.h \ zfs_acl.h \ + zfs_bootenv.h \ zfs_context.h \ zfs_debug.h \ zfs_delay.h \ Modified: vendor-sys/openzfs/dist/include/sys/dsl_synctask.h ============================================================================== --- vendor-sys/openzfs/dist/include/sys/dsl_synctask.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/dsl_synctask.h Fri Sep 18 22:55:05 2020 (r365892) @@ -112,11 +112,11 @@ void dsl_sync_task_sync(dsl_sync_task_t *, dmu_tx_t *) int dsl_sync_task(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, void *, int, zfs_space_check_t); void dsl_sync_task_nowait(struct dsl_pool *, dsl_syncfunc_t *, - void *, int, zfs_space_check_t, dmu_tx_t *); + void *, dmu_tx_t *); int dsl_early_sync_task(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, void *, int, zfs_space_check_t); void dsl_early_sync_task_nowait(struct dsl_pool *, dsl_syncfunc_t *, - void *, int, zfs_space_check_t, dmu_tx_t *); + void *, dmu_tx_t *); int dsl_sync_task_sig(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, dsl_sigfunc_t *, void *, int, zfs_space_check_t); Modified: vendor-sys/openzfs/dist/include/sys/fm/fs/zfs.h ============================================================================== --- vendor-sys/openzfs/dist/include/sys/fm/fs/zfs.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/fm/fs/zfs.h Fri Sep 18 22:55:05 2020 (r365892) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2020 by Delphix. All rights reserved. + */ + #ifndef _SYS_FM_FS_ZFS_H #define _SYS_FM_FS_ZFS_H @@ -88,6 +92,7 @@ extern "C" { #define FM_EREPORT_PAYLOAD_ZFS_ZIO_SIZE "zio_size" #define FM_EREPORT_PAYLOAD_ZFS_ZIO_FLAGS "zio_flags" #define FM_EREPORT_PAYLOAD_ZFS_ZIO_STAGE "zio_stage" +#define FM_EREPORT_PAYLOAD_ZFS_ZIO_PRIORITY "zio_priority" #define FM_EREPORT_PAYLOAD_ZFS_ZIO_PIPELINE "zio_pipeline" #define FM_EREPORT_PAYLOAD_ZFS_ZIO_DELAY "zio_delay" #define FM_EREPORT_PAYLOAD_ZFS_ZIO_TIMESTAMP "zio_timestamp" Modified: vendor-sys/openzfs/dist/include/sys/fm/util.h ============================================================================== --- vendor-sys/openzfs/dist/include/sys/fm/util.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/fm/util.h Fri Sep 18 22:55:05 2020 (r365892) @@ -104,6 +104,9 @@ extern int zfs_zevent_seek(zfs_zevent_t *, uint64_t); extern void zfs_zevent_init(zfs_zevent_t **); extern void zfs_zevent_destroy(zfs_zevent_t *); +extern void zfs_zevent_track_duplicate(void); +extern void zfs_ereport_init(void); +extern void zfs_ereport_fini(void); #else static inline void fm_init(void) { } Modified: vendor-sys/openzfs/dist/include/sys/fs/zfs.h ============================================================================== --- vendor-sys/openzfs/dist/include/sys/fs/zfs.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/fs/zfs.h Fri Sep 18 22:55:05 2020 (r365892) @@ -1336,8 +1336,8 @@ typedef enum zfs_ioc { ZFS_IOC_NEXTBOOT, /* 0x84 (FreeBSD) */ ZFS_IOC_JAIL, /* 0x85 (FreeBSD) */ ZFS_IOC_UNJAIL, /* 0x86 (FreeBSD) */ - ZFS_IOC_SET_BOOTENV, /* 0x87 (Linux) */ - ZFS_IOC_GET_BOOTENV, /* 0x88 (Linux) */ + ZFS_IOC_SET_BOOTENV, /* 0x87 */ + ZFS_IOC_GET_BOOTENV, /* 0x88 */ ZFS_IOC_LAST } zfs_ioc_t; Modified: vendor-sys/openzfs/dist/include/sys/spa.h ============================================================================== --- vendor-sys/openzfs/dist/include/sys/spa.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/spa.h Fri Sep 18 22:55:05 2020 (r365892) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2019 by Delphix. All rights reserved. + * Copyright (c) 2011, 2020 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. @@ -1145,10 +1145,10 @@ extern const char *spa_state_to_name(spa_t *spa); struct zbookmark_phys; extern void spa_log_error(spa_t *spa, const zbookmark_phys_t *zb); extern int zfs_ereport_post(const char *clazz, spa_t *spa, vdev_t *vd, - const zbookmark_phys_t *zb, zio_t *zio, uint64_t stateoroffset, - uint64_t length); + const zbookmark_phys_t *zb, zio_t *zio, uint64_t state); extern boolean_t zfs_ereport_is_valid(const char *clazz, spa_t *spa, vdev_t *vd, zio_t *zio); +extern void zfs_ereport_taskq_fini(void); extern nvlist_t *zfs_event_create(spa_t *spa, vdev_t *vd, const char *type, const char *name, nvlist_t *aux); extern void zfs_post_remove(spa_t *spa, vdev_t *vd); Modified: vendor-sys/openzfs/dist/include/sys/vdev.h ============================================================================== --- vendor-sys/openzfs/dist/include/sys/vdev.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/vdev.h Fri Sep 18 22:55:05 2020 (r365892) @@ -94,7 +94,6 @@ extern void vdev_rele(vdev_t *); extern int vdev_metaslab_init(vdev_t *vd, uint64_t txg); extern void vdev_metaslab_fini(vdev_t *vd); extern void vdev_metaslab_set_size(vdev_t *); -extern void vdev_ashift_optimize(vdev_t *); extern void vdev_expand(vdev_t *vd, uint64_t txg); extern void vdev_split(vdev_t *vd); extern void vdev_deadman(vdev_t *vd, char *tag); @@ -181,7 +180,7 @@ extern void vdev_config_generate_stats(vdev_t *vd, nvl extern void vdev_label_write(zio_t *zio, vdev_t *vd, int l, abd_t *buf, uint64_t offset, uint64_t size, zio_done_func_t *done, void *priv, int flags); extern int vdev_label_read_bootenv(vdev_t *, nvlist_t *); -extern int vdev_label_write_bootenv(vdev_t *, char *); +extern int vdev_label_write_bootenv(vdev_t *, nvlist_t *); typedef enum { VDEV_LABEL_CREATE, /* create/add a new device */ Modified: vendor-sys/openzfs/dist/include/sys/vdev_impl.h ============================================================================== --- vendor-sys/openzfs/dist/include/sys/vdev_impl.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/vdev_impl.h Fri Sep 18 22:55:05 2020 (r365892) @@ -476,7 +476,16 @@ typedef struct vdev_phys { } vdev_phys_t; typedef enum vbe_vers { - /* The bootenv file is stored as ascii text in the envblock */ + /* + * The bootenv file is stored as ascii text in the envblock. + * It is used by the GRUB bootloader used on Linux to store the + * contents of the grubenv file. The file is stored as raw ASCII, + * and is protected by an embedded checksum. By default, GRUB will + * check if the boot filesystem supports storing the environment data + * in a special location, and if so, will invoke filesystem specific + * logic to retrieve it. This can be overriden by a variable, should + * the user so desire. + */ VB_RAW = 0, /* Added: vendor-sys/openzfs/dist/include/sys/zfs_bootenv.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/openzfs/dist/include/sys/zfs_bootenv.h Fri Sep 18 22:55:05 2020 (r365892) @@ -0,0 +1,53 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2020 Toomas Soome + */ + +#ifndef _ZFS_BOOTENV_H +#define _ZFS_BOOTENV_H + +/* + * Define macros for label bootenv nvlist pair keys. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define BOOTENV_VERSION "version" + +#define BE_ILLUMOS_VENDOR "illumos" +#define BE_FREEBSD_VENDOR "freebsd" +#define BE_GRUB_VENDOR "grub" +#define BE_LINUX_VENDOR "linux" + +#include + +#define GRUB_ENVMAP BE_GRUB_VENDOR ":" "envmap" + +#define FREEBSD_BOOTONCE BE_FREEBSD_VENDOR ":" "bootonce" +#define FREEBSD_BOOTONCE_USED BE_FREEBSD_VENDOR ":" "bootonce-used" +#define FREEBSD_NVSTORE BE_FREEBSD_VENDOR ":" "nvstore" +#define ILLUMOS_BOOTONCE BE_ILLUMOS_VENDOR ":" "bootonce" +#define ILLUMOS_BOOTONCE_USED BE_ILLUMOS_VENDOR ":" "bootonce-used" +#define ILLUMOS_NVSTORE BE_ILLUMOS_VENDOR ":" "nvstore" + +#define OS_BOOTONCE BOOTENV_OS ":" "bootonce" +#define OS_BOOTONCE_USED BOOTENV_OS ":" "bootonce-used" +#define OS_NVSTORE BOOTENV_OS ":" "nvstore" + +#ifdef __cplusplus +} +#endif + +#endif /* _ZFS_BOOTENV_H */ Modified: vendor-sys/openzfs/dist/include/sys/zfs_context.h ============================================================================== --- vendor-sys/openzfs/dist/include/sys/zfs_context.h Fri Sep 18 22:24:51 2020 (r365891) +++ vendor-sys/openzfs/dist/include/sys/zfs_context.h Fri Sep 18 22:55:05 2020 (r365892) @@ -325,11 +325,15 @@ extern void cv_signal(kcondvar_t *cv); extern void cv_broadcast(kcondvar_t *cv); #define cv_timedwait_io(cv, mp, at) cv_timedwait(cv, mp, at) +#define cv_timedwait_idle(cv, mp, at) cv_timedwait(cv, mp, at) #define cv_timedwait_sig(cv, mp, at) cv_timedwait(cv, mp, at) #define cv_wait_io(cv, mp) cv_wait(cv, mp) +#define cv_wait_idle(cv, mp) cv_wait(cv, mp) #define cv_wait_io_sig(cv, mp) cv_wait_sig(cv, mp) #define cv_timedwait_sig_hires(cv, mp, t, r, f) \ cv_timedwait_hires(cv, mp, t, r, f) +#define cv_timedwait_idle_hires(cv, mp, t, r, f) \ + cv_timedwait_hires(cv, mp, t, r, f) /* * Thread-specific data @@ -598,9 +602,9 @@ typedef struct vsecattr { extern void delay(clock_t ticks); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***