From 5fc332ae4b723a39cffca9386bc40a3a5398924e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 6 Apr 2022 00:15:45 +0200 Subject: [PATCH 001/119] Makefile: zfs-tests lives in srcdir; zfs-tests: accept common.sh path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes out-of-tree builds Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 3 +-- scripts/zfs-tests.sh | 9 ++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index acfd83beccc8..81b3e69eb8f2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -75,8 +75,7 @@ distclean-local:: -type f -delete all-local: - -[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \ - ${top_builddir}/scripts/zfs-tests.sh -c + -SCRIPT_COMMON=$(top_builddir)/scripts/common.sh $(top_srcdir)/scripts/zfs-tests.sh -c dist-hook: $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV) diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh index e7d04110e394..df69325a1be1 100755 --- a/scripts/zfs-tests.sh +++ b/scripts/zfs-tests.sh @@ -26,13 +26,8 @@ # Copyright 2020 OmniOS Community Edition (OmniOSce) Association. # -BASE_DIR=$(dirname "$0") -SCRIPT_COMMON=common.sh -if [ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]; then - . "${BASE_DIR}/${SCRIPT_COMMON}" -else - echo "Missing helper script ${SCRIPT_COMMON}" && exit 1 -fi +SCRIPT_COMMON=${SCRIPT_COMMON:-${0%/*}/common.sh} +. "${SCRIPT_COMMON}" || exit PROG=zfs-tests.sh VERBOSE="no" From ea532b0e6ee61370ad552533016c48c858240671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 6 Apr 2022 00:20:16 +0200 Subject: [PATCH 002/119] Remove compat spl-x.y.z from the distribution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was added in 93ce2b4ca5a40c41ac945cd3aaf4a4a22bb751e1 ("Update build system and packaging"), which merged the SPL and ZFS trees, and included in 0.8.0; "the next major release" was 2.0.0 Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 19 ------------------- rpm/redhat/zfs-kmod.spec.in | 1 - scripts/kmodtool | 9 --------- 3 files changed, 29 deletions(-) diff --git a/Makefile.am b/Makefile.am index 81b3e69eb8f2..8734431da818 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,25 +82,6 @@ dist-hook: $(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release: $(RELEASE)/' \ $(distdir)/META -if BUILD_LINUX -# For compatibility, create a matching spl-x.y.z directly which contains -# symlinks to the updated header and object file locations. These -# compatibility links will be removed in the next major release. -if CONFIG_KERNEL -install-data-hook: - rm -rf $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \ - mkdir $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \ - cd $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \ - ln -s ../zfs-$(VERSION)/include/spl include && \ - ln -s ../zfs-$(VERSION)/$(LINUX_VERSION) $(LINUX_VERSION) && \ - ln -s ../zfs-$(VERSION)/zfs_config.h.in spl_config.h.in && \ - ln -s ../zfs-$(VERSION)/zfs.release.in spl.release.in && \ - cd $(DESTDIR)$(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) && \ - ln -fs zfs_config.h spl_config.h && \ - ln -fs zfs.release spl.release -endif -endif - PHONY += codecheck codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck zstdcheck diff --git a/rpm/redhat/zfs-kmod.spec.in b/rpm/redhat/zfs-kmod.spec.in index 2cb0623aa06f..7ee04e2340c6 100644 --- a/rpm/redhat/zfs-kmod.spec.in +++ b/rpm/redhat/zfs-kmod.spec.in @@ -89,4 +89,3 @@ rm -rf $RPM_BUILD_ROOT %files -n kmod-%{kmod_name}-devel %{_usrsrc}/%{kmod_name}-%{version} -%{_usrsrc}/spl-%{version} diff --git a/scripts/kmodtool b/scripts/kmodtool index afbb6ab3b03c..f66341196acb 100755 --- a/scripts/kmodtool +++ b/scripts/kmodtool @@ -263,16 +263,10 @@ the ${kmodname}-devel- objects for the newest kernel. %defattr(644,root,root,755) %{_usrsrc}/${kmodname}-%{version} EOF - if [ -n "${obsolete_name}" ]; then - echo "%{_usrsrc}/${obsolete_name}-%{version}" - fi for kernel in ${1}; do local kernel_uname_r=${kernel} echo "%exclude %{_usrsrc}/${kmodname}-%{version}/${kernel_uname_r}" - if [ -n "${obsolete_name}" ]; then - echo "%exclude %{_usrsrc}/${obsolete_name}-%{version}/${kernel_uname_r}" - fi done echo @@ -328,9 +322,6 @@ kernel ${kernel_uname_r} for the %{_target_cpu} family of processors. %defattr(644,root,root,755) %{_usrsrc}/${kmodname}-%{version}/${kernel_uname_r} EOF - if [ -n "${obsolete_name}" ]; then - echo "%{_usrsrc}/${obsolete_name}-%{version}/${kernel_uname_r}" - fi } print_rpmtemplate_kmodmetapkg () From c6f923fba4bebce43ee414c1e8a7dda91f9fe2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 6 Apr 2022 00:36:09 +0200 Subject: [PATCH 003/119] autogen.sh: explicitly build its containing directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No changes in currently-accepted usages (no-argument), but allows /src/path/autogen.sh && /src/path/configure for simpler out-of-tree builds Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- autogen.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/autogen.sh b/autogen.sh index 488e913b2bf4..f56cd68be3ac 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,2 @@ #!/bin/sh - -autoreconf -fiv || exit 1 -rm -Rf autom4te.cache +autoreconf -fiv "$(dirname "$0")" && rm -rf "$(dirname "$0")"/autom4te.cache From 841fd303b852e241b347490748184cc5aeea8b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 6 Apr 2022 01:34:25 +0200 Subject: [PATCH 004/119] copy-builtin: add hooks with sed/>> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The order in fs/Makefile doesn't matter, the order in fs/Kconfig is preserved (ext2 is included as the first thing in the first if BUILD block, and only once), but I don't think it matters much either, realistically Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- copy-builtin | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/copy-builtin b/copy-builtin index cd6f259092ed..18cc741b58e7 100755 --- a/copy-builtin +++ b/copy-builtin @@ -43,32 +43,8 @@ config ZFS If unsure, say N. EOF -add_after() -{ - FILE="$1" - MARKER="$2" - NEW="$3" - - while IFS='' read -r LINE - do - printf "%s\n" "$LINE" - - if [ -n "$MARKER" ] && [ "$LINE" = "$MARKER" ] - then - printf "%s\n" "$NEW" - MARKER='' - if IFS='' read -r LINE - then - [ "$LINE" != "$NEW" ] && printf "%s\n" "$LINE" - fi - fi - done < "$FILE" > "$FILE.new" - - mv "$FILE.new" "$FILE" -} - -add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"' -add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/' +sed -i '/source "fs\/ext2\/Kconfig\"/i\source "fs/zfs/Kconfig"' "$KERNEL_DIR/fs/Kconfig" +echo 'obj-$(CONFIG_ZFS) += zfs/' >> "$KERNEL_DIR/fs/Makefile" echo "$0: done. now you can build the kernel with ZFS support." >&2 echo "$0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2 From 0fb1bf6586dc1d24d384d64cc2b32afb9e165332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 6 Apr 2022 03:12:33 +0200 Subject: [PATCH 005/119] libspl: include: remove [util/]sscanf.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unused, empty, installs in a weird location Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- configure.ac | 1 - lib/libspl/include/Makefile.am | 2 +- lib/libspl/include/util/Makefile.am | 3 --- lib/libspl/include/util/sscanf.h | 30 ----------------------------- 4 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 lib/libspl/include/util/Makefile.am delete mode 100644 lib/libspl/include/util/sscanf.h diff --git a/configure.ac b/configure.ac index 5240a4959105..26cdc8c67f0b 100644 --- a/configure.ac +++ b/configure.ac @@ -155,7 +155,6 @@ AC_CONFIG_FILES([ lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/dktp/Makefile - lib/libspl/include/util/Makefile lib/libtpool/Makefile lib/libunicode/Makefile lib/libuutil/Makefile diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index 20996366030c..601fbb77f663 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = rpc sys util os +SUBDIRS = rpc sys os libspldir = $(includedir)/libspl libspl_HEADERS = \ diff --git a/lib/libspl/include/util/Makefile.am b/lib/libspl/include/util/Makefile.am deleted file mode 100644 index ab553bc80313..000000000000 --- a/lib/libspl/include/util/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -libspldir = $(includedir)/libspl -libspl_HEADERS = \ - sscanf.h diff --git a/lib/libspl/include/util/sscanf.h b/lib/libspl/include/util/sscanf.h deleted file mode 100644 index ead36acaba3e..000000000000 --- a/lib/libspl/include/util/sscanf.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_UTIL_SSCANF_H -#define _LIBSPL_UTIL_SSCANF_H - -#endif From ae43120abc7f8ac952530c48d413d4dc89ab94cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 7 Apr 2022 00:41:46 +0200 Subject: [PATCH 006/119] config: user: drop ZONENAME, avoid lying about being Linux-only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- config/user.m4 | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/config/user.m4 b/config/user.m4 index f450af47e04d..a7241f44f1fd 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -30,19 +30,8 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [ ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV ZFS_AC_CONFIG_USER_ZFSEXEC - ZFS_AC_TEST_FRAMEWORK AC_CHECK_FUNCS([issetugid mlockall strlcat strlcpy]) -]) - -dnl # -dnl # Setup the environment for the ZFS Test Suite. Currently only -dnl # Linux style systems are supported but this infrastructure can -dnl # be extended to support other platforms if needed. -dnl # -AC_DEFUN([ZFS_AC_TEST_FRAMEWORK], [ - ZONENAME="echo global" - AC_SUBST(ZONENAME) AC_SUBST(RM) ]) From be91239efaec7729d4eac334f94395aeb4699092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 7 Apr 2022 02:22:37 +0200 Subject: [PATCH 007/119] module: Makefile: cppcheck: zfs_config.h lives in builddir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- module/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/Makefile.in b/module/Makefile.in index ea83ba127d46..e6ca94b92c1d 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -126,7 +126,7 @@ cppcheck-Linux: --suppress=noValidConfiguration \ --enable=warning,information -D_KERNEL \ --include=@LINUX_OBJ@/include/generated/autoconf.h \ - --include=@top_srcdir@/zfs_config.h \ + --include=@top_builddir@/zfs_config.h \ --config-exclude=@LINUX_OBJ@/include \ -i zstd/lib \ -I @LINUX_OBJ@/include \ From 6fc34371e1df4d74dee6e50ffd9d9fae234b55ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 7 Apr 2022 22:49:22 +0200 Subject: [PATCH 008/119] libzfs: pool: fix false-positives -Wmaybe-uninitialised MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As noted by gcc (Debian 10.2.1-6) 10.2.1 20210110 Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- lib/libzfs/libzfs_pool.c | 4 ++-- module/icp/algs/edonr/edonr.c | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index cd7062a88c86..83fab043366a 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -5184,7 +5184,7 @@ zpool_get_vdev_prop(zpool_handle_t *zhp, const char *vdevname, vdev_prop_t prop, { nvlist_t *reqnvl, *reqprops; nvlist_t *retprops = NULL; - uint64_t vdev_guid; + uint64_t vdev_guid = 0; int ret; if ((ret = zpool_vdev_guid(zhp, vdevname, &vdev_guid)) != 0) @@ -5243,7 +5243,7 @@ zpool_get_all_vdev_props(zpool_handle_t *zhp, const char *vdevname, nvlist_t **outnvl) { nvlist_t *nvl = NULL; - uint64_t vdev_guid; + uint64_t vdev_guid = 0; int ret; if ((ret = zpool_vdev_guid(zhp, vdevname, &vdev_guid)) != 0) diff --git a/module/icp/algs/edonr/edonr.c b/module/icp/algs/edonr/edonr.c index 6f3a43e263be..9388a6f6b7c9 100644 --- a/module/icp/algs/edonr/edonr.c +++ b/module/icp/algs/edonr/edonr.c @@ -47,10 +47,7 @@ #define hashState384(x) ((x)->pipe->p512) #define hashState512(x) ((x)->pipe->p512) -/* shift and rotate shortcuts */ -#define shl(x, n) ((x) << n) -#define shr(x, n) ((x) >> n) - +/* rotate shortcuts */ #define rotl32(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) #define rotr32(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) From c8970f52ed53ed62262b6246c7f791018ee96d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 8 Apr 2022 01:07:08 +0200 Subject: [PATCH 009/119] autoconf: use include directives instead of recursing down lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a bonus, this also adds zfs-mount-generator (previously undescended down) and libzstd (not included) to CppCheck As a bonus bonus, abigail rules work out-of-tree, too Against current trunk: $ diff -U0 ./destdir.listing ~/store/code/zfs/destdir.listing -destdir/usr/local/include/libspl/sscanf.h $ diff --color -U0 ./zfs-2.1.99.tar.gz.listing ../oot/zfs-2.1.99.tar.gz.listing | grep -v @@ | grep -v /Makefile -zfs-2.1.99/config/Abigail.am -zfs-2.1.99/lib/libspl/include/util/ -zfs-2.1.99/lib/libspl/include/util/sscanf.h $ diff --color -U0 ./zfs-2.1.99.tar.gz.listing ../oot/zfs-2.1.99.tar.gz.listing | grep -v @@ | grep /Makefile -zfs-2.1.99/lib/libavl/Makefile.in -zfs-2.1.99/lib/libefi/Makefile.in -zfs-2.1.99/lib/libicp/Makefile.in -zfs-2.1.99/lib/libnvpair/Makefile.in -zfs-2.1.99/lib/libshare/Makefile.in -zfs-2.1.99/lib/libspl/include/Makefile.in -zfs-2.1.99/lib/libspl/include/os/freebsd/Makefile.am -zfs-2.1.99/lib/libspl/include/os/freebsd/Makefile.in -zfs-2.1.99/lib/libspl/include/os/freebsd/sys/Makefile.am -zfs-2.1.99/lib/libspl/include/os/freebsd/sys/Makefile.in -zfs-2.1.99/lib/libspl/include/os/linux/Makefile.am -zfs-2.1.99/lib/libspl/include/os/linux/Makefile.in -zfs-2.1.99/lib/libspl/include/os/linux/sys/Makefile.am -zfs-2.1.99/lib/libspl/include/os/linux/sys/Makefile.in -zfs-2.1.99/lib/libspl/include/os/Makefile.am -zfs-2.1.99/lib/libspl/include/os/Makefile.in -zfs-2.1.99/lib/libspl/include/rpc/Makefile.am -zfs-2.1.99/lib/libspl/include/rpc/Makefile.in -zfs-2.1.99/lib/libspl/include/sys/dktp/Makefile.am -zfs-2.1.99/lib/libspl/include/sys/dktp/Makefile.in -zfs-2.1.99/lib/libspl/include/sys/Makefile.am -zfs-2.1.99/lib/libspl/include/sys/Makefile.in -zfs-2.1.99/lib/libspl/include/util/Makefile.am -zfs-2.1.99/lib/libspl/include/util/Makefile.in -zfs-2.1.99/lib/libspl/Makefile.in -zfs-2.1.99/lib/libtpool/Makefile.in -zfs-2.1.99/lib/libunicode/Makefile.in -zfs-2.1.99/lib/libuutil/Makefile.in -zfs-2.1.99/lib/libzfsbootenv/Makefile.in -zfs-2.1.99/lib/libzfs_core/Makefile.in -zfs-2.1.99/lib/libzfs/Makefile.in -zfs-2.1.99/lib/libzpool/Makefile.in -zfs-2.1.99/lib/libzstd/Makefile.in -zfs-2.1.99/lib/libzutil/Makefile.in -zfs-2.1.99/lib/Makefile.in Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- .github/workflows/checkstyle.yaml | 4 +- Makefile.am | 37 +- cmd/Makefile.am | 10 +- cmd/mount_zfs/Makefile.am | 7 +- cmd/raidz_test/Makefile.am | 12 +- cmd/zdb/Makefile.am | 10 +- cmd/zed/Makefile.am | 9 +- cmd/zfs/Makefile.am | 9 +- cmd/zfs_ids_to_path/Makefile.am | 3 +- cmd/zgenhostid/Makefile.am | 1 + cmd/zhack/Makefile.am | 10 +- cmd/zinject/Makefile.am | 7 +- cmd/zpool/Makefile.am | 13 +- cmd/zpool_influxdb/Makefile.am | 7 +- cmd/zstream/Makefile.am | 7 +- cmd/ztest/Makefile.am | 15 +- cmd/zvol_id/Makefile.am | 1 + cmd/zvol_wait/Makefile.am | 1 - config/Abigail.am | 52 --- config/CppCheck.am | 14 +- config/Rules.am | 58 ++- config/always-cppcheck.m4 | 3 + config/always-system.m4 | 4 + configure.ac | 31 +- contrib/pam_zfs_key/Makefile.am | 10 +- etc/systemd/Makefile.am | 3 - etc/systemd/system-generators/Makefile.am | 3 +- lib/Makefile.am | 105 +++-- lib/libavl/Makefile.am | 21 +- lib/libefi/Makefile.am | 20 +- lib/libicp/Makefile.am | 110 ++--- lib/libnvpair/Makefile.am | 49 +-- lib/libshare/Makefile.am | 41 +- lib/libspl/Makefile.am | 65 ++- lib/libspl/include/Makefile.am | 126 +++++- lib/libspl/include/os/Makefile.am | 7 - lib/libspl/include/os/freebsd/Makefile.am | 5 - lib/libspl/include/os/freebsd/sys/Makefile.am | 12 - lib/libspl/include/os/linux/Makefile.am | 1 - lib/libspl/include/os/linux/sys/Makefile.am | 10 - lib/libspl/include/rpc/Makefile.am | 3 - lib/libspl/include/sys/Makefile.am | 47 -- lib/libspl/include/sys/dktp/Makefile.am | 4 - lib/libtpool/Makefile.am | 24 +- lib/libunicode/Makefile.am | 22 +- lib/libuutil/Makefile.am | 37 +- lib/libzfs/Makefile.am | 124 +++--- lib/libzfs_core/Makefile.am | 45 +- lib/libzfsbootenv/Makefile.am | 40 +- lib/libzpool/Makefile.am | 403 ++++++++---------- lib/libzstd/Makefile.am | 73 ++-- lib/libzutil/Makefile.am | 53 ++- module/Makefile.in | 23 +- scripts/Makefile.am | 2 +- scripts/zfs-helpers.sh | 6 +- tests/zfs-tests/cmd/Makefile.am | 47 +- .../tests/functional/hkdf/Makefile.am | 2 +- .../tests/functional/libzfs/Makefile.am | 2 +- 58 files changed, 831 insertions(+), 1039 deletions(-) delete mode 100644 config/Abigail.am delete mode 100644 lib/libspl/include/os/Makefile.am delete mode 100644 lib/libspl/include/os/freebsd/Makefile.am delete mode 100644 lib/libspl/include/os/freebsd/sys/Makefile.am delete mode 100644 lib/libspl/include/os/linux/Makefile.am delete mode 100644 lib/libspl/include/os/linux/sys/Makefile.am delete mode 100644 lib/libspl/include/rpc/Makefile.am delete mode 100644 lib/libspl/include/sys/Makefile.am delete mode 100644 lib/libspl/include/sys/dktp/Makefile.am diff --git a/.github/workflows/checkstyle.yaml b/.github/workflows/checkstyle.yaml index abc0ff11916a..8dafdcf07fed 100644 --- a/.github/workflows/checkstyle.yaml +++ b/.github/workflows/checkstyle.yaml @@ -40,11 +40,11 @@ jobs: - name: CheckABI id: CheckABI run: | - docker run -v $(pwd):/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent checkabi + docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent checkabi - name: StoreABI if: failure() && steps.CheckABI.outcome == 'failure' run: | - docker run -v $(pwd):/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent storeabi + docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent storeabi - name: Prepare artifacts if: failure() && steps.CheckABI.outcome == 'failure' run: | diff --git a/Makefile.am b/Makefile.am index 8734431da818..24236cfe46c1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ include $(top_srcdir)/config/Shellcheck.am +include $(top_srcdir)/config/Rules.am +include $(top_srcdir)/config/CppCheck.am ACLOCAL_AMFLAGS = -I config @@ -7,26 +9,24 @@ if BUILD_LINUX SUBDIRS += rpm endif +EXTRA_DIST = +CPPCHECKDIRS += cmd etc/systemd/system-generators if CONFIG_USER -SUBDIRS += man scripts lib tests cmd etc contrib +SUBDIRS += scripts . man tests cmd etc contrib +include $(srcdir)/%D%/lib/Makefile.am if BUILD_LINUX SUBDIRS += udev endif endif +CPPCHECKDIRS += module if CONFIG_KERNEL SUBDIRS += module extradir = $(prefix)/src/zfs-$(VERSION) extra_HEADERS = zfs.release.in zfs_config.h.in - -if BUILD_LINUX -kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) -nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS) -endif endif -AUTOMAKE_OPTIONS = foreign -EXTRA_DIST = autogen.sh copy-builtin +EXTRA_DIST += autogen.sh copy-builtin EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am EXTRA_DIST += AUTHORS CODE_OF_CONDUCT.md COPYRIGHT LICENSE META NEWS NOTICE EXTRA_DIST += README.md RELEASES.md @@ -52,7 +52,7 @@ EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip GITREV = include/zfs_gitrev.h -PHONY = gitrev +PHONY += gitrev gitrev: $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV) @@ -117,14 +117,6 @@ filter_executable = -exec test -x '{}' \; -print SHELLCHECKDIRS = cmd contrib etc scripts tests SHELLCHECKSCRIPTS = autogen.sh -PHONY += checkabi storeabi - -checkabi: lib - $(MAKE) -C lib checkabi - -storeabi: lib - $(MAKE) -C lib storeabi - PHONY += mancheck mancheck: ${top_srcdir}/scripts/mancheck.sh ${top_srcdir}/man ${top_srcdir}/tests/test-runner/man @@ -152,17 +144,6 @@ zstdcheck: PHONY += lint lint: cppcheck paxcheck -CPPCHECKDIRS = cmd lib module -PHONY += cppcheck -cppcheck: $(CPPCHECKDIRS) - @if test -n "$(CPPCHECK)"; then \ - set -e ; for dir in $(CPPCHECKDIRS) ; do \ - $(MAKE) -C $$dir cppcheck ; \ - done \ - else \ - echo "skipping cppcheck because cppcheck is not installed"; \ - fi - PHONY += paxcheck paxcheck: @if type scanelf > /dev/null 2>&1; then \ diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 68f1e892d3f4..fbdeaee6253f 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -1,10 +1,12 @@ +PHONY = include $(top_srcdir)/config/Shellcheck.am +include $(top_srcdir)/config/CppCheck.am SUBDIRS = zfs zpool zdb zhack zinject zstream ztest SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path SUBDIRS += zpool_influxdb -CPPCHECKDIRS = zfs zpool zdb zhack zinject zstream ztest +CPPCHECKDIRS += zfs zpool zdb zhack zinject zstream ztest CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb # TODO: #12084: SHELLCHECKDIRS += vdev_id @@ -19,9 +21,3 @@ SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id SHELLCHECKDIRS += zed endif - -PHONY = cppcheck -cppcheck: $(CPPCHECKDIRS) - set -e ; for dir in $(CPPCHECKDIRS) ; do \ - $(MAKE) -C $$dir cppcheck ; \ - done diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am index 3957602d27ad..a1f902c1cecb 100644 --- a/cmd/mount_zfs/Makefile.am +++ b/cmd/mount_zfs/Makefile.am @@ -13,10 +13,11 @@ mount_zfs_SOURCES = \ mount_zfs.c mount_zfs_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la mount_zfs_LDADD += $(LTLIBINTL) include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += mount.zfs diff --git a/cmd/raidz_test/Makefile.am b/cmd/raidz_test/Makefile.am index 983ff25dc92a..86ac3cc945cb 100644 --- a/cmd/raidz_test/Makefile.am +++ b/cmd/raidz_test/Makefile.am @@ -1,10 +1,7 @@ include $(top_srcdir)/config/Rules.am -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -# Unconditionally enable ASSERTs -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +AM_CFLAGS += $(KERNEL_CFLAGS) +AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) bin_PROGRAMS = raidz_test @@ -14,9 +11,10 @@ raidz_test_SOURCES = \ raidz_bench.c raidz_test_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la raidz_test_LDADD += -lm include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += raidz_test diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am index c5858c298053..032132bc6392 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/config/Rules.am -# Unconditionally enable debugging for zdb -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) sbin_PROGRAMS = zdb @@ -11,8 +10,9 @@ zdb_SOURCES = \ zdb.h zdb_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zdb diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index 7b662994d1c6..b509516f9066 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -40,10 +40,10 @@ FMA_SRC = \ zed_SOURCES = $(ZED_SRC) $(FMA_SRC) zed_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libuutil.la zed_LDADD += -lrt $(LIBATOMIC_LIBS) $(LIBUDEV_LIBS) $(LIBUUID_LIBS) zed_LDFLAGS = -pthread @@ -51,3 +51,4 @@ zed_LDFLAGS = -pthread EXTRA_DIST = agents/README.md include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zed diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am index 1ead457f0f29..ca5e823aa4c8 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -11,10 +11,10 @@ zfs_SOURCES = \ zfs_projectutil.h zfs_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libuutil.la zfs_LDADD += $(LTLIBINTL) @@ -23,3 +23,4 @@ zfs_LDADD += -lgeom -ljail endif include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zfs diff --git a/cmd/zfs_ids_to_path/Makefile.am b/cmd/zfs_ids_to_path/Makefile.am index 549426764026..c57f1d97780c 100644 --- a/cmd/zfs_ids_to_path/Makefile.am +++ b/cmd/zfs_ids_to_path/Makefile.am @@ -6,6 +6,7 @@ zfs_ids_to_path_SOURCES = \ zfs_ids_to_path.c zfs_ids_to_path_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la + $(abs_top_builddir)/libzfs.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zfs_ids_to_path diff --git a/cmd/zgenhostid/Makefile.am b/cmd/zgenhostid/Makefile.am index 4526a90a1d51..96799a5a2963 100644 --- a/cmd/zgenhostid/Makefile.am +++ b/cmd/zgenhostid/Makefile.am @@ -5,3 +5,4 @@ sbin_PROGRAMS = zgenhostid zgenhostid_SOURCES = zgenhostid.c include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zgenhostid diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am index 23f03ffd8243..fa911e9e3c59 100644 --- a/cmd/zhack/Makefile.am +++ b/cmd/zhack/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/config/Rules.am -# Unconditionally enable debugging for zhack -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) sbin_PROGRAMS = zhack @@ -9,8 +8,9 @@ zhack_SOURCES = \ zhack.c zhack_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zhack diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index 40f382c66191..94a48f48b05c 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -8,8 +8,9 @@ zinject_SOURCES = \ zinject.h zinject_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zinject diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 7ea7c5fc3f3e..12f2cd226266 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/config/Shellcheck.am AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS) -DEFAULT_INCLUDES += -I$(srcdir) +AM_CPPFLAGS += -I$(srcdir) sbin_PROGRAMS = zpool @@ -24,11 +24,11 @@ zpool_SOURCES += os/linux/zpool_vdev_os.c endif zpool_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la \ - $(abs_top_builddir)/lib/libzutil/libzutil.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libuutil.la \ + $(abs_top_builddir)/libzutil.la zpool_LDADD += $(LTLIBINTL) @@ -38,6 +38,7 @@ endif zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS) include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zpool zpoolconfdir = $(sysconfdir)/zfs/zpool.d zpoolexecdir = $(zfsexecdir)/zpool.d diff --git a/cmd/zpool_influxdb/Makefile.am b/cmd/zpool_influxdb/Makefile.am index a59217570b9d..600108137d63 100644 --- a/cmd/zpool_influxdb/Makefile.am +++ b/cmd/zpool_influxdb/Makefile.am @@ -6,8 +6,9 @@ zpool_influxdb_SOURCES = \ zpool_influxdb.c zpool_influxdb_LDADD = \ - $(top_builddir)/lib/libspl/libspl.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/libspl.la \ + $(top_builddir)/libnvpair.la \ + $(top_builddir)/libzfs.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zpool_influxdb diff --git a/cmd/zstream/Makefile.am b/cmd/zstream/Makefile.am index 8e813027fa3d..7749e94ba69c 100644 --- a/cmd/zstream/Makefile.am +++ b/cmd/zstream/Makefile.am @@ -10,11 +10,12 @@ zstream_SOURCES = \ zstream_token.c zstream_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zstream install-exec-hook: cd $(DESTDIR)$(sbindir) && $(LN_S) -f zstream zstreamdump diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index d5e335e6d27e..353e81eb72b8 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -1,13 +1,11 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(KERNEL_CFLAGS) + # Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 AM_CFLAGS += $(NO_FORMAT_TRUNCATION) -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -# Unconditionally enable ASSERTs -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) sbin_PROGRAMS = ztest @@ -15,11 +13,12 @@ ztest_SOURCES = \ ztest.c ztest_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la ztest_LDADD += -lm ztest_LDFLAGS = -pthread include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += ztest diff --git a/cmd/zvol_id/Makefile.am b/cmd/zvol_id/Makefile.am index bb7e31a0590f..e51349b8c61d 100644 --- a/cmd/zvol_id/Makefile.am +++ b/cmd/zvol_id/Makefile.am @@ -10,3 +10,4 @@ zvol_id_SOURCES = \ zvol_id_main.c include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zvol_id diff --git a/cmd/zvol_wait/Makefile.am b/cmd/zvol_wait/Makefile.am index e8b546a60659..2e5bf3323389 100644 --- a/cmd/zvol_wait/Makefile.am +++ b/cmd/zvol_wait/Makefile.am @@ -1,4 +1,3 @@ include $(top_srcdir)/config/Shellcheck.am dist_bin_SCRIPTS = zvol_wait - diff --git a/config/Abigail.am b/config/Abigail.am deleted file mode 100644 index d1038f093373..000000000000 --- a/config/Abigail.am +++ /dev/null @@ -1,52 +0,0 @@ -# -# When performing an ABI check the following options are applied: -# -# --no-unreferenced-symbols: Exclude symbols which are not referenced by -# any debug information. Without this _init() and _fini() are incorrectly -# reported on CentOS7 for libuutil.so. -# -# --headers-dir1: Limit ABI checks to public OpenZFS headers, otherwise -# changes in public system headers are also reported. -# -# --suppressions: Honor a suppressions file for each library to provide -# a mechanism for suppressing harmless warnings. -# - -PHONY += checkabi storeabi check_libabi_version allow_libabi_only_for_x86_64 - -check_libabi_version: - libabiversion=`abidw -v | $(SED) 's/[^0-9]//g'`; \ - if test $$libabiversion -lt "200"; then \ - /bin/echo -e "\n" \ - "*** Please use libabigail 2.0.0 version or newer;\n" \ - "*** otherwise results are not consistent!\n" \ - "(or see https://github.com/openzfs/libabigail-docker )\n"; \ - exit 1; \ - fi; - -allow_libabi_only_for_x86_64: - echo '*** ABI definitions provided apply only to x86_64 architecture' - echo '*** Skipping `checkabi`/`storeabi` target and assuming success.' - -if TARGET_CPU_X86_64 -checkabi: check_libabi_version - for lib in $(lib_LTLIBRARIES) ; do \ - abidiff --no-unreferenced-symbols \ - --headers-dir1 ../../include \ - --suppressions $${lib%.la}.suppr \ - $${lib%.la}.abi .libs/$${lib%.la}.so ; \ - done - -storeabi: check_libabi_version - cd .libs ; \ - for lib in $(lib_LTLIBRARIES) ; do \ - abidw --no-show-locs \ - --no-corpus-path \ - --no-comp-dir-path \ - --type-id-style hash \ - $${lib%.la}.so > ../$${lib%.la}.abi ; \ - done -else -checkabi: allow_libabi_only_for_x86_64 -storeabi: allow_libabi_only_for_x86_64 -endif diff --git a/config/CppCheck.am b/config/CppCheck.am index e53013bd01cc..3fa6bddda89a 100644 --- a/config/CppCheck.am +++ b/config/CppCheck.am @@ -7,5 +7,15 @@ PHONY += cppcheck CPPCHECKFLAGS = --std=c99 --quiet --max-configs=1 --error-exitcode=2 CPPCHECKFLAGS += --inline-suppr -U_KERNEL -cppcheck: - $(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(DEFAULT_INCLUDES) $(SOURCES) +CPPCHECKDIRS = +CPPCHECKTARGETS = + +cppcheck-recursive-%: + $(MAKE) -C $(subst ^,/,$(subst cppcheck-recursive-,,$@)) cppcheck + +_CTGT = $(subst -,_,$(subst .,_,$(subst cppcheck-for-,,$@))) +cppcheck-for-%: + @[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)$(nodist_$(_CTGT)_SOURCES)" ] + $(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES) $(nodist_$(_CTGT)_SOURCES) + +cppcheck: $(addprefix cppcheck-for-,$(CPPCHECKTARGETS)) $(addprefix cppcheck-recursive-,$(subst /,^,$(CPPCHECKDIRS))) diff --git a/config/Rules.am b/config/Rules.am index e483b9ef800c..07e72d33fde7 100644 --- a/config/Rules.am +++ b/config/Rules.am @@ -4,22 +4,13 @@ # PHONY = -DEFAULT_INCLUDES = \ +AM_CPPFLAGS = \ -include $(top_builddir)/zfs_config.h \ -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/module/icp/include \ - -I$(top_srcdir)/lib/libspl/include - -if BUILD_LINUX -DEFAULT_INCLUDES += \ - -I$(top_srcdir)/lib/libspl/include/os/linux -endif - -if BUILD_FREEBSD -DEFAULT_INCLUDES += \ - -I$(top_srcdir)/lib/libspl/include/os/freebsd -endif + -I$(top_srcdir)/lib/libspl/include \ + -I$(top_srcdir)/lib/libspl/include/os/@ac_system_l@ AM_LIBTOOLFLAGS = --silent @@ -37,7 +28,7 @@ AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h AM_CFLAGS += -I/usr/include -I/usr/local/include endif -AM_CPPFLAGS = -D_GNU_SOURCE +AM_CPPFLAGS += -D_GNU_SOURCE AM_CPPFLAGS += -D_REENTRANT AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64 AM_CPPFLAGS += -D_LARGEFILE64_SOURCE @@ -48,23 +39,20 @@ AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\" AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\" AM_CPPFLAGS += $(DEBUG_CPPFLAGS) AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS) -if BUILD_LINUX -AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\" -endif -if BUILD_FREEBSD -AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-freebsd-user\" -endif -AM_CPPFLAGS += -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))" -AM_CPPFLAGS += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" -AM_CPPFLAGS += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" -AM_CPPFLAGS += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))" -AM_CPPFLAGS += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)" -AM_CPPFLAGS += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)" -AM_CPPFLAGS += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)" -AM_CPPFLAGS += -D"asctime(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime(__VA_ARGS__)" -AM_CPPFLAGS += -D"asctime_r(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime_r(__VA_ARGS__)" -AM_CPPFLAGS += -D"gmtime(...)=__attribute__((deprecated(\"gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!\"))) gmtime(__VA_ARGS__)" -AM_CPPFLAGS += -D"localtime(...)=__attribute__((deprecated(\"localtime(3) isn't thread-safe. Use localtime_r(3) instead!\"))) localtime(__VA_ARGS__)" +AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-@ac_system_l@-user\" + +AM_CPPFLAGS_NOCHECK = -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))" +AM_CPPFLAGS_NOCHECK += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" +AM_CPPFLAGS_NOCHECK += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" +AM_CPPFLAGS_NOCHECK += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))" +AM_CPPFLAGS_NOCHECK += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"asctime(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"asctime_r(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime_r(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"gmtime(...)=__attribute__((deprecated(\"gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!\"))) gmtime(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"localtime(...)=__attribute__((deprecated(\"localtime(3) isn't thread-safe. Use localtime_r(3) instead!\"))) localtime(__VA_ARGS__)" +AM_CPPFLAGS += $(AM_CPPFLAGS_NOCHECK) if ASAN_ENABLED AM_CPPFLAGS += -DZFS_ASAN_ENABLED @@ -83,3 +71,13 @@ AM_LDFLAGS += -fstack-protector-strong -shared AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel AM_LDFLAGS += -lm endif + + +# If a target includes kernel code, generate warnings for large stack frames +KERNEL_CFLAGS = $(FRAME_LARGER_THAN) + +# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 +LIBRARY_CFLAGS = -no-suppress + +# Forcibly enable asserts/debugging for libzpool &al. +FORCEDEBUG_CPPFLAGS = -DDEBUG -UNDEBUG -DZFS_DEBUG diff --git a/config/always-cppcheck.m4 b/config/always-cppcheck.m4 index c7c134a3e8cd..fa5a3398d923 100644 --- a/config/always-cppcheck.m4 +++ b/config/always-cppcheck.m4 @@ -3,4 +3,7 @@ dnl # Check if cppcheck is available. dnl # AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CPPCHECK], [ AC_CHECK_PROG([CPPCHECK], [cppcheck], [cppcheck]) + if test -z "$CPPCHECK"; then + CPPCHECK='@printf "skipping cppcheck because cppcheck is not installed\n"' + fi ]) diff --git a/config/always-system.m4 b/config/always-system.m4 index 3225a52af8ae..3a3d4212f8b0 100644 --- a/config/always-system.m4 +++ b/config/always-system.m4 @@ -8,18 +8,22 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_SYSTEM], [ AC_DEFINE([SYSTEM_LINUX], [1], [True if ZFS is to be compiled for a Linux system]) ac_system="Linux" + ac_system_l="linux" ;; *freebsd*) AC_DEFINE([SYSTEM_FREEBSD], [1], [True if ZFS is to be compiled for a FreeBSD system]) ac_system="FreeBSD" + ac_system_l="freebsd" ;; *) ac_system="unknown" + ac_system_l="unknown" ;; esac AC_MSG_RESULT([$ac_system]) AC_SUBST([ac_system]) + AC_SUBST([ac_system_l]) AM_CONDITIONAL([BUILD_LINUX], [test "x$ac_system" = "xLinux"]) AM_CONDITIONAL([BUILD_FREEBSD], [test "x$ac_system" = "xFreeBSD"]) diff --git a/configure.ac b/configure.ac index 26cdc8c67f0b..981215995bfe 100644 --- a/configure.ac +++ b/configure.ac @@ -30,8 +30,8 @@ * CDDL HEADER END */ -AC_INIT(m4_esyscmd(grep ^Name: META | cut -d ':' -f 2 | tr -d ' \n'), - m4_esyscmd(grep ^Version: META | cut -d ':' -f 2 | tr -d ' \n')) +AC_INIT(m4_esyscmd(awk '/^Name:/ {printf $2}' META), + m4_esyscmd(awk '/^Version:/ {printf $2}' META)) AC_LANG(C) ZFS_AC_META AC_CONFIG_AUX_DIR([config]) @@ -39,7 +39,7 @@ AC_CONFIG_MACRO_DIR([config]) AC_CANONICAL_TARGET AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_INIT_AUTOMAKE([subdir-objects]) +AM_INIT_AUTOMAKE([subdir-objects foreign]) AC_CONFIG_HEADERS([zfs_config.h], [ (mv zfs_config.h zfs_config.h.tmp && awk -f ${ac_srcdir}/config/config.awk zfs_config.h.tmp >zfs_config.h && @@ -139,34 +139,9 @@ AC_CONFIG_FILES([ include/sys/lua/Makefile include/sys/sysevent/Makefile include/sys/zstd/Makefile - lib/Makefile - lib/libavl/Makefile - lib/libefi/Makefile - lib/libicp/Makefile - lib/libnvpair/Makefile - lib/libshare/Makefile - lib/libspl/Makefile - lib/libspl/include/Makefile - lib/libspl/include/os/Makefile - lib/libspl/include/os/freebsd/Makefile - lib/libspl/include/os/freebsd/sys/Makefile - lib/libspl/include/os/linux/Makefile - lib/libspl/include/os/linux/sys/Makefile - lib/libspl/include/rpc/Makefile - lib/libspl/include/sys/Makefile - lib/libspl/include/sys/dktp/Makefile - lib/libtpool/Makefile - lib/libunicode/Makefile - 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 - lib/libzstd/Makefile - lib/libzutil/Makefile man/Makefile module/Kbuild module/Makefile diff --git a/contrib/pam_zfs_key/Makefile.am b/contrib/pam_zfs_key/Makefile.am index f0f2550afccb..bcb60b71ce41 100644 --- a/contrib/pam_zfs_key/Makefile.am +++ b/contrib/pam_zfs_key/Makefile.am @@ -2,15 +2,15 @@ include $(top_srcdir)/config/Rules.am AM_CFLAGS += $(LIBCRYPTO_CFLAGS) -pammodule_LTLIBRARIES=pam_zfs_key.la +pammodule_LTLIBRARIES = pam_zfs_key.la pam_zfs_key_la_SOURCES = pam_zfs_key.c pam_zfs_key_la_LIBADD = \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libuutil.la \ + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la pam_zfs_key_la_LDFLAGS = -version-info 1:0:0 -avoid-version -module -shared diff --git a/etc/systemd/Makefile.am b/etc/systemd/Makefile.am index 66232a5ff197..7b47b93fc105 100644 --- a/etc/systemd/Makefile.am +++ b/etc/systemd/Makefile.am @@ -1,4 +1 @@ -include $(top_srcdir)/config/Shellcheck.am - SUBDIRS = system system-generators -SHELLCHECKDIRS = system-generators diff --git a/etc/systemd/system-generators/Makefile.am b/etc/systemd/system-generators/Makefile.am index e5920bf39203..ee51d1c75e8b 100644 --- a/etc/systemd/system-generators/Makefile.am +++ b/etc/systemd/system-generators/Makefile.am @@ -7,8 +7,9 @@ zfs_mount_generator_SOURCES = \ zfs-mount-generator.c zfs_mount_generator_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la + $(abs_top_builddir)/libzfs.la zfs_mount_generator_LDFLAGS = -pthread include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zfs-mount-generator diff --git a/lib/Makefile.am b/lib/Makefile.am index f07975cc03fc..499ebdaeba9b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -33,50 +33,91 @@ # | | | # \-------- libspl ----+------/ # -# * - A stable ABI is provided for these libraries -# # # NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries # These nine libraries are intermediary build components. # -SUBDIRS = libavl libicp libshare libspl libtpool libzstd -CPPCHECKDIRS = libavl libicp libnvpair libshare libspl libtpool libunicode -CPPCHECKDIRS += libuutil libzfs libzfs_core libzfsbootenv libzpool libzutil +# * - A stable ABI is provided for these libraries; +# when performing an ABI check the following options are applied: +# +# --no-unreferenced-symbols: Exclude symbols which are not referenced by +# any debug information. Without this _init() and _fini() are incorrectly +# reported on CentOS7 for libuutil.so. +# +# --headers-dir1: Limit ABI checks to public OpenZFS headers, otherwise +# changes in public system headers are also reported. +# +# --suppressions: Honor a suppressions file for each library to provide +# a mechanism for suppressing harmless warnings. +# +noinst_LTLIBRARIES = +lib_LTLIBRARIES = +pkgconfig_DATA = +include $(srcdir)/%D%/libavl/Makefile.am +include $(srcdir)/%D%/libicp/Makefile.am +include $(srcdir)/%D%/libnvpair/Makefile.am +include $(srcdir)/%D%/libshare/Makefile.am +include $(srcdir)/%D%/libspl/Makefile.am +include $(srcdir)/%D%/libtpool/Makefile.am +include $(srcdir)/%D%/libunicode/Makefile.am +include $(srcdir)/%D%/libuutil/Makefile.am +include $(srcdir)/%D%/libzfs_core/Makefile.am +include $(srcdir)/%D%/libzfs/Makefile.am +include $(srcdir)/%D%/libzfsbootenv/Makefile.am +include $(srcdir)/%D%/libzpool/Makefile.am +include $(srcdir)/%D%/libzstd/Makefile.am +include $(srcdir)/%D%/libzutil/Makefile.am if BUILD_LINUX -SUBDIRS += libefi -CPPCHECKDIRS += libefi +include $(srcdir)/%D%/libefi/Makefile.am endif -# libnvpair is installed as part of the final build product -# libzutil depends on it, so it must be compiled before libzutil -SUBDIRS += libnvpair -# libzutil depends on libefi if present -SUBDIRS += libzutil libunicode +PHONY += lib +lib: $(noinst_LTLIBRARIES) $(lib_LTLIBRARIES) -# These five libraries, which are installed as the final build product, -# incorporate the eight convenience libraries given above. -DISTLIBS = libuutil libzfs_core libzfs libzpool libzfsbootenv -SUBDIRS += $(DISTLIBS) -DISTLIBS += libnvpair -# An ABI is stored for each of these libraries. Note that libzpool.so -# is only linked against by ztest and zdb and no stable ABI is provided. -ABILIBS = libnvpair libuutil libzfs_core libzfs libzfsbootenv +PHONY += checkabi storeabi check_libabi_version allow_libabi_only_for_x86_64 -PHONY = checkabi storeabi cppcheck -checkabi: $(ABILIBS) - set -e ; for dir in $(ABILIBS) ; do \ - $(MAKE) -C $$dir checkabi ; \ - done +check_libabi_version: + if [ $$(abidw -v | $(SED) 's/[^0-9]//g') -lt 200 ]; then \ + printf '%s\n' "" \ + "*** Please use libabigail 2.0.0 version or newer;" \ + "*** otherwise results are not consistent!" \ + "(or see https://github.com/openzfs/libabigail-docker)"; \ + exit 1; \ + fi -storeabi: $(ABILIBS) - set -e ; for dir in $(ABILIBS) ; do \ - $(MAKE) -C $$dir storeabi ; \ - done +allow_libabi_only_for_x86_64: + echo '*** ABI definitions provided apply only to x86_64:' + echo '*** not checking or storing ABI and assuming success.' -cppcheck: $(CPPCHECKDIRS) - set -e ; for dir in $(CPPCHECKDIRS) ; do \ - $(MAKE) -C $$dir cppcheck ; \ +if TARGET_CPU_X86_64 +# These should depend on $(lib_LTLIBRARIES), but this breaks on CI when bound into Docker +checkabi: check_libabi_version + err=0; \ + for lib in $(lib_LTLIBRARIES); do \ + lib=$${lib%.la}; \ + [ -f $(srcdir)/lib/$$lib/$$lib.suppr ] || continue; \ + echo $$lib:; \ + abidiff --no-unreferenced-symbols \ + --headers-dir1 include \ + --suppressions $(srcdir)/lib/$$lib/$$lib.suppr \ + $(srcdir)/lib/$$lib/$$lib.abi .libs/$$lib.so || err=$$((err + 1)); \ + done; \ + exit $$err + +storeabi: check_libabi_version + for lib in $(lib_LTLIBRARIES); do \ + lib=$${lib%.la}; \ + [ -f $(srcdir)/lib/$$lib/$$lib.suppr ] || continue; \ + abidw --no-show-locs \ + --no-corpus-path \ + --no-comp-dir-path \ + --type-id-style hash \ + .libs/$$lib.so > $(srcdir)/lib/$$lib/$$lib.abi; \ done +else +checkabi: allow_libabi_only_for_x86_64 +storeabi: allow_libabi_only_for_x86_64 +endif diff --git a/lib/libavl/Makefile.am b/lib/libavl/Makefile.am index 3902190d1add..5eaf4c08728d 100644 --- a/lib/libavl/Makefile.am +++ b/lib/libavl/Makefile.am @@ -1,19 +1,8 @@ -include $(top_srcdir)/config/Rules.am +libavl_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) +libavl_la_CFLAGS += -fvisibility=hidden -VPATH = $(top_srcdir)/module/avl/ - -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libavl.la - -KERNEL_C = \ - avl.c +noinst_LTLIBRARIES += libavl.la +CPPCHECKTARGETS += libavl.la nodist_libavl_la_SOURCES = \ - $(KERNEL_C) - -include $(top_srcdir)/config/CppCheck.am + module/avl/avl.c diff --git a/lib/libefi/Makefile.am b/lib/libefi/Makefile.am index f42b9d1a7625..5c3e57346c86 100644 --- a/lib/libefi/Makefile.am +++ b/lib/libefi/Makefile.am @@ -1,17 +1,11 @@ -include $(top_srcdir)/config/Rules.am +libefi_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libefi_la_CFLAGS += $(LIBUUID_CFLAGS) $(ZLIB_CFLAGS) +libefi_la_CFLAGS += -fvisibility=hidden -AM_CFLAGS += $(LIBUUID_CFLAGS) $(ZLIB_CFLAGS) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +noinst_LTLIBRARIES += libefi.la +CPPCHECKTARGETS += libefi.la -noinst_LTLIBRARIES = libefi.la - -USER_C = \ - rdwr_efi.c - -libefi_la_SOURCES = $(USER_C) +libefi_la_SOURCES = \ + %D%/rdwr_efi.c libefi_la_LIBADD = $(LIBUUID_LIBS) $(ZLIB_LIBS) - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libicp/Makefile.am b/lib/libicp/Makefile.am index d81205fd27e6..00bfc5c36ae9 100644 --- a/lib/libicp/Makefile.am +++ b/lib/libicp/Makefile.am @@ -1,69 +1,51 @@ -include $(top_srcdir)/config/Rules.am +libicp_la_CCASFLAGS = $(AM_CCASFLAGS) +libicp_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) -VPATH = \ - $(top_srcdir)/module/icp \ - $(top_srcdir)/lib/libicp +noinst_LTLIBRARIES += libicp.la +CPPCHECKTARGETS += libicp.la -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libicp.la +nodist_libicp_la_SOURCES = \ + module/icp/spi/kcf_spi.c \ + module/icp/api/kcf_ctxops.c \ + module/icp/api/kcf_cipher.c \ + module/icp/api/kcf_mac.c \ + module/icp/algs/aes/aes_impl_aesni.c \ + module/icp/algs/aes/aes_impl_generic.c \ + module/icp/algs/aes/aes_impl_x86-64.c \ + module/icp/algs/aes/aes_impl.c \ + module/icp/algs/aes/aes_modes.c \ + module/icp/algs/edonr/edonr.c \ + module/icp/algs/modes/modes.c \ + module/icp/algs/modes/cbc.c \ + module/icp/algs/modes/gcm_generic.c \ + module/icp/algs/modes/gcm_pclmulqdq.c \ + module/icp/algs/modes/gcm.c \ + module/icp/algs/modes/ctr.c \ + module/icp/algs/modes/ccm.c \ + module/icp/algs/modes/ecb.c \ + module/icp/algs/sha2/sha2.c \ + module/icp/algs/skein/skein.c \ + module/icp/algs/skein/skein_block.c \ + module/icp/algs/skein/skein_iv.c \ + module/icp/illumos-crypto.c \ + module/icp/io/aes.c \ + module/icp/io/sha2_mod.c \ + module/icp/io/skein_mod.c \ + module/icp/core/kcf_sched.c \ + module/icp/core/kcf_prov_lib.c \ + module/icp/core/kcf_callprov.c \ + module/icp/core/kcf_mech_tabs.c \ + module/icp/core/kcf_prov_tabs.c if TARGET_CPU_X86_64 -ASM_SOURCES_C = asm-x86_64/aes/aeskey.c -ASM_SOURCES_AS = \ - asm-x86_64/aes/aes_amd64.S \ - asm-x86_64/aes/aes_aesni.S \ - asm-x86_64/modes/gcm_pclmulqdq.S \ - asm-x86_64/modes/aesni-gcm-x86_64.S \ - asm-x86_64/modes/ghash-x86_64.S \ - asm-x86_64/sha2/sha256_impl.S \ - asm-x86_64/sha2/sha512_impl.S -else -ASM_SOURCES_C = -ASM_SOURCES_AS = +nodist_libicp_la_SOURCES += \ + module/icp/asm-x86_64/aes/aeskey.c +nodist_libicp_la_SOURCES += \ + module/icp/asm-x86_64/aes/aes_amd64.S \ + module/icp/asm-x86_64/aes/aes_aesni.S \ + module/icp/asm-x86_64/modes/gcm_pclmulqdq.S \ + module/icp/asm-x86_64/modes/aesni-gcm-x86_64.S \ + module/icp/asm-x86_64/modes/ghash-x86_64.S \ + module/icp/asm-x86_64/sha2/sha256_impl.S \ + module/icp/asm-x86_64/sha2/sha512_impl.S endif - -KERNEL_C = \ - spi/kcf_spi.c \ - api/kcf_ctxops.c \ - api/kcf_cipher.c \ - api/kcf_mac.c \ - algs/aes/aes_impl_aesni.c \ - algs/aes/aes_impl_generic.c \ - algs/aes/aes_impl_x86-64.c \ - algs/aes/aes_impl.c \ - algs/aes/aes_modes.c \ - algs/edonr/edonr.c \ - algs/modes/modes.c \ - algs/modes/cbc.c \ - algs/modes/gcm_generic.c \ - algs/modes/gcm_pclmulqdq.c \ - algs/modes/gcm.c \ - algs/modes/ctr.c \ - algs/modes/ccm.c \ - algs/modes/ecb.c \ - algs/sha2/sha2.c \ - algs/skein/skein.c \ - algs/skein/skein_block.c \ - algs/skein/skein_iv.c \ - illumos-crypto.c \ - io/aes.c \ - io/sha2_mod.c \ - io/skein_mod.c \ - core/kcf_sched.c \ - core/kcf_prov_lib.c \ - core/kcf_callprov.c \ - core/kcf_mech_tabs.c \ - core/kcf_prov_tabs.c \ - $(ASM_SOURCES_C) - -KERNEL_ASM = $(ASM_SOURCES_AS) - -nodist_libicp_la_SOURCES = \ - $(KERNEL_C) \ - $(KERNEL_ASM) - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am index 021859e148a8..6d9345f5289e 100644 --- a/lib/libnvpair/Makefile.am +++ b/lib/libnvpair/Makefile.am @@ -1,42 +1,26 @@ -include $(top_srcdir)/config/Rules.am - -VPATH = \ - $(top_srcdir)/module/nvpair \ - $(top_srcdir)/lib/libnvpair - -# Includes kernel code, generate warnings for large stack frames -# and required CFLAGS for libtirpc -AM_CFLAGS += $(FRAME_LARGER_THAN) $(LIBTIRPC_CFLAGS) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +libnvpair_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) +libnvpair_la_CFLAGS += $(LIBTIRPC_CFLAGS) +libnvpair_la_CFLAGS += -fvisibility=hidden # wchar_t is undefined-signedness, but we compare to >=0; this warns with unsigned wchar_t -libnvpair_json.$(OBJEXT): CFLAGS += -Wno-type-limits -libnvpair_json.l$(OBJEXT): CFLAGS += -Wno-type-limits - -lib_LTLIBRARIES = libnvpair.la +%D%/libnvpair_la-libnvpair_json.$(OBJEXT) : CFLAGS += -Wno-type-limits +%D%/libnvpair_la-libnvpair_json.l$(OBJEXT): CFLAGS += -Wno-type-limits -include $(top_srcdir)/config/Abigail.am - -USER_C = \ - libnvpair.c \ - libnvpair_json.c \ - nvpair_alloc_system.c - -KERNEL_C = \ - nvpair_alloc_fixed.c \ - nvpair.c \ - fnvpair.c +lib_LTLIBRARIES += libnvpair.la +CPPCHECKTARGETS += libnvpair.la dist_libnvpair_la_SOURCES = \ - $(USER_C) + %D%/libnvpair.c \ + %D%/libnvpair_json.c \ + %D%/nvpair_alloc_system.c nodist_libnvpair_la_SOURCES = \ - $(KERNEL_C) + module/nvpair/nvpair_alloc_fixed.c \ + module/nvpair/nvpair.c \ + module/nvpair/fnvpair.c libnvpair_la_LIBADD = \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la + libspl_assert.la libnvpair_la_LIBADD += $(LIBTIRPC_LIBS) $(LTLIBINTL) @@ -48,7 +32,4 @@ endif libnvpair_la_LDFLAGS += -version-info 3:0:0 -include $(top_srcdir)/config/CppCheck.am - -# Library ABI -EXTRA_DIST = libnvpair.abi libnvpair.suppr +EXTRA_DIST += $(addprefix %D%/,libnvpair.abi libnvpair.suppr) diff --git a/lib/libshare/Makefile.am b/lib/libshare/Makefile.am index 1527c70ba106..48d8cb832428 100644 --- a/lib/libshare/Makefile.am +++ b/lib/libshare/Makefile.am @@ -1,32 +1,27 @@ -include $(top_srcdir)/config/Rules.am +libshare_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libshare_la_CFLAGS += -fvisibility=hidden -DEFAULT_INCLUDES += -I$(srcdir) +libshare_la_CPPFLAGS = $(AM_CPPFLAGS) +libshare_la_CPPFLAGS += -I$(srcdir)/%D% -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +noinst_LTLIBRARIES += libshare.la +CPPCHECKTARGETS += libshare.la -noinst_LTLIBRARIES = libshare.la - -USER_C = \ - libshare_impl.h \ - libshare.c \ - nfs.c \ - nfs.h \ - smb.h +libshare_la_SOURCES = \ + %D%/libshare_impl.h \ + %D%/libshare.c \ + %D%/nfs.c \ + %D%/nfs.h \ + %D%/smb.h if BUILD_LINUX -USER_C += \ - os/linux/nfs.c \ - os/linux/smb.c +libshare_la_SOURCES += \ + %D%/os/linux/nfs.c \ + %D%/os/linux/smb.c endif if BUILD_FREEBSD -USER_C += \ - os/freebsd/nfs.c \ - os/freebsd/smb.c +libshare_la_SOURCES += \ + %D%/os/freebsd/nfs.c \ + %D%/os/freebsd/smb.c endif - -libshare_la_SOURCES = $(USER_C) - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am index c62554b14f16..822bef7e7a8d 100644 --- a/lib/libspl/Makefile.am +++ b/lib/libspl/Makefile.am @@ -1,50 +1,45 @@ -include $(top_srcdir)/config/Rules.am +include $(srcdir)/%D%/include/Makefile.am -SUBDIRS = include +libspl_assert_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libspl_la_CFLAGS = $(libspl_assert_la_CFLAGS) -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libspl_assert.la libspl.la +noinst_LTLIBRARIES += libspl_assert.la libspl.la +CPPCHECKTARGETS += libspl_assert.la libspl.la libspl_assert_la_SOURCES = \ - assert.c - -USER_C = \ - libspl_impl.h \ - atomic.c \ - getexecname.c \ - list.c \ - mkdirp.c \ - page.c \ - strlcat.c \ - strlcpy.c \ - timestamp.c \ - include/sys/list.h \ - include/sys/list_impl.h + %D%/assert.c + +libspl_la_SOURCES = \ + %D%/libspl_impl.h \ + %D%/atomic.c \ + %D%/getexecname.c \ + %D%/list.c \ + %D%/mkdirp.c \ + %D%/page.c \ + %D%/strlcat.c \ + %D%/strlcpy.c \ + %D%/timestamp.c \ + %D%/include/sys/list.h \ + %D%/include/sys/list_impl.h if BUILD_LINUX -USER_C += \ - os/linux/getexecname.c \ - os/linux/gethostid.c \ - os/linux/getmntany.c \ - os/linux/zone.c +libspl_la_SOURCES += \ + %D%/os/linux/getexecname.c \ + %D%/os/linux/gethostid.c \ + %D%/os/linux/getmntany.c \ + %D%/os/linux/zone.c endif if BUILD_FREEBSD -USER_C += \ - os/freebsd/getexecname.c \ - os/freebsd/gethostid.c \ - os/freebsd/getmntany.c \ - os/freebsd/mnttab.c \ - os/freebsd/zone.c +libspl_la_SOURCES += \ + %D%/os/freebsd/getexecname.c \ + %D%/os/freebsd/gethostid.c \ + %D%/os/freebsd/getmntany.c \ + %D%/os/freebsd/mnttab.c \ + %D%/os/freebsd/zone.c endif -libspl_la_SOURCES = $(USER_C) - libspl_la_LIBADD = \ libspl_assert.la libspl_la_LIBADD += $(LIBATOMIC_LIBS) $(LIBCLOCK_GETTIME) - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index 601fbb77f663..e995ddf66b92 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -1,22 +1,108 @@ -SUBDIRS = rpc sys os - libspldir = $(includedir)/libspl libspl_HEADERS = \ - assert.h \ - atomic.h \ - libdevinfo.h \ - libgen.h \ - libshare.h \ - limits.h \ - locale.h \ - statcommon.h \ - stdio.h \ - stdlib.h \ - string.h \ - stropts.h \ - thread.h \ - tzfile.h \ - ucred.h \ - umem.h \ - unistd.h \ - zone.h + %D%/assert.h \ + %D%/atomic.h \ + %D%/libdevinfo.h \ + %D%/libgen.h \ + %D%/libshare.h \ + %D%/limits.h \ + %D%/locale.h \ + %D%/statcommon.h \ + %D%/stdio.h \ + %D%/stdlib.h \ + %D%/string.h \ + %D%/stropts.h \ + %D%/thread.h \ + %D%/tzfile.h \ + %D%/ucred.h \ + %D%/umem.h \ + %D%/unistd.h \ + %D%/zone.h + +if BUILD_FREEBSD +libspl_HEADERS += \ + %D%/os/freebsd/fcntl.h +endif + + +libspl_rpcdir = $(libspldir)/rpc +libspl_rpc_HEADERS = \ + %D%/rpc/xdr.h + + +libspl_sysdir = $(libspldir)/sys +libspl_sys_HEADERS = \ + %D%/sys/acl.h \ + %D%/sys/acl_impl.h \ + %D%/sys/callb.h \ + %D%/sys/cmn_err.h \ + %D%/sys/cred.h \ + %D%/sys/debug.h \ + %D%/sys/dkio.h \ + %D%/sys/dklabel.h \ + %D%/sys/feature_tests.h \ + %D%/sys/int_limits.h \ + %D%/sys/int_types.h \ + %D%/sys/inttypes.h \ + %D%/sys/isa_defs.h \ + %D%/sys/kmem.h \ + %D%/sys/kstat.h \ + %D%/sys/list.h \ + %D%/sys/list_impl.h \ + %D%/sys/mhd.h \ + %D%/sys/mkdev.h \ + %D%/sys/policy.h \ + %D%/sys/poll.h \ + %D%/sys/priv.h \ + %D%/sys/processor.h \ + %D%/sys/sha2.h \ + %D%/sys/simd.h \ + %D%/sys/stack.h \ + %D%/sys/stdtypes.h \ + %D%/sys/string.h \ + %D%/sys/stropts.h \ + %D%/sys/sunddi.h \ + %D%/sys/systeminfo.h \ + %D%/sys/time.h \ + %D%/sys/trace_spl.h \ + %D%/sys/trace_zfs.h \ + %D%/sys/types.h \ + %D%/sys/types32.h \ + %D%/sys/tzfile.h \ + %D%/sys/uio.h \ + %D%/sys/va_list.h \ + %D%/sys/varargs.h \ + %D%/sys/vnode.h \ + %D%/sys/wmsum.h \ + %D%/sys/zone.h + +if BUILD_LINUX +libspl_sys_HEADERS += \ + %D%/os/linux/sys/byteorder.h \ + %D%/os/linux/sys/errno.h \ + %D%/os/linux/sys/mnttab.h \ + %D%/os/linux/sys/mount.h \ + %D%/os/linux/sys/param.h \ + %D%/os/linux/sys/stat.h \ + %D%/os/linux/sys/sysmacros.h \ + %D%/os/linux/sys/zfs_context_os.h +endif + +if BUILD_FREEBSD +libspl_sys_HEADERS += \ + %D%/os/freebsd/sys/byteorder.h \ + %D%/os/freebsd/sys/fcntl.h \ + %D%/os/freebsd/sys/file.h \ + %D%/os/freebsd/sys/mnttab.h \ + %D%/os/freebsd/sys/mount.h \ + %D%/os/freebsd/sys/param.h \ + %D%/os/freebsd/sys/stat.h \ + %D%/os/freebsd/sys/sysmacros.h \ + %D%/os/freebsd/sys/vfs.h \ + %D%/os/freebsd/sys/zfs_context_os.h +endif + + +libspl_sys_dktpdir = $(libspl_sysdir)/dktp +libspl_sys_dktp_HEADERS = \ + %D%/sys/dktp/fdisk.h diff --git a/lib/libspl/include/os/Makefile.am b/lib/libspl/include/os/Makefile.am deleted file mode 100644 index 7b362e02ad59..000000000000 --- a/lib/libspl/include/os/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -if BUILD_FREEBSD -SUBDIRS = freebsd -endif - -if BUILD_LINUX -SUBDIRS = linux -endif diff --git a/lib/libspl/include/os/freebsd/Makefile.am b/lib/libspl/include/os/freebsd/Makefile.am deleted file mode 100644 index f06325ee3e4e..000000000000 --- a/lib/libspl/include/os/freebsd/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = sys - -libspldir = $(includedir)/libspl -libspl_HEADERS = \ - fcntl.h diff --git a/lib/libspl/include/os/freebsd/sys/Makefile.am b/lib/libspl/include/os/freebsd/sys/Makefile.am deleted file mode 100644 index 7a854608079c..000000000000 --- a/lib/libspl/include/os/freebsd/sys/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -libspldir = $(includedir)/libspl/sys -libspl_HEADERS = \ - byteorder.h \ - fcntl.h \ - file.h \ - mnttab.h \ - mount.h \ - param.h \ - stat.h \ - sysmacros.h \ - vfs.h \ - zfs_context_os.h diff --git a/lib/libspl/include/os/linux/Makefile.am b/lib/libspl/include/os/linux/Makefile.am deleted file mode 100644 index 081839c48c8f..000000000000 --- a/lib/libspl/include/os/linux/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = sys diff --git a/lib/libspl/include/os/linux/sys/Makefile.am b/lib/libspl/include/os/linux/sys/Makefile.am deleted file mode 100644 index 1ec07a76d354..000000000000 --- a/lib/libspl/include/os/linux/sys/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -libspldir = $(includedir)/libspl/sys -libspl_HEADERS = \ - byteorder.h \ - errno.h \ - mnttab.h \ - mount.h \ - param.h \ - stat.h \ - sysmacros.h \ - zfs_context_os.h diff --git a/lib/libspl/include/rpc/Makefile.am b/lib/libspl/include/rpc/Makefile.am deleted file mode 100644 index 7fe1d7fea4d7..000000000000 --- a/lib/libspl/include/rpc/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -libspldir = $(includedir)/libspl/rpc -libspl_HEADERS = \ - xdr.h diff --git a/lib/libspl/include/sys/Makefile.am b/lib/libspl/include/sys/Makefile.am deleted file mode 100644 index 4315470b59b2..000000000000 --- a/lib/libspl/include/sys/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -SUBDIRS = dktp - -libspldir = $(includedir)/libspl/sys -libspl_HEADERS = \ - acl.h \ - acl_impl.h \ - callb.h \ - cmn_err.h \ - cred.h \ - debug.h \ - dkio.h \ - dklabel.h \ - feature_tests.h \ - int_limits.h \ - int_types.h \ - inttypes.h \ - isa_defs.h \ - kmem.h \ - kstat.h \ - list.h \ - list_impl.h \ - mhd.h \ - mkdev.h \ - policy.h \ - poll.h \ - priv.h \ - processor.h \ - sha2.h \ - simd.h \ - stack.h \ - stdtypes.h \ - string.h \ - stropts.h \ - sunddi.h \ - systeminfo.h \ - time.h \ - trace_spl.h \ - trace_zfs.h \ - types32.h \ - types.h \ - tzfile.h \ - uio.h \ - va_list.h \ - varargs.h \ - vnode.h \ - wmsum.h \ - zone.h diff --git a/lib/libspl/include/sys/dktp/Makefile.am b/lib/libspl/include/sys/dktp/Makefile.am deleted file mode 100644 index 4ad3695d8abc..000000000000 --- a/lib/libspl/include/sys/dktp/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -libspldir = $(includedir)/libspl/sys/dktp -libspl_HEADERS = \ - fdisk.h - diff --git a/lib/libtpool/Makefile.am b/lib/libtpool/Makefile.am index b66f72eeb43e..5a2b8a5701da 100644 --- a/lib/libtpool/Makefile.am +++ b/lib/libtpool/Makefile.am @@ -1,19 +1,11 @@ -include $(top_srcdir)/config/Rules.am - -AM_CFLAGS += -fvisibility=hidden - +libtpool_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libtpool_la_CFLAGS += -fvisibility=hidden # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61118 -AM_CFLAGS += $(NO_CLOBBERED) - -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libtpool.la - -USER_C = \ - thread_pool.c \ - thread_pool_impl.h +libtpool_la_CFLAGS += $(NO_CLOBBERED) -libtpool_la_SOURCES = $(USER_C) +noinst_LTLIBRARIES += libtpool.la +CPPCHECKTARGETS += libtpool.la -include $(top_srcdir)/config/CppCheck.am +libtpool_la_SOURCES = \ + %D%/thread_pool.c \ + %D%/thread_pool_impl.h diff --git a/lib/libunicode/Makefile.am b/lib/libunicode/Makefile.am index 5b12b3e916f3..82fee0101346 100644 --- a/lib/libunicode/Makefile.am +++ b/lib/libunicode/Makefile.am @@ -1,20 +1,8 @@ -include $(top_srcdir)/config/Rules.am +libunicode_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) -VPATH = $(top_srcdir)/module/unicode - -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libunicode.la - -KERNEL_C = \ - u8_textprep.c \ - uconv.c +noinst_LTLIBRARIES += libunicode.la +CPPCHECKTARGETS += libunicode.la nodist_libunicode_la_SOURCES = \ - $(KERNEL_C) - -include $(top_srcdir)/config/CppCheck.am + module/unicode/u8_textprep.c \ + module/unicode/uconv.c diff --git a/lib/libuutil/Makefile.am b/lib/libuutil/Makefile.am index 6678a90b59f3..cb89d423dc48 100644 --- a/lib/libuutil/Makefile.am +++ b/lib/libuutil/Makefile.am @@ -1,26 +1,20 @@ -include $(top_srcdir)/config/Rules.am +libuutil_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) $(LIBRARY_CFLAGS) -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +lib_LTLIBRARIES += libuutil.la +CPPCHECKTARGETS += libuutil.la -lib_LTLIBRARIES = libuutil.la - -include $(top_srcdir)/config/Abigail.am - -USER_C = \ - uu_alloc.c \ - uu_avl.c \ - uu_ident.c \ - uu_list.c \ - uu_misc.c \ - uu_pname.c \ - uu_string.c - -libuutil_la_SOURCES = $(USER_C) +libuutil_la_SOURCES = \ + %D%/uu_alloc.c \ + %D%/uu_avl.c \ + %D%/uu_ident.c \ + %D%/uu_list.c \ + %D%/uu_misc.c \ + %D%/uu_pname.c \ + %D%/uu_string.c libuutil_la_LIBADD = \ - $(abs_top_builddir)/lib/libavl/libavl.la \ - $(abs_top_builddir)/lib/libspl/libspl.la + libavl.la \ + libspl.la libuutil_la_LIBADD += $(LTLIBINTL) @@ -32,7 +26,4 @@ endif libuutil_la_LDFLAGS += -version-info 3:0:0 -include $(top_srcdir)/config/CppCheck.am - -# Library ABI -EXTRA_DIST = libuutil.abi libuutil.suppr +EXTRA_DIST += $(addprefix %D%/,libuutil.abi libuutil.suppr) diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 14bb7df4d7cf..07414c4a308b 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -1,81 +1,64 @@ -include $(top_srcdir)/config/Rules.am +libzfs_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzfs_la_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) +libzfs_la_CFLAGS += -fvisibility=hidden -VPATH = \ - $(top_srcdir)/module/icp \ - $(top_srcdir)/module/zcommon \ - $(top_srcdir)/lib/libzfs - -# Suppress unused but set variable warnings often due to ASSERTs -AM_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -pkgconfig_DATA = libzfs.pc - -lib_LTLIBRARIES = libzfs.la - -include $(top_srcdir)/config/Abigail.am - -USER_C = \ - libzfs_impl.h \ - libzfs_changelist.c \ - libzfs_config.c \ - libzfs_crypto.c \ - libzfs_dataset.c \ - libzfs_diff.c \ - libzfs_import.c \ - libzfs_iter.c \ - libzfs_mount.c \ - libzfs_pool.c \ - libzfs_sendrecv.c \ - libzfs_status.c \ - libzfs_util.c +lib_LTLIBRARIES += libzfs.la +CPPCHECKTARGETS += libzfs.la +dist_libzfs_la_SOURCES = \ + %D%/libzfs_impl.h \ + %D%/libzfs_changelist.c \ + %D%/libzfs_config.c \ + %D%/libzfs_crypto.c \ + %D%/libzfs_dataset.c \ + %D%/libzfs_diff.c \ + %D%/libzfs_import.c \ + %D%/libzfs_iter.c \ + %D%/libzfs_mount.c \ + %D%/libzfs_pool.c \ + %D%/libzfs_sendrecv.c \ + %D%/libzfs_status.c \ + %D%/libzfs_util.c if BUILD_FREEBSD -USER_C += \ - os/freebsd/libzfs_compat.c \ - os/freebsd/libzfs_zmount.c +dist_libzfs_la_SOURCES += \ + %D%/os/freebsd/libzfs_compat.c \ + %D%/os/freebsd/libzfs_zmount.c endif if BUILD_LINUX -USER_C += \ - os/linux/libzfs_mount_os.c \ - os/linux/libzfs_pool_os.c \ - os/linux/libzfs_util_os.c +dist_libzfs_la_SOURCES += \ + %D%/os/linux/libzfs_mount_os.c \ + %D%/os/linux/libzfs_pool_os.c \ + %D%/os/linux/libzfs_util_os.c endif -KERNEL_C = \ - algs/sha2/sha2.c \ - cityhash.c \ - zfeature_common.c \ - zfs_comutil.c \ - zfs_deleg.c \ - zfs_fletcher.c \ - zfs_fletcher_aarch64_neon.c \ - zfs_fletcher_avx512.c \ - zfs_fletcher_intel.c \ - zfs_fletcher_sse.c \ - zfs_fletcher_superscalar.c \ - zfs_fletcher_superscalar4.c \ - zfs_namecheck.c \ - zfs_prop.c \ - zpool_prop.c \ - zprop_common.c - -dist_libzfs_la_SOURCES = \ - $(USER_C) - nodist_libzfs_la_SOURCES = \ - $(KERNEL_C) + module/icp/algs/sha2/sha2.c \ + \ + module/zcommon/cityhash.c \ + module/zcommon/zfeature_common.c \ + module/zcommon/zfs_comutil.c \ + module/zcommon/zfs_deleg.c \ + module/zcommon/zfs_fletcher.c \ + module/zcommon/zfs_fletcher_aarch64_neon.c \ + module/zcommon/zfs_fletcher_avx512.c \ + module/zcommon/zfs_fletcher_intel.c \ + module/zcommon/zfs_fletcher_sse.c \ + module/zcommon/zfs_fletcher_superscalar.c \ + module/zcommon/zfs_fletcher_superscalar4.c \ + module/zcommon/zfs_namecheck.c \ + module/zcommon/zfs_prop.c \ + module/zcommon/zpool_prop.c \ + module/zcommon/zprop_common.c + libzfs_la_LIBADD = \ - $(abs_top_builddir)/lib/libshare/libshare.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libzutil/libzutil.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la + libshare.la \ + libzfs_core.la \ + libnvpair.la \ + libzutil.la \ + libuutil.la libzfs_la_LIBADD += -lm $(LIBCRYPTO_LIBS) $(ZLIB_LIBS) $(LIBFETCH_LIBS) $(LTLIBINTL) @@ -91,10 +74,7 @@ endif libzfs_la_LDFLAGS += -version-info 5:0:1 -include $(top_srcdir)/config/CppCheck.am - -# Library ABI -EXTRA_DIST = libzfs.abi libzfs.suppr +pkgconfig_DATA += %D%/libzfs.pc -# Licensing data -EXTRA_DIST += THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip +EXTRA_DIST += $(addprefix %D%/,libzfs.abi libzfs.suppr) +EXTRA_DIST += $(addprefix %D%/,THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip) diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am index b75ed464a907..9370da4e3e74 100644 --- a/lib/libzfs_core/Makefile.am +++ b/lib/libzfs_core/Makefile.am @@ -1,39 +1,31 @@ -include $(top_srcdir)/config/Rules.am +libzfs_core_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzfs_core_la_CFLAGS += -fvisibility=hidden -pkgconfig_DATA = libzfs_core.pc +lib_LTLIBRARIES += libzfs_core.la +CPPCHECKTARGETS += libzfs_core.la -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -lib_LTLIBRARIES = libzfs_core.la - -include $(top_srcdir)/config/Abigail.am - -USER_C = \ - libzfs_core.c +libzfs_core_la_SOURCES = \ + %D%/libzfs_core.c if BUILD_LINUX -USER_C += \ - os/linux/libzfs_core_ioctl.c +libzfs_core_la_SOURCES += \ + %D%/os/linux/libzfs_core_ioctl.c endif +libzfs_core_la_CPPFLAGS = $(AM_CPPFLAGS) if BUILD_FREEBSD -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/freebsd/zfs +libzfs_core_la_CPPFLAGS += -Iinclude/os/freebsd/zfs -USER_C += \ - os/freebsd/libzfs_core_ioctl.c +libzfs_core_la_SOURCES += \ + %D%/os/freebsd/libzfs_core_ioctl.c -VPATH += $(top_srcdir)/module/os/freebsd/zfs - -nodist_libzfs_core_la_SOURCES = zfs_ioctl_compat.c +nodist_libzfs_core_la_SOURCES = \ + module/os/freebsd/zfs/zfs_ioctl_compat.c endif -libzfs_core_la_SOURCES = $(USER_C) - libzfs_core_la_LIBADD = \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libspl/libspl.la + libnvpair.la \ + libspl.la libzfs_core_la_LIBADD += $(LTLIBINTL) @@ -49,7 +41,6 @@ endif libzfs_core_la_LDFLAGS += -version-info 3:0:0 -include $(top_srcdir)/config/CppCheck.am +pkgconfig_DATA += %D%/libzfs_core.pc -# Library ABI -EXTRA_DIST = libzfs_core.abi libzfs_core.suppr +EXTRA_DIST += $(addprefix %D%/,libzfs_core.abi libzfs_core.suppr) diff --git a/lib/libzfsbootenv/Makefile.am b/lib/libzfsbootenv/Makefile.am index a9f19ad5bb1d..7b87bfe6786b 100644 --- a/lib/libzfsbootenv/Makefile.am +++ b/lib/libzfsbootenv/Makefile.am @@ -1,33 +1,20 @@ -include $(top_srcdir)/config/Rules.am +libzfsbootenv_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzfsbootenv_la_CFLAGS += -fvisibility=hidden -pkgconfig_DATA = libzfsbootenv.pc +lib_LTLIBRARIES += libzfsbootenv.la +CPPCHECKTARGETS += libzfsbootenv.la -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -lib_LTLIBRARIES = libzfsbootenv.la - -include $(top_srcdir)/config/Abigail.am - -if BUILD_FREEBSD -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/freebsd/zfs -endif -if BUILD_LINUX -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/linux/zfs -endif - -USER_C = \ - lzbe_device.c \ - lzbe_pair.c \ - lzbe_util.c +libzfsbootenv_la_CPPFLAGS = $(AM_CPPFLAGS) +libzfsbootenv_la_CPPFLAGS += -I$(srcdir)/include/os/@ac_system_l@/zfs dist_libzfsbootenv_la_SOURCES = \ - $(USER_C) + %D%/lzbe_device.c \ + %D%/lzbe_pair.c \ + %D%/lzbe_util.c libzfsbootenv_la_LIBADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + libzfs.la \ + libnvpair.la libzfsbootenv_la_LDFLAGS = @@ -37,7 +24,6 @@ endif libzfsbootenv_la_LDFLAGS += -version-info 1:0:0 -include $(top_srcdir)/config/CppCheck.am +pkgconfig_DATA += %D%/libzfsbootenv.pc -# Library ABI -EXTRA_DIST = libzfsbootenv.abi libzfsbootenv.suppr +EXTRA_DIST += $(addprefix %D%/,libzfsbootenv.abi libzfsbootenv.suppr) diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index 63b36c67703c..60eb30749847 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -1,223 +1,196 @@ -include $(top_srcdir)/config/Rules.am +libzpool_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) +libzpool_la_CFLAGS += $(ZLIB_CFLAGS) -VPATH = \ - $(top_srcdir)/module/zfs \ - $(top_srcdir)/module/zcommon \ - $(top_srcdir)/module/lua \ - $(top_srcdir)/module/os/linux/zfs \ - $(top_srcdir)/lib/libzpool +libzpool_la_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) +libzpool_la_CPPFLAGS += -I$(srcdir)/include/os/@ac_system_l@/zfs +libzpool_la_CPPFLAGS += -DLIB_ZPOOL_BUILD -if BUILD_FREEBSD -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/freebsd/zfs -endif -if BUILD_LINUX -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/linux/zfs -endif - -# Unconditionally enable debugging for libzpool -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG - -# Includes kernel code generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -AM_CFLAGS += $(ZLIB_CFLAGS) - -AM_CFLAGS += -DLIB_ZPOOL_BUILD - -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -lib_LTLIBRARIES = libzpool.la - -USER_C = \ - kernel.c \ - taskq.c \ - util.c - -KERNEL_C = \ - zfeature_common.c \ - zfs_comutil.c \ - zfs_deleg.c \ - zfs_fletcher.c \ - zfs_fletcher_aarch64_neon.c \ - zfs_fletcher_avx512.c \ - zfs_fletcher_intel.c \ - zfs_fletcher_sse.c \ - zfs_fletcher_superscalar.c \ - zfs_fletcher_superscalar4.c \ - zfs_namecheck.c \ - zfs_prop.c \ - zpool_prop.c \ - zprop_common.c \ - abd.c \ - abd_os.c \ - aggsum.c \ - arc.c \ - arc_os.c \ - blkptr.c \ - bplist.c \ - bpobj.c \ - bptree.c \ - bqueue.c \ - btree.c \ - cityhash.c \ - dbuf.c \ - dbuf_stats.c \ - ddt.c \ - ddt_zap.c \ - dmu.c \ - dmu_diff.c \ - dmu_object.c \ - dmu_objset.c \ - dmu_recv.c \ - dmu_redact.c \ - dmu_send.c \ - dmu_traverse.c \ - dmu_tx.c \ - dmu_zfetch.c \ - dnode.c \ - dnode_sync.c \ - dsl_bookmark.c \ - dsl_crypt.c \ - dsl_dataset.c \ - dsl_deadlist.c \ - dsl_deleg.c \ - dsl_destroy.c \ - dsl_dir.c \ - dsl_pool.c \ - dsl_prop.c \ - dsl_scan.c \ - dsl_synctask.c \ - dsl_userhold.c \ - edonr_zfs.c \ - fm.c \ - gzip.c \ - hkdf.c \ - lz4.c \ - lz4_zfs.c \ - lzjb.c \ - metaslab.c \ - mmp.c \ - multilist.c \ - objlist.c \ - pathname.c \ - range_tree.c \ - refcount.c \ - rrwlock.c \ - sa.c \ - sha256.c \ - skein_zfs.c \ - spa.c \ - spa_boot.c \ - spa_checkpoint.c \ - spa_config.c \ - spa_errlog.c \ - spa_history.c \ - spa_log_spacemap.c \ - spa_misc.c \ - spa_stats.c \ - space_map.c \ - space_reftree.c \ - trace.c \ - txg.c \ - uberblock.c \ - unique.c \ - vdev.c \ - vdev_cache.c \ - vdev_draid.c \ - vdev_draid_rand.c \ - vdev_file.c \ - vdev_indirect.c \ - vdev_indirect_births.c \ - vdev_indirect_mapping.c \ - vdev_initialize.c \ - vdev_label.c \ - vdev_mirror.c \ - vdev_missing.c \ - vdev_queue.c \ - vdev_raidz.c \ - vdev_raidz_math.c \ - vdev_raidz_math_aarch64_neon.c \ - vdev_raidz_math_aarch64_neonx2.c \ - vdev_raidz_math_avx2.c \ - vdev_raidz_math_avx512bw.c \ - vdev_raidz_math_avx512f.c \ - vdev_raidz_math_powerpc_altivec.c \ - vdev_raidz_math_scalar.c \ - vdev_raidz_math_sse2.c \ - vdev_raidz_math_ssse3.c \ - vdev_rebuild.c \ - vdev_removal.c \ - vdev_root.c \ - vdev_trim.c \ - zap.c \ - zap_leaf.c \ - zap_micro.c \ - zcp.c \ - zcp_get.c \ - zcp_global.c \ - zcp_iter.c \ - zcp_set.c \ - zcp_synctask.c \ - zfeature.c \ - zfs_byteswap.c \ - zfs_debug.c \ - zfs_fm.c \ - zfs_fuid.c \ - zfs_racct.c \ - zfs_sa.c \ - zfs_ratelimit.c \ - zfs_rlock.c \ - zfs_znode.c \ - zil.c \ - zio.c \ - zio_checksum.c \ - zio_compress.c \ - zio_crypt.c \ - zio_inject.c \ - zle.c \ - zrlock.c \ - zthr.c - -LUA_C = \ - lapi.c \ - lauxlib.c \ - lbaselib.c \ - lcode.c \ - lcompat.c \ - lcorolib.c \ - lctype.c \ - ldebug.c \ - ldo.c \ - lfunc.c \ - lgc.c \ - llex.c \ - lmem.c \ - lobject.c \ - lopcodes.c \ - lparser.c \ - lstate.c \ - lstring.c \ - lstrlib.c \ - ltable.c \ - ltablib.c \ - ltm.c \ - lvm.c \ - lzio.c +lib_LTLIBRARIES += libzpool.la +CPPCHECKTARGETS += libzpool.la dist_libzpool_la_SOURCES = \ - $(USER_C) + %D%/kernel.c \ + %D%/taskq.c \ + %D%/util.c nodist_libzpool_la_SOURCES = \ - $(KERNEL_C) \ - $(LUA_C) + module/lua/lapi.c \ + module/lua/lauxlib.c \ + module/lua/lbaselib.c \ + module/lua/lcode.c \ + module/lua/lcompat.c \ + module/lua/lcorolib.c \ + module/lua/lctype.c \ + module/lua/ldebug.c \ + module/lua/ldo.c \ + module/lua/lfunc.c \ + module/lua/lgc.c \ + module/lua/llex.c \ + module/lua/lmem.c \ + module/lua/lobject.c \ + module/lua/lopcodes.c \ + module/lua/lparser.c \ + module/lua/lstate.c \ + module/lua/lstring.c \ + module/lua/lstrlib.c \ + module/lua/ltable.c \ + module/lua/ltablib.c \ + module/lua/ltm.c \ + module/lua/lvm.c \ + module/lua/lzio.c \ + \ + module/os/linux/zfs/abd_os.c \ + module/os/linux/zfs/arc_os.c \ + module/os/linux/zfs/trace.c \ + module/os/linux/zfs/vdev_file.c \ + module/os/linux/zfs/zfs_debug.c \ + module/os/linux/zfs/zfs_racct.c \ + module/os/linux/zfs/zfs_znode.c \ + module/os/linux/zfs/zio_crypt.c \ + \ + module/zcommon/cityhash.c \ + module/zcommon/zfeature_common.c \ + module/zcommon/zfs_comutil.c \ + module/zcommon/zfs_deleg.c \ + module/zcommon/zfs_fletcher.c \ + module/zcommon/zfs_fletcher_aarch64_neon.c \ + module/zcommon/zfs_fletcher_avx512.c \ + module/zcommon/zfs_fletcher_intel.c \ + module/zcommon/zfs_fletcher_sse.c \ + module/zcommon/zfs_fletcher_superscalar.c \ + module/zcommon/zfs_fletcher_superscalar4.c \ + module/zcommon/zfs_namecheck.c \ + module/zcommon/zfs_prop.c \ + module/zcommon/zpool_prop.c \ + module/zcommon/zprop_common.c \ + \ + module/zfs/abd.c \ + module/zfs/aggsum.c \ + module/zfs/arc.c \ + module/zfs/blkptr.c \ + module/zfs/bplist.c \ + module/zfs/bpobj.c \ + module/zfs/bptree.c \ + module/zfs/bqueue.c \ + module/zfs/btree.c \ + module/zfs/dbuf.c \ + module/zfs/dbuf_stats.c \ + module/zfs/ddt.c \ + module/zfs/ddt_zap.c \ + module/zfs/dmu.c \ + module/zfs/dmu_diff.c \ + module/zfs/dmu_object.c \ + module/zfs/dmu_objset.c \ + module/zfs/dmu_recv.c \ + module/zfs/dmu_redact.c \ + module/zfs/dmu_send.c \ + module/zfs/dmu_traverse.c \ + module/zfs/dmu_tx.c \ + module/zfs/dmu_zfetch.c \ + module/zfs/dnode.c \ + module/zfs/dnode_sync.c \ + module/zfs/dsl_bookmark.c \ + module/zfs/dsl_crypt.c \ + module/zfs/dsl_dataset.c \ + module/zfs/dsl_deadlist.c \ + module/zfs/dsl_deleg.c \ + module/zfs/dsl_destroy.c \ + module/zfs/dsl_dir.c \ + module/zfs/dsl_pool.c \ + module/zfs/dsl_prop.c \ + module/zfs/dsl_scan.c \ + module/zfs/dsl_synctask.c \ + module/zfs/dsl_userhold.c \ + module/zfs/edonr_zfs.c \ + module/zfs/fm.c \ + module/zfs/gzip.c \ + module/zfs/hkdf.c \ + module/zfs/lz4.c \ + module/zfs/lz4_zfs.c \ + module/zfs/lzjb.c \ + module/zfs/metaslab.c \ + module/zfs/mmp.c \ + module/zfs/multilist.c \ + module/zfs/objlist.c \ + module/zfs/pathname.c \ + module/zfs/range_tree.c \ + module/zfs/refcount.c \ + module/zfs/rrwlock.c \ + module/zfs/sa.c \ + module/zfs/sha256.c \ + module/zfs/skein_zfs.c \ + module/zfs/spa.c \ + module/zfs/spa_boot.c \ + module/zfs/spa_checkpoint.c \ + module/zfs/spa_config.c \ + module/zfs/spa_errlog.c \ + module/zfs/spa_history.c \ + module/zfs/spa_log_spacemap.c \ + module/zfs/spa_misc.c \ + module/zfs/spa_stats.c \ + module/zfs/space_map.c \ + module/zfs/space_reftree.c \ + module/zfs/txg.c \ + module/zfs/uberblock.c \ + module/zfs/unique.c \ + module/zfs/vdev.c \ + module/zfs/vdev_cache.c \ + module/zfs/vdev_draid.c \ + module/zfs/vdev_draid_rand.c \ + module/zfs/vdev_indirect.c \ + module/zfs/vdev_indirect_births.c \ + module/zfs/vdev_indirect_mapping.c \ + module/zfs/vdev_initialize.c \ + module/zfs/vdev_label.c \ + module/zfs/vdev_mirror.c \ + module/zfs/vdev_missing.c \ + module/zfs/vdev_queue.c \ + module/zfs/vdev_raidz.c \ + module/zfs/vdev_raidz_math.c \ + module/zfs/vdev_raidz_math_aarch64_neon.c \ + module/zfs/vdev_raidz_math_aarch64_neonx2.c \ + module/zfs/vdev_raidz_math_avx2.c \ + module/zfs/vdev_raidz_math_avx512bw.c \ + module/zfs/vdev_raidz_math_avx512f.c \ + module/zfs/vdev_raidz_math_powerpc_altivec.c \ + module/zfs/vdev_raidz_math_scalar.c \ + module/zfs/vdev_raidz_math_sse2.c \ + module/zfs/vdev_raidz_math_ssse3.c \ + module/zfs/vdev_rebuild.c \ + module/zfs/vdev_removal.c \ + module/zfs/vdev_root.c \ + module/zfs/vdev_trim.c \ + module/zfs/zap.c \ + module/zfs/zap_leaf.c \ + module/zfs/zap_micro.c \ + module/zfs/zcp.c \ + module/zfs/zcp_get.c \ + module/zfs/zcp_global.c \ + module/zfs/zcp_iter.c \ + module/zfs/zcp_set.c \ + module/zfs/zcp_synctask.c \ + module/zfs/zfeature.c \ + module/zfs/zfs_byteswap.c \ + module/zfs/zfs_fm.c \ + module/zfs/zfs_fuid.c \ + module/zfs/zfs_ratelimit.c \ + module/zfs/zfs_rlock.c \ + module/zfs/zfs_sa.c \ + module/zfs/zil.c \ + module/zfs/zio.c \ + module/zfs/zio_checksum.c \ + module/zfs/zio_compress.c \ + module/zfs/zio_inject.c \ + module/zfs/zle.c \ + module/zfs/zrlock.c \ + module/zfs/zthr.c libzpool_la_LIBADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libunicode/libunicode.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libzstd/libzstd.la \ - $(abs_top_builddir)/lib/libzutil/libzutil.la + libicp.la \ + libunicode.la \ + libnvpair.la \ + libzstd.la \ + libzutil.la libzpool_la_LIBADD += $(LIBCLOCK_GETTIME) $(ZLIB_LIBS) -ldl -lm @@ -234,8 +207,6 @@ endif libzpool_la_LDFLAGS += -version-info 5:0:0 if TARGET_CPU_POWERPC -vdev_raidz_math_powerpc_altivec.$(OBJEXT): CFLAGS += -maltivec -vdev_raidz_math_powerpc_altivec.l$(OBJEXT): CFLAGS += -maltivec +module/zfs/libzpool_la-vdev_raidz_math_powerpc_altivec.$(OBJEXT) : CFLAGS += -maltivec +module/zfs/libzpool_la-vdev_raidz_math_powerpc_altivec.l$(OBJEXT): CFLAGS += -maltivec endif - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libzstd/Makefile.am b/lib/libzstd/Makefile.am index e7de3e979fb8..729856862644 100644 --- a/lib/libzstd/Makefile.am +++ b/lib/libzstd/Makefile.am @@ -1,44 +1,33 @@ -include $(top_srcdir)/config/Rules.am - -VPATH = $(top_srcdir)/module/zstd - +libzstd_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) # -fno-tree-vectorize is set for gcc in zstd/common/compiler.h # Set it for other compilers, too. -AM_CFLAGS += -fno-tree-vectorize -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libzstd.la - -KERNEL_C = lib/common/entropy_common.c \ - lib/common/error_private.c \ - lib/common/fse_decompress.c \ - lib/common/pool.c \ - lib/common/zstd_common.c \ - lib/compress/fse_compress.c \ - lib/compress/hist.c \ - lib/compress/huf_compress.c \ - lib/compress/zstd_compress_literals.c \ - lib/compress/zstd_compress_sequences.c \ - lib/compress/zstd_compress_superblock.c \ - lib/compress/zstd_compress.c \ - lib/compress/zstd_double_fast.c \ - lib/compress/zstd_fast.c \ - lib/compress/zstd_lazy.c \ - lib/compress/zstd_ldm.c \ - lib/compress/zstd_opt.c \ - lib/decompress/huf_decompress.c \ - lib/decompress/zstd_ddict.c \ - lib/decompress/zstd_decompress.c \ - lib/decompress/zstd_decompress_block.c \ - zfs_zstd.c - -nodist_libzstd_la_SOURCES = $(KERNEL_C) - -%.$(OBJEXT): CFLAGS += -fno-tree-vectorize -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -Wp,-w -%.l$(OBJEXT): CFLAGS += -fno-tree-vectorize -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -Wp,-w - -zfs_zstd.$(OBJEXT): CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -zfs_zstd.l$(OBJEXT): CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h - -include $(top_srcdir)/config/CppCheck.am +libzstd_la_CFLAGS += -fno-tree-vectorize + +noinst_LTLIBRARIES += libzstd.la +CPPCHECKTARGETS += libzstd.la + +nodist_libzstd_la_SOURCES = \ + module/zstd/lib/common/entropy_common.c \ + module/zstd/lib/common/error_private.c \ + module/zstd/lib/common/fse_decompress.c \ + module/zstd/lib/common/pool.c \ + module/zstd/lib/common/zstd_common.c \ + module/zstd/lib/compress/fse_compress.c \ + module/zstd/lib/compress/hist.c \ + module/zstd/lib/compress/huf_compress.c \ + module/zstd/lib/compress/zstd_compress_literals.c \ + module/zstd/lib/compress/zstd_compress_sequences.c \ + module/zstd/lib/compress/zstd_compress_superblock.c \ + module/zstd/lib/compress/zstd_compress.c \ + module/zstd/lib/compress/zstd_double_fast.c \ + module/zstd/lib/compress/zstd_fast.c \ + module/zstd/lib/compress/zstd_lazy.c \ + module/zstd/lib/compress/zstd_ldm.c \ + module/zstd/lib/compress/zstd_opt.c \ + module/zstd/lib/decompress/huf_decompress.c \ + module/zstd/lib/decompress/zstd_ddict.c \ + module/zstd/lib/decompress/zstd_decompress.c \ + module/zstd/lib/decompress/zstd_decompress_block.c \ + module/zstd/zfs_zstd.c + +libzstd_la_CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -fno-tree-vectorize -Wp,-w $(AM_CFLAGS) diff --git a/lib/libzutil/Makefile.am b/lib/libzutil/Makefile.am index 5a253c2afbe3..ecdf940508b2 100644 --- a/lib/libzutil/Makefile.am +++ b/lib/libzutil/Makefile.am @@ -1,47 +1,42 @@ -include $(top_srcdir)/config/Rules.am +libzutil_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzutil_la_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS) +libzutil_la_CFLAGS += -fvisibility=hidden -AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +libzutil_la_CPPFLAGS = $(AM_CPPFLAGS) +libzutil_la_CPPFLAGS += -I$(srcdir)/%D% -DEFAULT_INCLUDES += -I$(srcdir) +noinst_LTLIBRARIES += libzutil.la +CPPCHECKTARGETS += libzutil.la -noinst_LTLIBRARIES = libzutil.la - -USER_C = \ - zutil_device_path.c \ - zutil_import.c \ - zutil_import.h \ - zutil_nicenum.c \ - zutil_pool.c +libzutil_la_SOURCES = \ + %D%/zutil_device_path.c \ + %D%/zutil_import.c \ + %D%/zutil_import.h \ + %D%/zutil_nicenum.c \ + %D%/zutil_pool.c if BUILD_LINUX -USER_C += \ - os/linux/zutil_device_path_os.c \ - os/linux/zutil_import_os.c +libzutil_la_SOURCES += \ + %D%/os/linux/zutil_device_path_os.c \ + %D%/os/linux/zutil_import_os.c endif if BUILD_FREEBSD -USER_C += \ - os/freebsd/zutil_device_path_os.c \ - os/freebsd/zutil_import_os.c +libzutil_la_SOURCES += \ + %D%/os/freebsd/zutil_device_path_os.c \ + %D%/os/freebsd/zutil_import_os.c endif -libzutil_la_SOURCES = $(USER_C) - libzutil_la_LIBADD = \ - $(abs_top_builddir)/lib/libavl/libavl.la \ - $(abs_top_builddir)/lib/libtpool/libtpool.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libspl/libspl.la + libavl.la \ + libtpool.la \ + libnvpair.la \ + libspl.la if BUILD_LINUX libzutil_la_LIBADD += \ - $(abs_top_builddir)/lib/libefi/libefi.la \ + libefi.la \ -lrt endif libzutil_la_LIBADD += -lm $(LIBBLKID_LIBS) $(LIBUDEV_LIBS) - -include $(top_srcdir)/config/CppCheck.am diff --git a/module/Makefile.in b/module/Makefile.in index e6ca94b92c1d..5b71e1abf79e 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -5,15 +5,17 @@ INSTALL_MOD_PATH ?= $(DESTDIR) all: modules distclean maintainer-clean: clean -install: modules_install -uninstall: modules_uninstall +install: modules_install data_install +uninstall: modules_uninstall data_uninstall check: .PHONY: all distclean maintainer-clean install uninstall check distdir \ modules modules-Linux modules-FreeBSD modules-unknown \ clean clean-Linux clean-FreeBSD \ modules_install modules_install-Linux modules_install-FreeBSD \ + data_install data_install-Linux data_install-FreeBSD \ modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD \ + data_uninstall data_uninstall-Linux data_uninstall-FreeBSD \ cppcheck cppcheck-Linux cppcheck-FreeBSD # For FreeBSD, use debug options from ./configure if not overridden. @@ -110,6 +112,15 @@ modules_install-FreeBSD: modules_install: modules_install-@ac_system@ +data_install-Linux: + @mkdir -p $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@ + cp ../zfs.release ../zfs_config.h @LINUX_SYMBOLS@ $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@ + +data_install-FreeBSD: + @ + +data_install: data_install-@ac_system@ + modules_uninstall-Linux: modules_uninstall-Linux-legacy @# Uninstall the kernel modules $(RM) $(addprefix $(KMODDIR)/$(INSTALL_MOD_DIR)/,zfs.ko spl.ko) @@ -119,6 +130,14 @@ modules_uninstall-FreeBSD: modules_uninstall: modules_uninstall-@ac_system@ +data_uninstall-Linux: + $(RM) $(addprefix $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@/,zfs.release zfs_config.h @LINUX_SYMBOLS@) + +data_uninstall-FreeBSD: + @ + +data_uninstall: data_uninstall-@ac_system@ + cppcheck-Linux: @CPPCHECK@ -j@CPU_COUNT@ --std=c99 --quiet --force --error-exitcode=2 \ --inline-suppr \ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index fffeb6b212d5..775759187a20 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -45,7 +45,7 @@ export ZPOOL_SCRIPT_DIR=$$CMD_DIR/zpool/zpool.d export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/zpool/zpool.d export ZPOOL_COMPAT_DIR=$$CMD_DIR/zpool/compatibility.d export CONTRIB_DIR=@abs_top_builddir@/contrib -export LIB_DIR=@abs_top_builddir@/lib +export LIB_DIR=@abs_top_builddir@/.libs export SYSCONF_DIR=@abs_top_builddir@/etc export INSTALL_UDEV_DIR=@udevdir@ diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh index a86a6eb61a60..93a047f22cd9 100755 --- a/scripts/zfs-helpers.sh +++ b/scripts/zfs-helpers.sh @@ -174,10 +174,8 @@ if [ "${INSTALL}" = "yes" ]; then # Ideally we would install these in the configured ${libdir}, which is # by default "/usr/local/lib and unfortunately not included in the # dynamic linker search path. - install "$(find "$LIB_DIR/libzfs_core" -type f -name 'libzfs_core.so*')" \ - "/lib/libzfs_core.so" - install "$(find "$LIB_DIR/libnvpair" -type f -name 'libnvpair.so*')" \ - "/lib/libnvpair.so" + install "$(find "$LIB_DIR" -type f -name 'libzfs_core.so*')" "/lib/libzfs_core.so" + install "$(find "$LIB_DIR" -type f -name 'libnvpair.so*')" "/lib/libnvpair.so" ldconfig else remove "$INSTALL_MOUNT_HELPER_DIR/mount.zfs" diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am index c8be6f0559f2..266d2cdb9c08 100644 --- a/tests/zfs-tests/cmd/Makefile.am +++ b/tests/zfs-tests/cmd/Makefile.am @@ -6,18 +6,17 @@ pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin pkgexec_PROGRAMS = badsend badsend_SOURCES = badsend.c badsend_LDADD = \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libnvpair.la pkgexec_PROGRAMS += btree_test btree_test_SOURCES = btree_test.c -# Unconditionally enable ASSERTs -btree_test_CPPFLAGS = $(AM_CPPFLAGS) -DDEBUG -UNDEBUG -DZFS_DEBUG +btree_test_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) btree_test_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la pkgexec_PROGRAMS += chg_usr_exec @@ -40,8 +39,8 @@ pkgexec_PROGRAMS += draid draid_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) draid_SOURCES = draid.c draid_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libnvpair.la draid_LDADD += $(ZLIB_LIBS) @@ -67,8 +66,8 @@ if BUILD_LINUX libzfs_input_check_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/include/os/linux/zfs endif libzfs_input_check_LDADD = \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la @@ -99,8 +98,8 @@ endif pkgexec_PROGRAMS += nvlist_to_lua nvlist_to_lua_SOURCES = nvlist_to_lua.c nvlist_to_lua_LDADD = \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la pkgexec_PROGRAMS += rename_dir @@ -113,9 +112,9 @@ rm_lnkcnt_zero_file_LDADD = -lpthread pkgexec_PROGRAMS += send_doall send_doall_SOURCES = send_doall.c send_doall_LDADD = \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libnvpair.la pkgexec_PROGRAMS += stride_dd stride_dd_SOURCES = stride_dd.c @@ -140,8 +139,8 @@ truncate_test_SOURCES = truncate_test.c pkgexec_PROGRAMS += ereports ereports_SOURCES = ereports.c ereports_LDADD = \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libzfs.la pkgexec_PROGRAMS += zfs_diff-socket zfs_diff_socket_SOURCES = zfs_diff-socket.c @@ -155,14 +154,14 @@ skein_test_SOURCES = checksum/skein_test.c sha2_test_SOURCES = checksum/sha2_test.c edonr_test_SOURCES = checksum/edonr_test.c skein_test_LDADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la + $(abs_top_builddir)/libicp.la \ + $(abs_top_builddir)/libspl_assert.la sha2_test_LDADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la + $(abs_top_builddir)/libicp.la \ + $(abs_top_builddir)/libspl_assert.la edonr_test_LDADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la + $(abs_top_builddir)/libicp.la \ + $(abs_top_builddir)/libspl_assert.la if BUILD_LINUX diff --git a/tests/zfs-tests/tests/functional/hkdf/Makefile.am b/tests/zfs-tests/tests/functional/hkdf/Makefile.am index 1d126c4a907a..bb8a41f6c0c1 100644 --- a/tests/zfs-tests/tests/functional/hkdf/Makefile.am +++ b/tests/zfs-tests/tests/functional/hkdf/Makefile.am @@ -5,4 +5,4 @@ pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf pkgexec_PROGRAMS = hkdf_test hkdf_test_SOURCES = hkdf_test.c hkdf_test_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la + $(abs_top_builddir)/libzpool.la diff --git a/tests/zfs-tests/tests/functional/libzfs/Makefile.am b/tests/zfs-tests/tests/functional/libzfs/Makefile.am index 51482f4e63b5..f9cce0c6b280 100644 --- a/tests/zfs-tests/tests/functional/libzfs/Makefile.am +++ b/tests/zfs-tests/tests/functional/libzfs/Makefile.am @@ -11,4 +11,4 @@ dist_pkgdata_SCRIPTS = \ pkgexec_PROGRAMS = many_fds many_fds_SOURCES = many_fds.c many_fds_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la + $(abs_top_builddir)/libzfs.la From 3ff81c460114e0b3f69a9993d4777ec2c590fb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 8 Apr 2022 03:58:14 +0200 Subject: [PATCH 010/119] cmd: zvol_id: don't build with -fno-stack-protector anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #569 was opened in 2012 and closed in 2015; if the issue was still there we'd presumably've seen it? Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- cmd/zvol_id/Makefile.am | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmd/zvol_id/Makefile.am b/cmd/zvol_id/Makefile.am index e51349b8c61d..edac0adfce44 100644 --- a/cmd/zvol_id/Makefile.am +++ b/cmd/zvol_id/Makefile.am @@ -1,9 +1,5 @@ include $(top_srcdir)/config/Rules.am -# Disable GCC stack protection for zvol_id. This is a kludge and should be -# removed once https://github.com/openzfs/zfs/issues/569 is resolved. -AM_CFLAGS += -fno-stack-protector - udev_PROGRAMS = zvol_id zvol_id_SOURCES = \ From 5cdca5b1da7884c54260db473f892354bc79951b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 9 Apr 2022 04:09:55 +0200 Subject: [PATCH 011/119] autoconf: use include directives instead of recursing down cmd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No installation diff, dist lost -zfs-2.1.99/cmd/fsck_zfs/fsck.zfs which was distributed erroneously, since it's generated Also clean gitrev on clean Also add -e 'any possible bashisms' to default checkbashisms flags, and fully parallelise it and shellcheck, and it works out-of-tree, too Also align the Release in the dist META file correctly Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- .gitignore | 90 +++++---- Makefile.am | 32 +-- cmd/Makefile.am | 50 +++-- cmd/arc_summary/.gitignore | 1 - cmd/arc_summary/Makefile.am | 12 +- cmd/arcstat/.gitignore | 1 - cmd/arcstat/Makefile.am | 9 +- cmd/dbufstat/.gitignore | 1 - cmd/dbufstat/Makefile.am | 9 +- cmd/fsck_zfs/.gitignore | 1 - cmd/fsck_zfs/Makefile.am | 12 +- cmd/fsck_zfs/fsck.zfs.in | 4 +- cmd/mount_zfs/.gitignore | 1 - cmd/mount_zfs/Makefile.am | 17 +- cmd/raidz_test/.gitignore | 1 - cmd/raidz_test/Makefile.am | 22 +- cmd/vdev_id/Makefile.am | 5 +- cmd/zdb/.gitignore | 1 - cmd/zdb/Makefile.am | 22 +- cmd/zed/Makefile.am | 82 ++++---- cmd/zed/zed.d/Makefile.am | 68 +++---- cmd/zfs/.gitignore | 1 - cmd/zfs/Makefile.am | 28 ++- cmd/zfs_ids_to_path/.gitignore | 1 - cmd/zfs_ids_to_path/Makefile.am | 12 +- cmd/zgenhostid/.gitignore | 1 - cmd/zgenhostid/Makefile.am | 11 +- cmd/zhack/.gitignore | 1 - cmd/zhack/Makefile.am | 18 +- cmd/zinject/.gitignore | 1 - cmd/zinject/Makefile.am | 20 +- cmd/zpool/.gitignore | 1 - cmd/zpool/Makefile.am | 191 +++++++++--------- cmd/zpool_influxdb/.gitignore | 1 - cmd/zpool_influxdb/Makefile.am | 16 +- cmd/zstream/.gitignore | 1 - cmd/zstream/Makefile.am | 25 +-- cmd/ztest/.gitignore | 1 - cmd/ztest/Makefile.am | 24 +-- cmd/zvol_id/.gitignore | 1 - cmd/zvol_id/Makefile.am | 10 +- cmd/zvol_wait/Makefile.am | 5 +- config/Shellcheck.am | 46 +++-- config/Substfiles.am | 30 +-- configure.ac | 22 -- contrib/bash_completion.d/Makefile.am | 4 +- contrib/bpftrace/Makefile.am | 2 +- .../dracut/02zfsexpandknowledge/Makefile.am | 3 + contrib/dracut/90zfs/Makefile.am | 3 + contrib/initramfs/Makefile.am | 2 +- contrib/initramfs/hooks/Makefile.am | 3 + contrib/initramfs/scripts/Makefile.am | 1 + .../initramfs/scripts/local-top/Makefile.am | 3 +- etc/default/Makefile.am | 3 + etc/init.d/Makefile.am | 3 + etc/systemd/system/Makefile.am | 2 + etc/zfs/Makefile.am | 3 + man/Makefile.am | 2 + scripts/Makefile.am | 20 +- scripts/zfs-helpers.sh | 47 ++--- scripts/zfs-tests.sh | 10 +- scripts/zimport.sh | 4 +- tests/Makefile.am | 3 +- tests/test-runner/bin/Makefile.am | 2 + tests/zfs-tests/.gitignore | 1 + tests/zfs-tests/include/Makefile.am | 2 + .../tests/functional/pyzfs/Makefile.am | 2 + udev/rules.d/Makefile.am | 2 + 68 files changed, 508 insertions(+), 528 deletions(-) delete mode 100644 cmd/arc_summary/.gitignore delete mode 100644 cmd/arcstat/.gitignore delete mode 100644 cmd/dbufstat/.gitignore delete mode 100644 cmd/fsck_zfs/.gitignore delete mode 100644 cmd/mount_zfs/.gitignore delete mode 100644 cmd/raidz_test/.gitignore delete mode 100644 cmd/zdb/.gitignore delete mode 100644 cmd/zfs/.gitignore delete mode 100644 cmd/zfs_ids_to_path/.gitignore delete mode 100644 cmd/zgenhostid/.gitignore delete mode 100644 cmd/zhack/.gitignore delete mode 100644 cmd/zinject/.gitignore delete mode 100644 cmd/zpool/.gitignore delete mode 100644 cmd/zpool_influxdb/.gitignore delete mode 100644 cmd/zstream/.gitignore delete mode 100644 cmd/ztest/.gitignore delete mode 100644 cmd/zvol_id/.gitignore create mode 100644 tests/zfs-tests/.gitignore diff --git a/.gitignore b/.gitignore index 056bbb8f08c9..8d91dd9466c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # -# N.B. -# This is the toplevel .gitignore file. +# This is the top-level .gitignore file: +# ignore everything except a list of allowed files. +# # This is not the place for entries that are specific to # a subdirectory. Instead add those files to the # .gitignore file in that subdirectory. @@ -10,6 +11,56 @@ # command after changing this file, to see if there are # any tracked files which get ignored after the change. +* + +!.github +!cmd +!config +!contrib +!etc +!include +!lib +!man +!module +!rpm +!scripts +!tests +!udev + +!.github/** +!cmd/** +!config/** +!contrib/** +!etc/** +!include/** +!lib/** +!man/** +!module/** +!rpm/** +!scripts/** +!tests/** +!udev/** + +!.editorconfig +!.gitignore +!.gitmodules +!AUTHORS +!autogen.sh +!CODE_OF_CONDUCT.md +!configure.ac +!copy-builtin +!COPYRIGHT +!LICENSE +!Makefile.am +!META +!NEWS +!NOTICE +!README.md +!RELEASES.md +!TEST +!zfs.release.in + + # # Normal rules # @@ -31,40 +82,7 @@ modules.order Makefile Makefile.in - -# -# Top level generated files specific to this top level dir -# -/bin -/build -/configure -/config.log -/config.status -/libtool -/zfs_config.h -/zfs_config.h.in -/zfs.release -/stamp-h1 -/aclocal.m4 -/autom4te.cache - -# -# Top level generic files -# -!.gitignore -tags -TAGS -current -cscope.* -*.rpm -*.deb -*.tar.gz *.patch *.orig -*.log *.tmp -venv - -*.so -*.so.debug -*.so.full +*.log diff --git a/Makefile.am b/Makefile.am index 24236cfe46c1..131066b4d547 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,11 @@ +CLEANFILES = +EXTRA_DIST = +INSTALL_DATA_HOOKS = + include $(top_srcdir)/config/Shellcheck.am include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/CppCheck.am +include $(top_srcdir)/config/Substfiles.am ACLOCAL_AMFLAGS = -I config @@ -9,11 +14,11 @@ if BUILD_LINUX SUBDIRS += rpm endif -EXTRA_DIST = -CPPCHECKDIRS += cmd etc/systemd/system-generators +CPPCHECKDIRS += etc/systemd/system-generators if CONFIG_USER -SUBDIRS += scripts . man tests cmd etc contrib +SUBDIRS += scripts . man tests etc contrib include $(srcdir)/%D%/lib/Makefile.am +include $(srcdir)/%D%/cmd/Makefile.am if BUILD_LINUX SUBDIRS += udev endif @@ -51,18 +56,22 @@ EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip @CODE_COVERAGE_RULES@ GITREV = include/zfs_gitrev.h - +CLEANFILES += $(GITREV) PHONY += gitrev gitrev: $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV) all: gitrev -# Double-colon rules are allowed; there are multiple independent definitions. -maintainer-clean-local:: +PHONY += install-data-hook $(INSTALL_DATA_HOOKS) +install-data-hook: $(INSTALL_DATA_HOOKS) + +PHONY += maintainer-clean-local +maintainer-clean-local: -$(RM) $(GITREV) -distclean-local:: +PHONY += distclean-local +distclean-local: -$(RM) -R autom4te*.cache build -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \ -o -name .pc -o -name .hg -o -name .git \) -prune -o \ @@ -78,9 +87,8 @@ all-local: -SCRIPT_COMMON=$(top_builddir)/scripts/common.sh $(top_srcdir)/scripts/zfs-tests.sh -c dist-hook: - $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV) - $(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release: $(RELEASE)/' \ - $(distdir)/META + $(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV) + $(SED) $(ac_inplace) 's/\(Release:[[:space:]]*\).*/\1$(RELEASE)/' $(distdir)/META PHONY += codecheck codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck zstdcheck @@ -114,8 +122,8 @@ cstyle: filter_executable = -exec test -x '{}' \; -print -SHELLCHECKDIRS = cmd contrib etc scripts tests -SHELLCHECKSCRIPTS = autogen.sh +SHELLCHECKDIRS = contrib etc scripts tests +SHELLCHECKSCRIPTS += autogen.sh PHONY += mancheck mancheck: diff --git a/cmd/Makefile.am b/cmd/Makefile.am index fbdeaee6253f..2fa281cad2ed 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -1,23 +1,39 @@ -PHONY = -include $(top_srcdir)/config/Shellcheck.am -include $(top_srcdir)/config/CppCheck.am +bin_SCRIPTS = +bin_PROGRAMS = +sbin_SCRIPTS = +sbin_PROGRAMS = +udev_PROGRAMS = +dist_bin_SCRIPTS = +zfsexec_PROGRAMS = +dist_udev_SCRIPTS = +mounthelper_PROGRAMS = -SUBDIRS = zfs zpool zdb zhack zinject zstream ztest -SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path -SUBDIRS += zpool_influxdb +include $(srcdir)/%D%/fsck_zfs/Makefile.am +include $(srcdir)/%D%/raidz_test/Makefile.am +include $(srcdir)/%D%/vdev_id/Makefile.am +include $(srcdir)/%D%/zdb/Makefile.am +include $(srcdir)/%D%/zfs/Makefile.am +include $(srcdir)/%D%/zfs_ids_to_path/Makefile.am +include $(srcdir)/%D%/zhack/Makefile.am +include $(srcdir)/%D%/zinject/Makefile.am +include $(srcdir)/%D%/zpool/Makefile.am +include $(srcdir)/%D%/zpool_influxdb/Makefile.am +include $(srcdir)/%D%/zstream/Makefile.am +include $(srcdir)/%D%/ztest/Makefile.am -CPPCHECKDIRS += zfs zpool zdb zhack zinject zstream ztest -CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb - -# TODO: #12084: SHELLCHECKDIRS += vdev_id -SHELLCHECKDIRS = fsck_zfs zed zpool zvol_wait +if BUILD_LINUX +include $(srcdir)/%D%/mount_zfs/Makefile.am +include $(srcdir)/%D%/zed/Makefile.am +include $(srcdir)/%D%/zgenhostid/Makefile.am +include $(srcdir)/%D%/zvol_id/Makefile.am +include $(srcdir)/%D%/zvol_wait/Makefile.am +endif if USING_PYTHON -SUBDIRS += arcstat arc_summary dbufstat +include $(srcdir)/%D%/arc_summary/Makefile.am +include $(srcdir)/%D%/arcstat/Makefile.am +include $(srcdir)/%D%/dbufstat/Makefile.am endif -if BUILD_LINUX -SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait -CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id -SHELLCHECKDIRS += zed -endif +PHONY += cmd +cmd: $(bin_SCRIPTS) $(bin_PROGRAMS) $(sbin_SCRIPTS) $(sbin_PROGRAMS) $(udev_PROGRAMS) $(dist_bin_SCRIPTS) $(zfsexec_PROGRAMS) $(dist_udev_SCRIPTS) $(mounthelper_PROGRAMS) diff --git a/cmd/arc_summary/.gitignore b/cmd/arc_summary/.gitignore deleted file mode 100644 index 50ba15f034e2..000000000000 --- a/cmd/arc_summary/.gitignore +++ /dev/null @@ -1 +0,0 @@ -arc_summary diff --git a/cmd/arc_summary/Makefile.am b/cmd/arc_summary/Makefile.am index f419f07e0eda..90dd981d9698 100644 --- a/cmd/arc_summary/Makefile.am +++ b/cmd/arc_summary/Makefile.am @@ -1,8 +1,8 @@ -bin_SCRIPTS = arc_summary +bin_SCRIPTS += arc_summary +CLEANFILES += arc_summary -CLEANFILES = arc_summary -EXTRA_DIST = arc_summary3 -SCRIPT = arc_summary3 +EXTRA_DIST += %D%/arc_summary3 +ARC_SUMMARY = %D%/arc_summary3 -arc_summary: $(SCRIPT) - cp $< $@ +arc_summary: $(ARC_SUMMARY) + $(AM_V_at)cp $< $@ diff --git a/cmd/arcstat/.gitignore b/cmd/arcstat/.gitignore deleted file mode 100644 index 6d6cd1ab75fc..000000000000 --- a/cmd/arcstat/.gitignore +++ /dev/null @@ -1 +0,0 @@ -arcstat diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am index d1ba989a0cd8..d7fd81074cc5 100644 --- a/cmd/arcstat/Makefile.am +++ b/cmd/arcstat/Makefile.am @@ -1,5 +1,4 @@ -include $(top_srcdir)/config/Substfiles.am - -bin_SCRIPTS = arcstat - -SUBSTFILES += $(bin_SCRIPTS) +bin_SCRIPTS += arcstat +CLEANFILES += arcstat +EXTRA_DIST += %D%/arcstat.in +$(call SUBST,arcstat,%D%/) diff --git a/cmd/dbufstat/.gitignore b/cmd/dbufstat/.gitignore deleted file mode 100644 index 2c2e913cef70..000000000000 --- a/cmd/dbufstat/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dbufstat diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am index e672a01a4227..107f35573dcb 100644 --- a/cmd/dbufstat/Makefile.am +++ b/cmd/dbufstat/Makefile.am @@ -1,5 +1,4 @@ -include $(top_srcdir)/config/Substfiles.am - -bin_SCRIPTS = dbufstat - -SUBSTFILES += $(bin_SCRIPTS) +bin_SCRIPTS += dbufstat +CLEANFILES += dbufstat +EXTRA_DIST += %D%/dbufstat.in +$(call SUBST,dbufstat,%D%/) diff --git a/cmd/fsck_zfs/.gitignore b/cmd/fsck_zfs/.gitignore deleted file mode 100644 index 0edf0309e94a..000000000000 --- a/cmd/fsck_zfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/fsck.zfs diff --git a/cmd/fsck_zfs/Makefile.am b/cmd/fsck_zfs/Makefile.am index ec955c7c7ff9..a252e3d0cb40 100644 --- a/cmd/fsck_zfs/Makefile.am +++ b/cmd/fsck_zfs/Makefile.am @@ -1,7 +1,5 @@ -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -dist_sbin_SCRIPTS = fsck.zfs - -SUBSTFILES += $(dist_sbin_SCRIPTS) - +sbin_SCRIPTS += fsck.zfs +SHELLCHECKSCRIPTS += fsck.zfs +CLEANFILES += fsck.zfs +EXTRA_DIST += %D%/fsck.zfs.in +$(call SUBST,fsck.zfs,%D%/) diff --git a/cmd/fsck_zfs/fsck.zfs.in b/cmd/fsck_zfs/fsck.zfs.in index 37096902cb94..f0d4d2ec38ca 100755 --- a/cmd/fsck_zfs/fsck.zfs.in +++ b/cmd/fsck_zfs/fsck.zfs.in @@ -7,13 +7,13 @@ # see fsck.zfs(8) # -if [ "$#" = "0" ]; then +if [ $# -eq 0 ]; then echo "Usage: $0 [options] dataset…" >&2 exit 16 fi ret=0 -for dataset in "$@"; do +for dataset; do case "$dataset" in -*) continue diff --git a/cmd/mount_zfs/.gitignore b/cmd/mount_zfs/.gitignore deleted file mode 100644 index cd9254bde3da..000000000000 --- a/cmd/mount_zfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mount.zfs diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am index a1f902c1cecb..0ba61abe5728 100644 --- a/cmd/mount_zfs/Makefile.am +++ b/cmd/mount_zfs/Makefile.am @@ -1,23 +1,20 @@ -include $(top_srcdir)/config/Rules.am - # # Ignore the prefix for the mount helper. It must be installed in /sbin/ # because this path is hardcoded in the mount(8) for security reasons. # However, if needed, the configure option --with-mounthelperdir= can be used # to override the default install location. # -sbindir=$(mounthelperdir) -sbin_PROGRAMS = mount.zfs +mounthelper_PROGRAMS += mount.zfs +CPPCHECKTARGETS += mount.zfs mount_zfs_SOURCES = \ - mount_zfs.c + %D%/mount_zfs.c mount_zfs_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la + libzfs.la \ + libzfs_core.la \ + libnvpair.la mount_zfs_LDADD += $(LTLIBINTL) -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += mount.zfs +CPPCHECKTARGETS += raidz_test diff --git a/cmd/raidz_test/.gitignore b/cmd/raidz_test/.gitignore deleted file mode 100644 index f8b83d9cce03..000000000000 --- a/cmd/raidz_test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/raidz_test diff --git a/cmd/raidz_test/Makefile.am b/cmd/raidz_test/Makefile.am index 86ac3cc945cb..3b8b60568323 100644 --- a/cmd/raidz_test/Makefile.am +++ b/cmd/raidz_test/Makefile.am @@ -1,20 +1,16 @@ -include $(top_srcdir)/config/Rules.am +raidz_test_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) +raidz_test_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -AM_CFLAGS += $(KERNEL_CFLAGS) -AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) - -bin_PROGRAMS = raidz_test +bin_PROGRAMS += raidz_test +CPPCHECKTARGETS += raidz_test raidz_test_SOURCES = \ - raidz_test.h \ - raidz_test.c \ - raidz_bench.c + %D%/raidz_bench.c \ + %D%/raidz_test.c \ + %D%/raidz_test.h raidz_test_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la + libzpool.la \ + libzfs_core.la raidz_test_LDADD += -lm - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += raidz_test diff --git a/cmd/vdev_id/Makefile.am b/cmd/vdev_id/Makefile.am index 4071c6d5ed6b..ca57a9107c62 100644 --- a/cmd/vdev_id/Makefile.am +++ b/cmd/vdev_id/Makefile.am @@ -1,3 +1,2 @@ -include $(top_srcdir)/config/Shellcheck.am - -dist_udev_SCRIPTS = vdev_id +dist_udev_SCRIPTS += %D%/vdev_id +# TODO: #12084: SHELLCHECKSCRIPTS += %D%/vdev_id diff --git a/cmd/zdb/.gitignore b/cmd/zdb/.gitignore deleted file mode 100644 index f64a3fc5a160..000000000000 --- a/cmd/zdb/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zdb diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am index 032132bc6392..b80f38b3fd57 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -1,18 +1,14 @@ -include $(top_srcdir)/config/Rules.am +zdb_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS = zdb +sbin_PROGRAMS += zdb +CPPCHECKTARGETS += zdb zdb_SOURCES = \ - zdb.c \ - zdb_il.c \ - zdb.h + %D%/zdb.c \ + %D%/zdb.h \ + %D%/zdb_il.c zdb_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zdb + libzpool.la \ + libzfs_core.la \ + libnvpair.la diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index b509516f9066..6eea1a135f56 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -1,54 +1,46 @@ -include $(top_srcdir)/config/Rules.am -include $(top_srcdir)/config/Shellcheck.am +include $(srcdir)/%D%/zed.d/Makefile.am -AM_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS) +zed_CFLAGS = $(AM_CFLAGS) +zed_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS) -SUBDIRS = zed.d -SHELLCHECKDIRS = $(SUBDIRS) - -sbin_PROGRAMS = zed - -ZED_SRC = \ - zed.c \ - zed.h \ - zed_conf.c \ - zed_conf.h \ - zed_disk_event.c \ - zed_disk_event.h \ - zed_event.c \ - zed_event.h \ - zed_exec.c \ - zed_exec.h \ - zed_file.c \ - zed_file.h \ - zed_log.c \ - zed_log.h \ - zed_strings.c \ - zed_strings.h - -FMA_SRC = \ - agents/zfs_agents.c \ - agents/zfs_agents.h \ - agents/zfs_diagnosis.c \ - agents/zfs_mod.c \ - agents/zfs_retire.c \ - agents/fmd_api.c \ - agents/fmd_api.h \ - agents/fmd_serd.c \ - agents/fmd_serd.h +sbin_PROGRAMS += zed +CPPCHECKTARGETS += zed -zed_SOURCES = $(ZED_SRC) $(FMA_SRC) +zed_SOURCES = \ + %D%/zed.c \ + %D%/zed.h \ + %D%/zed_conf.c \ + %D%/zed_conf.h \ + %D%/zed_disk_event.c \ + %D%/zed_disk_event.h \ + %D%/zed_event.c \ + %D%/zed_event.h \ + %D%/zed_exec.c \ + %D%/zed_exec.h \ + %D%/zed_file.c \ + %D%/zed_file.h \ + %D%/zed_log.c \ + %D%/zed_log.h \ + %D%/zed_strings.c \ + %D%/zed_strings.h \ + \ + %D%/agents/fmd_api.c \ + %D%/agents/fmd_api.h \ + %D%/agents/fmd_serd.c \ + %D%/agents/fmd_serd.h \ + %D%/agents/zfs_agents.c \ + %D%/agents/zfs_agents.h \ + %D%/agents/zfs_diagnosis.c \ + %D%/agents/zfs_mod.c \ + %D%/agents/zfs_retire.c zed_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libuutil.la + libzfs.la \ + libzfs_core.la \ + libnvpair.la \ + libuutil.la zed_LDADD += -lrt $(LIBATOMIC_LIBS) $(LIBUDEV_LIBS) $(LIBUUID_LIBS) zed_LDFLAGS = -pthread -EXTRA_DIST = agents/README.md - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zed +EXTRA_DIST += $(addprefix %D%/,agents/README.md) diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 3efcfb3629cf..122d2c0c51bc 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am @@ -1,36 +1,27 @@ -include $(top_srcdir)/config/Rules.am -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -EXTRA_DIST += README - zedconfdir = $(sysconfdir)/zfs/zed.d - dist_zedconf_DATA = \ - zed-functions.sh \ - zed.rc - -SHELLCHECKSCRIPTS = zed-functions.sh zed.rc -SHELLCHECK_SHELL = sh + %D%/zed-functions.sh \ + %D%/zed.rc zedexecdir = $(zfsexecdir)/zed.d dist_zedexec_SCRIPTS = \ - all-debug.sh \ - all-syslog.sh \ - data-notify.sh \ - generic-notify.sh \ - resilver_finish-notify.sh \ - scrub_finish-notify.sh \ - statechange-led.sh \ - statechange-notify.sh \ - vdev_clear-led.sh \ - vdev_attach-led.sh \ - pool_import-led.sh \ - resilver_finish-start-scrub.sh \ - trim_finish-notify.sh - -nodist_zedexec_SCRIPTS = history_event-zfs-list-cacher.sh + %D%/all-debug.sh \ + %D%/all-syslog.sh \ + %D%/data-notify.sh \ + %D%/generic-notify.sh \ + %D%/pool_import-led.sh \ + %D%/resilver_finish-notify.sh \ + %D%/resilver_finish-start-scrub.sh \ + %D%/scrub_finish-notify.sh \ + %D%/statechange-led.sh \ + %D%/statechange-notify.sh \ + %D%/trim_finish-notify.sh \ + %D%/vdev_attach-led.sh \ + %D%/vdev_clear-led.sh + +nodist_zedexec_SCRIPTS = \ + %D%/history_event-zfs-list-cacher.sh SUBSTFILES += $(nodist_zedexec_SCRIPTS) @@ -38,22 +29,27 @@ zedconfdefaults = \ all-syslog.sh \ data-notify.sh \ history_event-zfs-list-cacher.sh \ + pool_import-led.sh \ resilver_finish-notify.sh \ + resilver_finish-start-scrub.sh \ scrub_finish-notify.sh \ statechange-led.sh \ statechange-notify.sh \ - vdev_clear-led.sh \ vdev_attach-led.sh \ - pool_import-led.sh \ - resilver_finish-start-scrub.sh + vdev_clear-led.sh + +EXTRA_DIST += $(addprefix %D%/,README) -install-data-hook: +INSTALL_DATA_HOOKS += zed-install-data-hook +zed-install-data-hook: $(MKDIR_P) "$(DESTDIR)$(zedconfdir)" - for f in $(zedconfdefaults); do \ - test -f "$(DESTDIR)$(zedconfdir)/$${f}" -o \ - -L "$(DESTDIR)$(zedconfdir)/$${f}" || \ - ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \ + set -x; for f in $(zedconfdefaults); do \ + [ -f "$(DESTDIR)$(zedconfdir)/$${f}" ] ||\ + [ -L "$(DESTDIR)$(zedconfdir)/$${f}" ] || \ + $(LN_S) "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \ done +SHELLCHECKSCRIPTS += $(dist_zedconf_DATA) $(dist_zedexec_SCRIPTS) $(nodist_zedexec_SCRIPTS) +$(call SHELLCHECK_OPTS,$(dist_zedconf_DATA) $(dist_zedexec_SCRIPTS) $(nodist_zedexec_SCRIPTS)): SHELLCHECK_SHELL = sh # False positive: 1>&"${ZED_FLOCK_FD}" looks suspiciously similar to a >&filename bash extension -CHECKBASHISMS_IGNORE = -e 'should be >word 2>&1' -e '&"$${ZED_FLOCK_FD}"' +$(call SHELLCHECK_OPTS,$(dist_zedconf_DATA) $(dist_zedexec_SCRIPTS) $(nodist_zedexec_SCRIPTS)): CHECKBASHISMS_IGNORE = -e 'should be >word 2>&1' -e '&"$${ZED_FLOCK_FD}"' diff --git a/cmd/zfs/.gitignore b/cmd/zfs/.gitignore deleted file mode 100644 index 0fd9cc63af2a..000000000000 --- a/cmd/zfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zfs diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am index ca5e823aa4c8..8a3c13a1fcfe 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -1,26 +1,22 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zfs +sbin_PROGRAMS += zfs +CPPCHECKTARGETS += zfs zfs_SOURCES = \ - zfs_iter.c \ - zfs_iter.h \ - zfs_main.c \ - zfs_util.h \ - zfs_project.c \ - zfs_projectutil.h + %D%/zfs_iter.c \ + %D%/zfs_iter.h \ + %D%/zfs_main.c \ + %D%/zfs_project.c \ + %D%/zfs_projectutil.h \ + %D%/zfs_util.h zfs_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libuutil.la + libzfs.la \ + libzfs_core.la \ + libnvpair.la \ + libuutil.la zfs_LDADD += $(LTLIBINTL) if BUILD_FREEBSD zfs_LDADD += -lgeom -ljail endif - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zfs diff --git a/cmd/zfs_ids_to_path/.gitignore b/cmd/zfs_ids_to_path/.gitignore deleted file mode 100644 index f95f853e48c2..000000000000 --- a/cmd/zfs_ids_to_path/.gitignore +++ /dev/null @@ -1 +0,0 @@ -zfs_ids_to_path diff --git a/cmd/zfs_ids_to_path/Makefile.am b/cmd/zfs_ids_to_path/Makefile.am index c57f1d97780c..09ddd811616a 100644 --- a/cmd/zfs_ids_to_path/Makefile.am +++ b/cmd/zfs_ids_to_path/Makefile.am @@ -1,12 +1,8 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zfs_ids_to_path +sbin_PROGRAMS += zfs_ids_to_path +CPPCHECKTARGETS += zfs_ids_to_path zfs_ids_to_path_SOURCES = \ - zfs_ids_to_path.c + %D%/zfs_ids_to_path.c zfs_ids_to_path_LDADD = \ - $(abs_top_builddir)/libzfs.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zfs_ids_to_path + libzfs.la diff --git a/cmd/zgenhostid/.gitignore b/cmd/zgenhostid/.gitignore deleted file mode 100644 index 072246c735ba..000000000000 --- a/cmd/zgenhostid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zgenhostid diff --git a/cmd/zgenhostid/Makefile.am b/cmd/zgenhostid/Makefile.am index 96799a5a2963..722950eb777b 100644 --- a/cmd/zgenhostid/Makefile.am +++ b/cmd/zgenhostid/Makefile.am @@ -1,8 +1,5 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zgenhostid - -zgenhostid_SOURCES = zgenhostid.c - -include $(top_srcdir)/config/CppCheck.am +sbin_PROGRAMS += zgenhostid CPPCHECKTARGETS += zgenhostid + +zgenhostid_SOURCES = \ + %D%/zgenhostid.c diff --git a/cmd/zhack/.gitignore b/cmd/zhack/.gitignore deleted file mode 100644 index 763a18898b88..000000000000 --- a/cmd/zhack/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zhack diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am index fa911e9e3c59..94fa76d142ec 100644 --- a/cmd/zhack/Makefile.am +++ b/cmd/zhack/Makefile.am @@ -1,16 +1,12 @@ -include $(top_srcdir)/config/Rules.am +zhack_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS = zhack +sbin_PROGRAMS += zhack +CPPCHECKTARGETS += zhack zhack_SOURCES = \ - zhack.c + %D%/zhack.c zhack_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zhack + libzpool.la \ + libzfs_core.la \ + libnvpair.la diff --git a/cmd/zinject/.gitignore b/cmd/zinject/.gitignore deleted file mode 100644 index bded8400996c..000000000000 --- a/cmd/zinject/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zinject diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index 94a48f48b05c..c90f73fc0165 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -1,16 +1,12 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zinject +sbin_PROGRAMS += zinject +CPPCHECKTARGETS += zinject zinject_SOURCES = \ - translate.c \ - zinject.c \ - zinject.h + %D%/translate.c \ + %D%/zinject.c \ + %D%/zinject.h zinject_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zinject + libzfs.la \ + libzfs_core.la \ + libnvpair.la diff --git a/cmd/zpool/.gitignore b/cmd/zpool/.gitignore deleted file mode 100644 index 8ea518af78e5..000000000000 --- a/cmd/zpool/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zpool diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 12f2cd226266..9ba72eadf3a7 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -1,34 +1,35 @@ -include $(top_srcdir)/config/Rules.am -include $(top_srcdir)/config/Shellcheck.am +zpool_CFLAGS = $(AM_CFLAGS) +zpool_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS) -AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS) +zpool_CPPFLAGS = $(AM_CPPFLAGS) +zpool_CPPFLAGS += -I$(srcdir)/%D% -AM_CPPFLAGS += -I$(srcdir) - - -sbin_PROGRAMS = zpool +sbin_PROGRAMS += zpool +CPPCHECKTARGETS += zpool zpool_SOURCES = \ - zpool_iter.c \ - zpool_main.c \ - zpool_util.c \ - zpool_util.h \ - zpool_vdev.c + %D%/zpool_iter.c \ + %D%/zpool_main.c \ + %D%/zpool_util.c \ + %D%/zpool_util.h \ + %D%/zpool_vdev.c if BUILD_FREEBSD -zpool_SOURCES += os/freebsd/zpool_vdev_os.c +zpool_SOURCES += \ + %D%/os/freebsd/zpool_vdev_os.c endif if BUILD_LINUX -zpool_SOURCES += os/linux/zpool_vdev_os.c +zpool_SOURCES += \ + %D%/os/linux/zpool_vdev_os.c endif zpool_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libuutil.la \ - $(abs_top_builddir)/libzutil.la + libzfs.la \ + libzfs_core.la \ + libnvpair.la \ + libuutil.la \ + libzutil.la zpool_LDADD += $(LTLIBINTL) @@ -37,57 +38,53 @@ zpool_LDADD += -lgeom endif zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS) -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zpool +EXTRA_DIST += $(addprefix %D%/,zpool.d/README compatibility.d) -zpoolconfdir = $(sysconfdir)/zfs/zpool.d +SHELLCHECKSCRIPTS += $(dist_zpoolexec_SCRIPTS) zpoolexecdir = $(zfsexecdir)/zpool.d - -EXTRA_DIST = zpool.d/README compatibility.d - dist_zpoolexec_SCRIPTS = \ - zpool.d/dm-deps \ - zpool.d/enc \ - zpool.d/encdev \ - zpool.d/fault_led \ - zpool.d/iostat \ - zpool.d/iostat-1s \ - zpool.d/iostat-10s \ - zpool.d/label \ - zpool.d/locate_led \ - zpool.d/lsblk \ - zpool.d/media \ - zpool.d/model \ - zpool.d/serial \ - zpool.d/ses \ - zpool.d/size \ - zpool.d/slot \ - zpool.d/smart \ - zpool.d/smartx \ - zpool.d/temp \ - zpool.d/health \ - zpool.d/r_proc \ - zpool.d/w_proc \ - zpool.d/r_ucor \ - zpool.d/w_ucor \ - zpool.d/nonmed \ - zpool.d/defect \ - zpool.d/hours_on \ - zpool.d/realloc \ - zpool.d/rep_ucor \ - zpool.d/cmd_to \ - zpool.d/pend_sec \ - zpool.d/off_ucor \ - zpool.d/ata_err \ - zpool.d/nvme_err \ - zpool.d/pwr_cyc \ - zpool.d/upath \ - zpool.d/vendor \ - zpool.d/smart_test \ - zpool.d/test_type \ - zpool.d/test_status \ - zpool.d/test_progress \ - zpool.d/test_ended + %D%/zpool.d/ata_err \ + %D%/zpool.d/cmd_to \ + %D%/zpool.d/defect \ + %D%/zpool.d/dm-deps \ + %D%/zpool.d/enc \ + %D%/zpool.d/encdev \ + %D%/zpool.d/fault_led \ + %D%/zpool.d/health \ + %D%/zpool.d/hours_on \ + %D%/zpool.d/iostat \ + %D%/zpool.d/iostat-10s \ + %D%/zpool.d/iostat-1s \ + %D%/zpool.d/label \ + %D%/zpool.d/locate_led \ + %D%/zpool.d/lsblk \ + %D%/zpool.d/media \ + %D%/zpool.d/model \ + %D%/zpool.d/nonmed \ + %D%/zpool.d/nvme_err \ + %D%/zpool.d/off_ucor \ + %D%/zpool.d/pend_sec \ + %D%/zpool.d/pwr_cyc \ + %D%/zpool.d/r_proc \ + %D%/zpool.d/r_ucor \ + %D%/zpool.d/realloc \ + %D%/zpool.d/rep_ucor \ + %D%/zpool.d/serial \ + %D%/zpool.d/ses \ + %D%/zpool.d/size \ + %D%/zpool.d/slot \ + %D%/zpool.d/smart \ + %D%/zpool.d/smart_test \ + %D%/zpool.d/smartx \ + %D%/zpool.d/temp \ + %D%/zpool.d/test_ended \ + %D%/zpool.d/test_progress \ + %D%/zpool.d/test_status \ + %D%/zpool.d/test_type \ + %D%/zpool.d/upath \ + %D%/zpool.d/vendor \ + %D%/zpool.d/w_proc \ + %D%/zpool.d/w_ucor zpoolconfdefaults = \ dm-deps \ @@ -134,29 +131,28 @@ zpoolconfdefaults = \ test_ended zpoolcompatdir = $(pkgdatadir)/compatibility.d - dist_zpoolcompat_DATA = \ - compatibility.d/compat-2018 \ - compatibility.d/compat-2019 \ - compatibility.d/compat-2020 \ - compatibility.d/compat-2021 \ - compatibility.d/freebsd-11.0 \ - compatibility.d/freebsd-11.2 \ - compatibility.d/freebsd-11.3 \ - compatibility.d/freenas-9.10.2 \ - compatibility.d/grub2 \ - compatibility.d/openzfsonosx-1.7.0 \ - compatibility.d/openzfsonosx-1.8.1 \ - compatibility.d/openzfsonosx-1.9.3 \ - compatibility.d/openzfs-2.0-freebsd \ - compatibility.d/openzfs-2.0-linux \ - compatibility.d/openzfs-2.1-freebsd \ - compatibility.d/openzfs-2.1-linux \ - compatibility.d/zol-0.6.1 \ - compatibility.d/zol-0.6.4 \ - compatibility.d/zol-0.6.5 \ - compatibility.d/zol-0.7 \ - compatibility.d/zol-0.8 + %D%/compatibility.d/compat-2018 \ + %D%/compatibility.d/compat-2019 \ + %D%/compatibility.d/compat-2020 \ + %D%/compatibility.d/compat-2021 \ + %D%/compatibility.d/freebsd-11.0 \ + %D%/compatibility.d/freebsd-11.2 \ + %D%/compatibility.d/freebsd-11.3 \ + %D%/compatibility.d/freenas-9.10.2 \ + %D%/compatibility.d/grub2 \ + %D%/compatibility.d/openzfs-2.0-freebsd \ + %D%/compatibility.d/openzfs-2.0-linux \ + %D%/compatibility.d/openzfs-2.1-freebsd \ + %D%/compatibility.d/openzfs-2.1-linux \ + %D%/compatibility.d/openzfsonosx-1.7.0 \ + %D%/compatibility.d/openzfsonosx-1.8.1 \ + %D%/compatibility.d/openzfsonosx-1.9.3 \ + %D%/compatibility.d/zol-0.6.1 \ + %D%/compatibility.d/zol-0.6.4 \ + %D%/compatibility.d/zol-0.6.5 \ + %D%/compatibility.d/zol-0.7 \ + %D%/compatibility.d/zol-0.8 # canonical <- alias symbolic link pairs # eg: "2018" is a link to "compat-2018" @@ -179,13 +175,16 @@ zpoolcompatlinks = \ "zol-0.7 ubuntu-18.04" \ "zol-0.8 ubuntu-20.04" -install-data-hook: +zpoolconfdir = $(sysconfdir)/zfs/zpool.d +INSTALL_DATA_HOOKS += zpool-install-data-hook +zpool-install-data-hook: $(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)" - for f in $(zpoolconfdefaults); do \ - test -f "$(DESTDIR)$(zpoolconfdir)/$${f}" -o \ - -L "$(DESTDIR)$(zpoolconfdir)/$${f}" || \ - ln -s "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \ + set -x; for f in $(zpoolconfdefaults); do \ + [ -f "$(DESTDIR)$(zpoolconfdir)/$${f}" ] || \ + [ -L "$(DESTDIR)$(zpoolconfdir)/$${f}" ] || \ + $(LN_S) "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \ done - for l in $(zpoolcompatlinks); do \ - (cd "$(DESTDIR)$(zpoolcompatdir)"; ln -sf $${l} ); \ + set -x; printf '%s\n' $(zpoolcompatlinks) | \ + while read -r canon alias; do \ + $(LN_S) -f "$${canon}" "$(DESTDIR)$(zpoolcompatdir)/$${alias}"; \ done diff --git a/cmd/zpool_influxdb/.gitignore b/cmd/zpool_influxdb/.gitignore deleted file mode 100644 index bd765d188278..000000000000 --- a/cmd/zpool_influxdb/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zpool_influxdb diff --git a/cmd/zpool_influxdb/Makefile.am b/cmd/zpool_influxdb/Makefile.am index 600108137d63..b237532ce24e 100644 --- a/cmd/zpool_influxdb/Makefile.am +++ b/cmd/zpool_influxdb/Makefile.am @@ -1,14 +1,10 @@ -include $(top_srcdir)/config/Rules.am - -zfsexec_PROGRAMS = zpool_influxdb +zfsexec_PROGRAMS += zpool_influxdb +CPPCHECKTARGETS += zpool_influxdb zpool_influxdb_SOURCES = \ - zpool_influxdb.c + %D%/zpool_influxdb.c zpool_influxdb_LDADD = \ - $(top_builddir)/libspl.la \ - $(top_builddir)/libnvpair.la \ - $(top_builddir)/libzfs.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zpool_influxdb + libspl.la \ + libnvpair.la \ + libzfs.la diff --git a/cmd/zstream/.gitignore b/cmd/zstream/.gitignore deleted file mode 100644 index fd1240d55c4b..000000000000 --- a/cmd/zstream/.gitignore +++ /dev/null @@ -1 +0,0 @@ -zstream diff --git a/cmd/zstream/Makefile.am b/cmd/zstream/Makefile.am index 7749e94ba69c..9b2716ae0391 100644 --- a/cmd/zstream/Makefile.am +++ b/cmd/zstream/Makefile.am @@ -1,21 +1,18 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zstream +sbin_PROGRAMS += zstream +CPPCHECKTARGETS += zstream zstream_SOURCES = \ - zstream.c \ - zstream.h \ - zstream_dump.c \ - zstream_redup.c \ - zstream_token.c + %D%/zstream.c \ + %D%/zstream.h \ + %D%/zstream_dump.c \ + %D%/zstream_redup.c \ + %D%/zstream_token.c zstream_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zstream + libzfs.la \ + libzfs_core.la \ + libnvpair.la +PHONY += install-exec-hook install-exec-hook: cd $(DESTDIR)$(sbindir) && $(LN_S) -f zstream zstreamdump diff --git a/cmd/ztest/.gitignore b/cmd/ztest/.gitignore deleted file mode 100644 index d3d498dae693..000000000000 --- a/cmd/ztest/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/ztest diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index 353e81eb72b8..e27643a4462f 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -1,24 +1,18 @@ -include $(top_srcdir)/config/Rules.am - -AM_CFLAGS += $(KERNEL_CFLAGS) - +ztest_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) # Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 -AM_CFLAGS += $(NO_FORMAT_TRUNCATION) - -AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) +ztest_CFLAGS += $(NO_FORMAT_TRUNCATION) +ztest_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -sbin_PROGRAMS = ztest +sbin_PROGRAMS += ztest +CPPCHECKTARGETS += ztest ztest_SOURCES = \ - ztest.c + %D%/ztest.c ztest_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la + libzpool.la \ + libzfs_core.la \ + libnvpair.la ztest_LDADD += -lm ztest_LDFLAGS = -pthread - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += ztest diff --git a/cmd/zvol_id/.gitignore b/cmd/zvol_id/.gitignore deleted file mode 100644 index 8b757a2d6781..000000000000 --- a/cmd/zvol_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -zvol_id diff --git a/cmd/zvol_id/Makefile.am b/cmd/zvol_id/Makefile.am index edac0adfce44..7ba13205bc94 100644 --- a/cmd/zvol_id/Makefile.am +++ b/cmd/zvol_id/Makefile.am @@ -1,9 +1,5 @@ -include $(top_srcdir)/config/Rules.am - -udev_PROGRAMS = zvol_id +udev_PROGRAMS += zvol_id +CPPCHECKTARGETS += zvol_id zvol_id_SOURCES = \ - zvol_id_main.c - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zvol_id + %D%/zvol_id_main.c diff --git a/cmd/zvol_wait/Makefile.am b/cmd/zvol_wait/Makefile.am index 2e5bf3323389..2d3736f756ab 100644 --- a/cmd/zvol_wait/Makefile.am +++ b/cmd/zvol_wait/Makefile.am @@ -1,3 +1,2 @@ -include $(top_srcdir)/config/Shellcheck.am - -dist_bin_SCRIPTS = zvol_wait +dist_bin_SCRIPTS += %D%/zvol_wait +SHELLCHECKSCRIPTS += %D%/zvol_wait diff --git a/config/Shellcheck.am b/config/Shellcheck.am index fb0bdedd3be3..873fb8eae079 100644 --- a/config/Shellcheck.am +++ b/config/Shellcheck.am @@ -1,30 +1,46 @@ -.PHONY: shellcheck -shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS) - -# ShellCheck exclusions +# Global ShellCheck exclusions: # # ShellCheck can't follow non-constant source. Use a directive to specify location. [SC1090] # Not following: a was not specified as input (see shellcheck -x). [SC1091] # Prefer putting braces around variable references even when not strictly required. [SC2250] # In POSIX sh, 'local' is undefined. [SC2039] # older ShellCheck versions # In POSIX sh, 'local' is undefined. [SC3043] # newer ShellCheck versions + +SHELLCHECKSCRIPTS = + +JUST_SHELLCHECK_OPTS = $(addprefix shellcheck-here-,$(subst /,^,$(1))) +JUST_CHECKBASHISMS_OPTS = $(addprefix checkbashisms-here-,$(subst /,^,$(1))) +SHELLCHECK_OPTS = $(call JUST_SHELLCHECK_OPTS,$(1)) $(call JUST_CHECKBASHISMS_OPTS,$(1)) + +.PHONY: shellcheck shellcheck-recursive + +shellcheck-recursive: + @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done + +_STGT = $(subst ^,/,$(subst shellcheck-here-,,$@)) +shellcheck-here-%: if HAVE_SHELLCHECK - [ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck --format=gcc --enable=all --exclude=SC1090,SC1091,SC2039,SC2250,SC3043 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") $(SHELLCHECK_OPTS) $(SCRIPTS) $(SHELLCHECKSCRIPTS) + shellcheck --format=gcc --enable=all --exclude=SC1090,SC1091,SC2039,SC2250,SC3043 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") "$$([ -e "$(_STGT)" ] || echo "$(srcdir)/")$(_STGT)" else - @[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed" + @echo "skipping shellcheck of" $(_STGT) "because shellcheck is not installed" endif - @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done + +shellcheck: $(SHELLCHECKSCRIPTS) $(call JUST_SHELLCHECK_OPTS,$(SHELLCHECKSCRIPTS)) shellcheck-recursive +.PHONY: checkbashisms checkbashisms-recursive + +checkbashisms-recursive: + @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done + # command -v *is* specified by POSIX and every shell in existence supports it -.PHONY: checkbashisms -checkbashisms: $(SCRIPTS) $(SHELLCHECKSCRIPTS) +_BTGT = $(subst ^,/,$(subst checkbashisms-here-,,$@)) +checkbashisms-here-%: if HAVE_CHECKBASHISMS - [ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; ! if [ -z "$(SHELLCHECK_SHELL)" ]; then \ - checkbashisms -npx $(SCRIPTS) $(SHELLCHECKSCRIPTS); else \ - for f in $(SCRIPTS) $(SHELLCHECKSCRIPTS); do echo $$f >&3; { echo '#!/bin/$(SHELLCHECK_SHELL)'; cat $$f; } | checkbashisms -npx; done; \ - fi 3>&2 2>&1 | grep -vFe "'command' with option other than -p" -e 'command -v' $(CHECKBASHISMS_IGNORE) >&2 + ! { [ -n "$(SHELLCHECK_SHELL)" ] && echo '#!/bin/$(SHELLCHECK_SHELL)'; cat "$$([ -e "$(_BTGT)" ] || echo "$(srcdir)/")$(_BTGT)"; } | \ + checkbashisms -npx 2>&1 | grep -vFe "'command' with option other than -p" -e 'command -v' -e 'any possible bashisms' $(CHECKBASHISMS_IGNORE) >&2 else - @[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping checkbashisms of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because checkbashisms is not installed" + @echo "skipping checkbashisms of" $(_BTGT) "because checkbashisms is not installed" endif - @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done + +checkbashisms: $(SHELLCHECKSCRIPTS) $(call JUST_CHECKBASHISMS_OPTS,$(SHELLCHECKSCRIPTS)) checkbashisms-recursive diff --git a/config/Substfiles.am b/config/Substfiles.am index b051438fb9e3..7f069877a6ca 100644 --- a/config/Substfiles.am +++ b/config/Substfiles.am @@ -21,18 +21,22 @@ subst_sed_cmd = \ -e 's|@ASAN_ENABLED[@]|$(ASAN_ENABLED)|g' \ -e 's|@UBSAN_ENABLED[@]|$(UBSAN_ENABLED)|g' -SUBSTFILES = -CLEANFILES = $(SUBSTFILES) -EXTRA_DIST = $(SUBSTFILES:=.in) - -$(SUBSTFILES):%:%.in Makefile - $(AM_V_GEN)set -e; \ - $(MKDIR_P) $$(dirname $@); \ - $(RM) $@~; \ - $(SED) $(subst_sed_cmd) $< >$@~; \ - if grep -E '@[a-zA-Z0-9_]+@' $@~ >&2; then \ +define SUBST +$(1) : $(2)$(1).in Makefile; + $$(AM_V_GEN)set -e; \ + $$(MKDIR_P) $$(@D); \ + $$(RM) $$@~; \ + $$(SED) $$(subst_sed_cmd) $$< >$$@~; \ + if grep -E '@[a-zA-Z0-9_]+@' $$@~ >&2; then \ echo "Undefined substitution" >&2; \ exit 1; \ - else test $$? -eq 1; fi; \ - test -x $< && chmod +x $@~; \ - mv -f $@~ $@ + fi; \ + [ -x $$< ] && chmod +x $$@~; \ + mv -f $$@~ $$@ +endef + +SUBSTFILES = +CLEANFILES += $(SUBSTFILES) +EXTRA_DIST += $(SUBSTFILES:=.in) + +$(call SUBST,%,) diff --git a/configure.ac b/configure.ac index 981215995bfe..106d1876e705 100644 --- a/configure.ac +++ b/configure.ac @@ -66,28 +66,6 @@ ZFS_AC_DEBUG_INVARIANTS AC_CONFIG_FILES([ Makefile - cmd/Makefile - cmd/arc_summary/Makefile - cmd/arcstat/Makefile - cmd/dbufstat/Makefile - cmd/fsck_zfs/Makefile - cmd/mount_zfs/Makefile - cmd/raidz_test/Makefile - cmd/vdev_id/Makefile - cmd/zdb/Makefile - cmd/zed/Makefile - cmd/zed/zed.d/Makefile - cmd/zfs/Makefile - cmd/zfs_ids_to_path/Makefile - cmd/zgenhostid/Makefile - cmd/zhack/Makefile - cmd/zinject/Makefile - cmd/zpool/Makefile - cmd/zstream/Makefile - cmd/ztest/Makefile - cmd/zvol_id/Makefile - cmd/zvol_wait/Makefile - cmd/zpool_influxdb/Makefile contrib/Makefile contrib/bash_completion.d/Makefile contrib/bpftrace/Makefile diff --git a/contrib/bash_completion.d/Makefile.am b/contrib/bash_completion.d/Makefile.am index eee617802bbe..0295843ebcbe 100644 --- a/contrib/bash_completion.d/Makefile.am +++ b/contrib/bash_completion.d/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -8,5 +10,5 @@ noinst_DATA = zfs EXTRA_DIST += $(noinst_DATA) SUBSTFILES += $(noinst_DATA) -SHELLCHECKSCRIPTS = $(noinst_DATA) +SHELLCHECKSCRIPTS += $(noinst_DATA) SHELLCHECK_SHELL = bash diff --git a/contrib/bpftrace/Makefile.am b/contrib/bpftrace/Makefile.am index 05e4f1c507ce..7194ec689205 100644 --- a/contrib/bpftrace/Makefile.am +++ b/contrib/bpftrace/Makefile.am @@ -4,4 +4,4 @@ EXTRA_DIST = \ taskqlatency.bt \ zfs-trace.sh -SHELLCHECKSCRIPTS = zfs-trace.sh +SHELLCHECKSCRIPTS += zfs-trace.sh diff --git a/contrib/dracut/02zfsexpandknowledge/Makefile.am b/contrib/dracut/02zfsexpandknowledge/Makefile.am index b1bbb6bd3aac..23fcc0a3c066 100644 --- a/contrib/dracut/02zfsexpandknowledge/Makefile.am +++ b/contrib/dracut/02zfsexpandknowledge/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -6,3 +8,4 @@ pkgdracut_SCRIPTS = \ module-setup.sh SUBSTFILES += $(pkgdracut_SCRIPTS) +SHELLCHECKSCRIPTS += $(pkgdracut_SCRIPTS) diff --git a/contrib/dracut/90zfs/Makefile.am b/contrib/dracut/90zfs/Makefile.am index 3f7050300994..28bedfb394e7 100644 --- a/contrib/dracut/90zfs/Makefile.am +++ b/contrib/dracut/90zfs/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -22,3 +24,4 @@ SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA) # Provided by /bin/sleep, and, again, every implementation of that supports this CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.' +SHELLCHECKSCRIPTS += $(pkgdracut_SCRIPTS) diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am index 57e8f5c3a485..5ee8e16a0a21 100644 --- a/contrib/initramfs/Makefile.am +++ b/contrib/initramfs/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/config/Shellcheck.am initrddir = /usr/share/initramfs-tools dist_initrd_SCRIPTS = \ - zfsunlock + zfsunlock SUBDIRS = conf.d conf-hooks.d hooks scripts SHELLCHECKDIRS = hooks scripts diff --git a/contrib/initramfs/hooks/Makefile.am b/contrib/initramfs/hooks/Makefile.am index 0cd1aafcd359..e872c0a00b1d 100644 --- a/contrib/initramfs/hooks/Makefile.am +++ b/contrib/initramfs/hooks/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -8,3 +10,4 @@ hooks_SCRIPTS = \ zfsunlock SUBSTFILES += $(hooks_SCRIPTS) +SHELLCHECKSCRIPTS += $(hooks_SCRIPTS) diff --git a/contrib/initramfs/scripts/Makefile.am b/contrib/initramfs/scripts/Makefile.am index 444a5f374bfe..8b48f2056888 100644 --- a/contrib/initramfs/scripts/Makefile.am +++ b/contrib/initramfs/scripts/Makefile.am @@ -9,3 +9,4 @@ SUBDIRS = local-top SHELLCHECKDIRS = $(SUBDIRS) SHELLCHECK_SHELL = sh +SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) diff --git a/contrib/initramfs/scripts/local-top/Makefile.am b/contrib/initramfs/scripts/local-top/Makefile.am index f3dc23129f09..f64665f4b27b 100644 --- a/contrib/initramfs/scripts/local-top/Makefile.am +++ b/contrib/initramfs/scripts/local-top/Makefile.am @@ -3,5 +3,6 @@ include $(top_srcdir)/config/Shellcheck.am localtopdir = /usr/share/initramfs-tools/scripts/local-top dist_localtop_SCRIPTS = \ - zfs + zfs +SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) diff --git a/etc/default/Makefile.am b/etc/default/Makefile.am index 0f7c96698d45..98f22b8da6ea 100644 --- a/etc/default/Makefile.am +++ b/etc/default/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -6,3 +8,4 @@ initconf_SCRIPTS = zfs SUBSTFILES += $(initconf_SCRIPTS) SHELLCHECK_SHELL = sh +SHELLCHECKSCRIPTS += $(initconf_SCRIPTS) diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am index 625d0b91fd11..0a997f44552b 100644 --- a/etc/init.d/Makefile.am +++ b/etc/init.d/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -8,3 +10,4 @@ init_SCRIPTS = zfs-import zfs-load-key zfs-mount zfs-share zfs-zed SUBSTFILES += $(init_SCRIPTS) SHELLCHECK_SHELL = sh +SHELLCHECKSCRIPTS += $(init_SCRIPTS) diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am index 5e65e1db420c..b5fcddbf594f 100644 --- a/etc/systemd/system/Makefile.am +++ b/etc/systemd/system/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am systemdpreset_DATA = \ diff --git a/etc/zfs/Makefile.am b/etc/zfs/Makefile.am index 8a67d548bf7e..f62c687c6727 100644 --- a/etc/zfs/Makefile.am +++ b/etc/zfs/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -16,3 +18,4 @@ pkgsysconf_SCRIPTS = \ SUBSTFILES += $(pkgsysconf_SCRIPTS) SHELLCHECK_SHELL = sh +SHELLCHECKSCRIPTS += $(pkgsysconf_SCRIPTS) diff --git a/man/Makefile.am b/man/Makefile.am index 64650c2b988a..e58683739e72 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am EXTRA_DIST += \ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 775759187a20..af7be462cb84 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -28,7 +28,7 @@ EXTRA_DIST = \ zol2zfs-patch.sed \ $(EXTRA_SCRIPTS) -SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS) +SHELLCHECKSCRIPTS += $(dist_pkgdata_SCRIPTS) $(EXTRA_SCRIPTS) define EXTRA_ENVIRONMENT @@ -37,13 +37,13 @@ export INTREE="yes" export GDB="libtool --mode=execute gdb" export LDMOD=/sbin/insmod -export CMD_DIR=@abs_top_builddir@/cmd +export CMD_DIR=@abs_top_builddir@ export UDEV_RULE_DIR=@abs_top_builddir@/udev/rules.d -export ZEDLET_ETC_DIR=$$CMD_DIR/zed/zed.d -export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/zed/zed.d -export ZPOOL_SCRIPT_DIR=$$CMD_DIR/zpool/zpool.d -export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/zpool/zpool.d -export ZPOOL_COMPAT_DIR=$$CMD_DIR/zpool/compatibility.d +export ZEDLET_ETC_DIR=$$CMD_DIR/cmd/zed/zed.d +export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/cmd/zed/zed.d +export ZPOOL_SCRIPT_DIR=$$CMD_DIR/cmd/zpool/zpool.d +export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/cmd/zpool/zpool.d +export ZPOOL_COMPAT_DIR=$$CMD_DIR/cmd/zpool/compatibility.d export CONTRIB_DIR=@abs_top_builddir@/contrib export LIB_DIR=@abs_top_builddir@/.libs export SYSCONF_DIR=@abs_top_builddir@/etc @@ -62,9 +62,9 @@ endef export EXTRA_ENVIRONMENT all-local: - -$(SED) -e '\|^export BIN_DIR=|s|$$|@abs_top_builddir@/bin|' \ - -e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@/bin|' \ - -e '\|^export LIBEXEC_DIR=|s|$$|@abs_top_builddir@/bin|' \ + -$(SED) -e '\|^export BIN_DIR=|s|$$|@abs_top_builddir@/tests/zfs-tests/bin|' \ + -e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@|' \ + -e '\|^export LIBEXEC_DIR=|s|$$|@abs_top_builddir@|' \ -e '\|^export ZTS_DIR=|s|$$|@abs_top_srcdir@/tests|' \ -e '\|^export SCRIPT_DIR=|s|$$|@abs_top_srcdir@/scripts|' \ $(abs_top_srcdir)/scripts/common.sh.in >common.sh diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh index 93a047f22cd9..5fa932dcced0 100755 --- a/scripts/zfs-helpers.sh +++ b/scripts/zfs-helpers.sh @@ -18,7 +18,7 @@ # --sysconfdir=DIR install zfs configuration files [PREFIX/etc] # -BASE_DIR=$(dirname "$0") +BASE_DIR=${0%/*} SCRIPT_COMMON=common.sh if [ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]; then . "${BASE_DIR}/${SCRIPT_COMMON}" @@ -46,7 +46,7 @@ msg() { usage() { cat << EOF USAGE: -$0 [dhirv] +$0 [-dhirv] DESCRIPTION: Install/remove the ZFS helper utilities. @@ -99,7 +99,7 @@ if [ "$INSTALL" = "no" ] && [ "$REMOVE" = "no" ]; then fail "Either -i or -r must be specified" fi -if [ "$(id -u)" != "0" ]; then +if [ "$(id -u)" != "0" ] && [ "$DRYRUN" = "no" ]; then fail "Must run as root" fi @@ -126,13 +126,13 @@ install() { echo "Symlink exists: $dst" elif [ -e "$dst" ]; then echo "File exists: $dst" - elif [ ! -e "$src" ]; then + elif ! [ -e "$src" ]; then echo "Source missing: $src" else msg "ln -s $src $dst" if [ "$DRYRUN" = "no" ]; then - DIR=$(dirname "$dst") + DIR=${dst%/*} mkdir -p "$DIR" >/dev/null 2>&1 ln -s "$src" "$dst" fi @@ -145,7 +145,7 @@ remove() { if [ -h "$dst" ]; then msg "rm $dst" rm "$dst" - DIR=$(dirname "$dst") + DIR=${dst%/*} rmdir "$DIR" >/dev/null 2>&1 elif [ -e "$dst" ]; then echo "Expected symlink: $dst" @@ -153,30 +153,23 @@ remove() { } if [ "${INSTALL}" = "yes" ]; then - install "$CMD_DIR/mount_zfs/mount.zfs" \ - "$INSTALL_MOUNT_HELPER_DIR/mount.zfs" - install "$CMD_DIR/fsck_zfs/fsck.zfs" \ - "$INSTALL_MOUNT_HELPER_DIR/fsck.zfs" - install "$CMD_DIR/zvol_id/zvol_id" \ - "$INSTALL_UDEV_DIR/zvol_id" - install "$CMD_DIR/vdev_id/vdev_id" \ - "$INSTALL_UDEV_DIR/vdev_id" - install "$UDEV_RULE_DIR/60-zvol.rules" \ - "$INSTALL_UDEV_RULE_DIR/60-zvol.rules" - install "$UDEV_RULE_DIR/69-vdev.rules" \ - "$INSTALL_UDEV_RULE_DIR/69-vdev.rules" - install "$UDEV_RULE_DIR/90-zfs.rules" \ - "$INSTALL_UDEV_RULE_DIR/90-zfs.rules" - install "$CMD_DIR/zpool/zpool.d" \ - "$INSTALL_SYSCONF_DIR/zfs/zpool.d" - install "$CONTRIB_DIR/pyzfs/libzfs_core" \ - "$INSTALL_PYTHON_DIR/libzfs_core" + for cmd in "mount.zfs" "fsck.zfs"; do + install "$CMD_DIR/$cmd" "$INSTALL_MOUNT_HELPER_DIR/$cmd" + done + for udev in "$CMD_DIR/zvol_id" "$UDEV_SCRIPT_DIR/vdev_id"; do + install "$udev" "$INSTALL_UDEV_DIR/${udev##*/}" + done + for rule in "60-zvol.rules" "69-vdev.rules" "90-zfs.rules"; do + install "$UDEV_RULE_DIR/$rule" "$INSTALL_UDEV_RULE_DIR/$rule" + done + install "$ZPOOL_SCRIPT_DIR" "$INSTALL_SYSCONF_DIR/zfs/zpool.d" + install "$CONTRIB_DIR/pyzfs/libzfs_core" "$INSTALL_PYTHON_DIR/libzfs_core" # Ideally we would install these in the configured ${libdir}, which is # by default "/usr/local/lib and unfortunately not included in the # dynamic linker search path. - install "$(find "$LIB_DIR" -type f -name 'libzfs_core.so*')" "/lib/libzfs_core.so" - install "$(find "$LIB_DIR" -type f -name 'libnvpair.so*')" "/lib/libnvpair.so" - ldconfig + install "$LIB_DIR"/libzfs_core.so.?.?.? "/lib/libzfs_core.so" + install "$LIB_DIR"/libnvpair.so.?.?.? "/lib/libnvpair.so" + [ "$DRYRUN" = "no" ] && ldconfig else remove "$INSTALL_MOUNT_HELPER_DIR/mount.zfs" remove "$INSTALL_MOUNT_HELPER_DIR/fsck.zfs" diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh index df69325a1be1..cad65d04869f 100755 --- a/scripts/zfs-tests.sh +++ b/scripts/zfs-tests.sh @@ -248,7 +248,7 @@ constrain_path() { SYSTEM_DIRS="$SYSTEM_DIRS /usr/bin /usr/sbin /bin /sbin $LIBEXEC_DIR" if [ "$INTREE" = "yes" ]; then - # Constrained path set to ./zfs/bin/ + # Constrained path set to $(top_builddir)/tests/zfs-tests/bin STF_PATH="$BIN_DIR" STF_PATH_REMOVE="no" STF_MISSING_BIN="" @@ -258,14 +258,10 @@ constrain_path() { fi # Special case links for standard zfs utilities - DIRS="$(find "$CMD_DIR" -type d \( ! -name .deps -a \ - ! -name .libs \) -print | tr '\n' ' ')" - create_links "$DIRS" "$ZFS_FILES" + create_links "$CMD_DIR" "$ZFS_FILES" # Special case links for zfs test suite utilities - DIRS="$(find "$STF_SUITE" -type d \( ! -name .deps -a \ - ! -name .libs \) -print | tr '\n' ' ')" - create_links "$DIRS" "$ZFSTEST_FILES" + create_links "$CMD_DIR/tests/zfs-tests/cmd" "$ZFSTEST_FILES" else # Constrained path set to /var/tmp/constrained_path.* SYSTEMDIR=${SYSTEMDIR:-/var/tmp/constrained_path.XXXXXX} diff --git a/scripts/zimport.sh b/scripts/zimport.sh index 14d2813ce268..595de494e50b 100755 --- a/scripts/zimport.sh +++ b/scripts/zimport.sh @@ -235,8 +235,8 @@ src_set_vars() { ZFS_CMD=$(command -v zfs) ZFS_SH="/usr/share/zfs/zfs.sh" else - ZPOOL_CMD="./cmd/zpool/zpool" - ZFS_CMD="./cmd/zfs/zfs" + ZPOOL_CMD="./zpool" + ZFS_CMD="./zfs" ZFS_SH="./scripts/zfs.sh" fi } diff --git a/tests/Makefile.am b/tests/Makefile.am index 1dfc2cc5f518..73191549863e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,5 +4,4 @@ SUBDIRS = runfiles test-runner zfs-tests EXTRA_DIST = README.md -SHELLCHECKSCRIPTS = $$(find . -name '*.sh') -.PHONY: $(SHELLCHECKSCRIPTS) +SHELLCHECKSCRIPTS += $(shell find $(srcdir) -name '*.sh') diff --git a/tests/test-runner/bin/Makefile.am b/tests/test-runner/bin/Makefile.am index e11e55fffdeb..74b98fa69fc3 100644 --- a/tests/test-runner/bin/Makefile.am +++ b/tests/test-runner/bin/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am pkgdatadir = $(datadir)/@PACKAGE@/test-runner/bin diff --git a/tests/zfs-tests/.gitignore b/tests/zfs-tests/.gitignore new file mode 100644 index 000000000000..ba077a4031ad --- /dev/null +++ b/tests/zfs-tests/.gitignore @@ -0,0 +1 @@ +bin diff --git a/tests/zfs-tests/include/Makefile.am b/tests/zfs-tests/include/Makefile.am index 16cdf2c81432..b6f723267240 100644 --- a/tests/zfs-tests/include/Makefile.am +++ b/tests/zfs-tests/include/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/include diff --git a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am index 26c5ac595a5d..0817896378e1 100644 --- a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am +++ b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am pkgpyzfsdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pyzfs diff --git a/udev/rules.d/Makefile.am b/udev/rules.d/Makefile.am index 72f47d6f2a66..c62b05e53f5d 100644 --- a/udev/rules.d/Makefile.am +++ b/udev/rules.d/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am udevrule_DATA = \ From 09a7ad38a5407b5ac6c2a75f679504367655e471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 9 Apr 2022 14:37:22 +0200 Subject: [PATCH 012/119] autoconf: single-step includes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Still descend, but only once: we get a lot of mileage out of nodist_ Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- configure.ac | 27 +--- include/Makefile.am | 180 +++++++++++++++++++++- include/os/Makefile.am | 6 - include/os/freebsd/Makefile.am | 91 ++++++++++- include/os/freebsd/linux/Makefile.am | 5 - include/os/freebsd/spl/Makefile.am | 1 - include/os/freebsd/spl/acl/Makefile.am | 4 - include/os/freebsd/spl/rpc/Makefile.am | 4 - include/os/freebsd/spl/sys/Makefile.am | 73 --------- include/os/freebsd/zfs/Makefile.am | 1 - include/os/freebsd/zfs/sys/Makefile.am | 15 -- include/os/linux/Makefile.am | 112 +++++++++++++- include/os/linux/kernel/Makefile.am | 1 - include/os/linux/kernel/linux/Makefile.am | 22 --- include/os/linux/spl/Makefile.am | 1 - include/os/linux/spl/rpc/Makefile.am | 7 - include/os/linux/spl/sys/Makefile.am | 64 -------- include/os/linux/zfs/Makefile.am | 1 - include/os/linux/zfs/sys/Makefile.am | 31 ---- include/sys/Makefile.am | 151 ------------------ include/sys/crypto/Makefile.am | 16 -- include/sys/fm/Makefile.am | 17 -- include/sys/fm/fs/Makefile.am | 14 -- include/sys/fs/Makefile.am | 14 -- include/sys/lua/Makefile.am | 17 -- include/sys/sysevent/Makefile.am | 15 -- include/sys/zstd/Makefile.am | 18 --- 27 files changed, 375 insertions(+), 533 deletions(-) delete mode 100644 include/os/Makefile.am delete mode 100644 include/os/freebsd/linux/Makefile.am delete mode 100644 include/os/freebsd/spl/Makefile.am delete mode 100644 include/os/freebsd/spl/acl/Makefile.am delete mode 100644 include/os/freebsd/spl/rpc/Makefile.am delete mode 100644 include/os/freebsd/spl/sys/Makefile.am delete mode 100644 include/os/freebsd/zfs/Makefile.am delete mode 100644 include/os/freebsd/zfs/sys/Makefile.am delete mode 100644 include/os/linux/kernel/Makefile.am delete mode 100644 include/os/linux/kernel/linux/Makefile.am delete mode 100644 include/os/linux/spl/Makefile.am delete mode 100644 include/os/linux/spl/rpc/Makefile.am delete mode 100644 include/os/linux/spl/sys/Makefile.am delete mode 100644 include/os/linux/zfs/Makefile.am delete mode 100644 include/os/linux/zfs/sys/Makefile.am delete mode 100644 include/sys/Makefile.am delete mode 100644 include/sys/crypto/Makefile.am delete mode 100644 include/sys/fm/Makefile.am delete mode 100644 include/sys/fm/fs/Makefile.am delete mode 100644 include/sys/fs/Makefile.am delete mode 100644 include/sys/lua/Makefile.am delete mode 100644 include/sys/sysevent/Makefile.am delete mode 100644 include/sys/zstd/Makefile.am diff --git a/configure.ac b/configure.ac index 106d1876e705..84159b07e63b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ /* - * This file is part of the ZFS Linux port. + * This file is part of OpenZFS. * * Copyright (c) 2009 Lawrence Livermore National Security, LLC. * Produced at Lawrence Livermore National Laboratory @@ -92,31 +92,6 @@ AC_CONFIG_FILES([ etc/systemd/system/Makefile etc/zfs/Makefile include/Makefile - include/os/Makefile - include/os/freebsd/Makefile - include/os/freebsd/linux/Makefile - include/os/freebsd/spl/Makefile - include/os/freebsd/spl/acl/Makefile - include/os/freebsd/spl/rpc/Makefile - include/os/freebsd/spl/sys/Makefile - include/os/freebsd/zfs/Makefile - include/os/freebsd/zfs/sys/Makefile - include/os/linux/Makefile - include/os/linux/kernel/Makefile - include/os/linux/kernel/linux/Makefile - include/os/linux/spl/Makefile - include/os/linux/spl/rpc/Makefile - include/os/linux/spl/sys/Makefile - include/os/linux/zfs/Makefile - include/os/linux/zfs/sys/Makefile - include/sys/Makefile - include/sys/crypto/Makefile - include/sys/fm/Makefile - include/sys/fm/fs/Makefile - include/sys/fs/Makefile - include/sys/lua/Makefile - include/sys/sysevent/Makefile - include/sys/zstd/Makefile lib/libzfs/libzfs.pc lib/libzfsbootenv/libzfsbootenv.pc lib/libzfs_core/libzfs_core.pc diff --git a/include/Makefile.am b/include/Makefile.am index 4da43afd850d..eee989d4a150 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,4 +1,10 @@ -SUBDIRS = sys os +if BUILD_LINUX +include $(srcdir)/%D%/os/linux/Makefile.am +endif +if BUILD_FREEBSD +include $(srcdir)/%D%/os/freebsd/Makefile.am +endif + COMMON_H = \ cityhash.h \ @@ -7,27 +13,187 @@ COMMON_H = \ zfs_deleg.h \ zfs_fletcher.h \ zfs_namecheck.h \ - zfs_prop.h + zfs_prop.h \ + \ + sys/abd.h \ + sys/abd_impl.h \ + sys/aggsum.h \ + sys/arc.h \ + sys/arc_impl.h \ + sys/avl.h \ + sys/avl_impl.h \ + sys/bitops.h \ + sys/blkptr.h \ + sys/bplist.h \ + sys/bpobj.h \ + sys/bptree.h \ + sys/bqueue.h \ + sys/btree.h \ + sys/dataset_kstats.h \ + sys/dbuf.h \ + sys/ddt.h \ + sys/dmu.h \ + sys/dmu_impl.h \ + sys/dmu_objset.h \ + sys/dmu_recv.h \ + sys/dmu_redact.h \ + sys/dmu_send.h \ + sys/dmu_traverse.h \ + sys/dmu_tx.h \ + sys/dmu_zfetch.h \ + sys/dnode.h \ + sys/dsl_bookmark.h \ + sys/dsl_crypt.h \ + sys/dsl_dataset.h \ + sys/dsl_deadlist.h \ + sys/dsl_deleg.h \ + sys/dsl_destroy.h \ + sys/dsl_dir.h \ + sys/dsl_pool.h \ + sys/dsl_prop.h \ + sys/dsl_scan.h \ + sys/dsl_synctask.h \ + sys/dsl_userhold.h \ + sys/edonr.h \ + sys/efi_partition.h \ + sys/frame.h \ + sys/hkdf.h \ + sys/metaslab.h \ + sys/metaslab_impl.h \ + sys/mmp.h \ + sys/mntent.h \ + sys/mod.h \ + sys/multilist.h \ + sys/nvpair.h \ + sys/nvpair_impl.h \ + sys/objlist.h \ + sys/pathname.h \ + sys/qat.h \ + sys/range_tree.h \ + sys/rrwlock.h \ + sys/sa.h \ + sys/sa_impl.h \ + sys/skein.h \ + sys/spa.h \ + sys/spa_boot.h \ + sys/spa_checkpoint.h \ + sys/spa_checksum.h \ + sys/spa_impl.h \ + sys/spa_log_spacemap.h \ + sys/space_map.h \ + sys/space_reftree.h \ + sys/sysevent.h \ + sys/txg.h \ + sys/txg_impl.h \ + sys/u8_textprep.h \ + sys/u8_textprep_data.h \ + sys/uberblock.h \ + sys/uberblock_impl.h \ + sys/uio_impl.h \ + sys/unique.h \ + sys/uuid.h \ + sys/vdev.h \ + sys/vdev_disk.h \ + sys/vdev_draid.h \ + sys/vdev_file.h \ + sys/vdev_impl.h \ + sys/vdev_indirect_births.h \ + sys/vdev_indirect_mapping.h \ + sys/vdev_initialize.h \ + sys/vdev_raidz.h \ + sys/vdev_raidz_impl.h \ + sys/vdev_rebuild.h \ + sys/vdev_removal.h \ + sys/vdev_trim.h \ + sys/xvattr.h \ + sys/zap.h \ + sys/zap_impl.h \ + sys/zap_leaf.h \ + sys/zcp.h \ + sys/zcp_global.h \ + sys/zcp_iter.h \ + sys/zcp_prop.h \ + sys/zcp_set.h \ + sys/zfeature.h \ + sys/zfs_acl.h \ + sys/zfs_bootenv.h \ + sys/zfs_context.h \ + sys/zfs_debug.h \ + sys/zfs_delay.h \ + sys/zfs_file.h \ + sys/zfs_fuid.h \ + sys/zfs_project.h \ + sys/zfs_quota.h \ + sys/zfs_racct.h \ + sys/zfs_ratelimit.h \ + sys/zfs_refcount.h \ + sys/zfs_rlock.h \ + sys/zfs_sa.h \ + sys/zfs_stat.h \ + sys/zfs_sysfs.h \ + sys/zfs_vfsops.h \ + sys/zfs_vnops.h \ + sys/zfs_znode.h \ + sys/zil.h \ + sys/zil_impl.h \ + sys/zio.h \ + sys/zio_checksum.h \ + sys/zio_compress.h \ + sys/zio_crypt.h \ + sys/zio_impl.h \ + sys/zio_priority.h \ + sys/zrlock.h \ + sys/zthr.h \ + \ + sys/crypto/api.h \ + sys/crypto/common.h \ + sys/crypto/icp.h \ + \ + sys/fm/protocol.h \ + sys/fm/util.h \ + sys/fm/fs/zfs.h \ + \ + sys/fs/zfs.h \ + \ + sys/lua/lauxlib.h \ + sys/lua/lua.h \ + sys/lua/luaconf.h \ + sys/lua/lualib.h \ + \ + sys/sysevent/dev.h \ + sys/sysevent/eventdefs.h \ + \ + sys/zstd/zstd.h + + +KERNEL_H = \ + sys/zfs_ioctl.h \ + sys/zfs_ioctl_impl.h \ + sys/zfs_onexit.h \ + sys/zvol.h \ + sys/zvol_impl.h + USER_H = \ libnvpair.h \ - libuutil_common.h \ libuutil.h \ + libuutil_common.h \ libuutil_impl.h \ libzfs.h \ - libzfsbootenv.h \ libzfs_core.h \ + libzfsbootenv.h \ libzutil.h \ thread_pool.h + if CONFIG_USER libzfsdir = $(includedir)/libzfs -libzfs_HEADERS = $(COMMON_H) $(USER_H) +nobase_libzfs_HEADERS = $(COMMON_H) $(USER_H) endif +kerneldir = $(prefix)/src/zfs-$(VERSION)/include if CONFIG_KERNEL if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include -kernel_HEADERS = $(COMMON_H) +nobase_kernel_HEADERS = $(COMMON_H) $(KERNEL_H) endif endif diff --git a/include/os/Makefile.am b/include/os/Makefile.am deleted file mode 100644 index 7eab1abde984..000000000000 --- a/include/os/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -if BUILD_LINUX -SUBDIRS = linux -endif -if BUILD_FREEBSD -SUBDIRS = freebsd -endif diff --git a/include/os/freebsd/Makefile.am b/include/os/freebsd/Makefile.am index 3c87d4a0e791..5ddb7cd710b8 100644 --- a/include/os/freebsd/Makefile.am +++ b/include/os/freebsd/Makefile.am @@ -1 +1,90 @@ -SUBDIRS = linux spl zfs +noinst_HEADERS = \ + %D%/linux/compiler.h \ + %D%/linux/types.h \ + \ + %D%/spl/acl/acl_common.h \ + \ + %D%/spl/rpc/xdr.h \ + \ + %D%/spl/sys/acl.h \ + %D%/spl/sys/acl_impl.h \ + %D%/spl/sys/atomic.h \ + %D%/spl/sys/byteorder.h \ + %D%/spl/sys/callb.h \ + %D%/spl/sys/ccompat.h \ + %D%/spl/sys/ccompile.h \ + %D%/spl/sys/cmn_err.h \ + %D%/spl/sys/condvar.h \ + %D%/spl/sys/cred.h \ + %D%/spl/sys/ctype.h \ + %D%/spl/sys/debug.h \ + %D%/spl/sys/dirent.h \ + %D%/spl/sys/disp.h \ + %D%/spl/sys/dkio.h \ + %D%/spl/sys/extdirent.h \ + %D%/spl/sys/fcntl.h \ + %D%/spl/sys/file.h \ + %D%/spl/sys/freebsd_rwlock.h \ + %D%/spl/sys/idmap.h \ + %D%/spl/sys/inttypes.h \ + %D%/spl/sys/isa_defs.h \ + %D%/spl/sys/kmem.h \ + %D%/spl/sys/kmem_cache.h \ + %D%/spl/sys/kstat.h \ + %D%/spl/sys/list.h \ + %D%/spl/sys/list_impl.h \ + %D%/spl/sys/lock.h \ + %D%/spl/sys/misc.h \ + %D%/spl/sys/mod_os.h \ + %D%/spl/sys/mode.h \ + %D%/spl/sys/mount.h \ + %D%/spl/sys/mutex.h \ + %D%/spl/sys/param.h \ + %D%/spl/sys/policy.h \ + %D%/spl/sys/proc.h \ + %D%/spl/sys/processor.h \ + %D%/spl/sys/procfs_list.h \ + %D%/spl/sys/random.h \ + %D%/spl/sys/rwlock.h \ + %D%/spl/sys/sdt.h \ + %D%/spl/sys/sid.h \ + %D%/spl/sys/sig.h \ + %D%/spl/sys/simd.h \ + %D%/spl/sys/simd_x86.h \ + %D%/spl/sys/spl_condvar.h \ + %D%/spl/sys/string.h \ + %D%/spl/sys/sunddi.h \ + %D%/spl/sys/sysmacros.h \ + %D%/spl/sys/systeminfo.h \ + %D%/spl/sys/systm.h \ + %D%/spl/sys/taskq.h \ + %D%/spl/sys/thread.h \ + %D%/spl/sys/time.h \ + %D%/spl/sys/timer.h \ + %D%/spl/sys/trace.h \ + %D%/spl/sys/trace_zfs.h \ + %D%/spl/sys/types.h \ + %D%/spl/sys/types32.h \ + %D%/spl/sys/uio.h \ + %D%/spl/sys/uuid.h \ + %D%/spl/sys/vfs.h \ + %D%/spl/sys/vm.h \ + %D%/spl/sys/vmsystm.h \ + %D%/spl/sys/vnode.h \ + %D%/spl/sys/vnode_impl.h \ + %D%/spl/sys/wmsum.h \ + %D%/spl/sys/zmod.h \ + %D%/spl/sys/zone.h \ + \ + %D%/zfs/sys/freebsd_crypto.h \ + %D%/zfs/sys/sha2.h \ + %D%/zfs/sys/vdev_os.h \ + %D%/zfs/sys/zfs_bootenv_os.h \ + %D%/zfs/sys/zfs_context_os.h \ + %D%/zfs/sys/zfs_ctldir.h \ + %D%/zfs/sys/zfs_dir.h \ + %D%/zfs/sys/zfs_ioctl_compat.h \ + %D%/zfs/sys/zfs_vfsops_os.h \ + %D%/zfs/sys/zfs_vnops_os.h \ + %D%/zfs/sys/zfs_znode_impl.h \ + %D%/zfs/sys/zpl.h diff --git a/include/os/freebsd/linux/Makefile.am b/include/os/freebsd/linux/Makefile.am deleted file mode 100644 index 00cff7f5dc65..000000000000 --- a/include/os/freebsd/linux/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -KERNEL_H = \ - compiler.h \ - types.h - -noinst_HEADERS = $(KERNEL_H) diff --git a/include/os/freebsd/spl/Makefile.am b/include/os/freebsd/spl/Makefile.am deleted file mode 100644 index b321825cb77e..000000000000 --- a/include/os/freebsd/spl/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = acl rpc sys diff --git a/include/os/freebsd/spl/acl/Makefile.am b/include/os/freebsd/spl/acl/Makefile.am deleted file mode 100644 index 5c0698d02ea6..000000000000 --- a/include/os/freebsd/spl/acl/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -KERNEL_H = \ - acl_common.h - -noinst_HEADERS = $(KERNEL_H) diff --git a/include/os/freebsd/spl/rpc/Makefile.am b/include/os/freebsd/spl/rpc/Makefile.am deleted file mode 100644 index f6faf4b188be..000000000000 --- a/include/os/freebsd/spl/rpc/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -KERNEL_H = \ - xdr.h - -noinst_HEADERS = $(KERNEL_H) diff --git a/include/os/freebsd/spl/sys/Makefile.am b/include/os/freebsd/spl/sys/Makefile.am deleted file mode 100644 index 7d5081a4c25f..000000000000 --- a/include/os/freebsd/spl/sys/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -KERNEL_H = \ - acl_impl.h \ - acl.h \ - atomic.h \ - byteorder.h \ - callb.h \ - ccompat.h \ - ccompile.h \ - cmn_err.h \ - condvar.h \ - cred.h \ - ctype.h \ - debug.h \ - dirent.h \ - disp.h \ - dkio.h \ - extdirent.h \ - fcntl.h \ - file.h \ - freebsd_rwlock.h \ - idmap.h \ - inttypes.h \ - isa_defs.h \ - kmem_cache.h \ - kmem.h \ - kstat.h \ - list_impl.h \ - list.h \ - lock.h \ - Makefile.am \ - misc.h \ - mod_os.h \ - mode.h \ - mount.h \ - mutex.h \ - param.h \ - policy.h \ - proc.h \ - processor.h \ - procfs_list.h \ - random.h \ - rwlock.h \ - sdt.h \ - sid.h \ - sig.h \ - simd_x86.h \ - simd.h \ - spl_condvar.h \ - string.h \ - sunddi.h \ - sysmacros.h \ - systeminfo.h \ - systm.h \ - taskq.h \ - thread.h \ - time.h \ - timer.h \ - trace_zfs.h \ - trace.h \ - types.h \ - types32.h \ - uio.h \ - uuid.h \ - vfs.h \ - vm.h \ - vmsystm.h \ - vnode_impl.h \ - vnode.h \ - wmsum.h \ - zmod.h \ - zone.h - -noinst_HEADERS = $(KERNEL_H) diff --git a/include/os/freebsd/zfs/Makefile.am b/include/os/freebsd/zfs/Makefile.am deleted file mode 100644 index 081839c48c8f..000000000000 --- a/include/os/freebsd/zfs/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = sys diff --git a/include/os/freebsd/zfs/sys/Makefile.am b/include/os/freebsd/zfs/sys/Makefile.am deleted file mode 100644 index 392bb4ae3477..000000000000 --- a/include/os/freebsd/zfs/sys/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -KERNEL_H = \ - freebsd_crypto.h \ - sha2.h \ - vdev_os.h \ - zfs_bootenv_os.h \ - zfs_context_os.h \ - zfs_ctldir.h \ - zfs_dir.h \ - zfs_ioctl_compat.h \ - zfs_vfsops_os.h \ - zfs_vnops_os.h \ - zfs_znode_impl.h \ - zpl.h - -noinst_HEADERS = $(KERNEL_H) diff --git a/include/os/linux/Makefile.am b/include/os/linux/Makefile.am index 605a1fcb7506..4d6901c694c8 100644 --- a/include/os/linux/Makefile.am +++ b/include/os/linux/Makefile.am @@ -1 +1,111 @@ -SUBDIRS = kernel spl zfs +if CONFIG_KERNEL +kernel_linuxdir = $(kerneldir)/linux +kernel_linux_HEADERS = \ + %D%/kernel/linux/blkdev_compat.h \ + %D%/kernel/linux/compiler_compat.h \ + %D%/kernel/linux/dcache_compat.h \ + %D%/kernel/linux/kmap_compat.h \ + %D%/kernel/linux/mod_compat.h \ + %D%/kernel/linux/page_compat.h \ + %D%/kernel/linux/percpu_compat.h \ + %D%/kernel/linux/simd.h \ + %D%/kernel/linux/simd_aarch64.h \ + %D%/kernel/linux/simd_powerpc.h \ + %D%/kernel/linux/simd_x86.h \ + %D%/kernel/linux/utsname_compat.h \ + %D%/kernel/linux/vfs_compat.h \ + %D%/kernel/linux/xattr_compat.h + +kernel_sysdir = $(kerneldir)/sys +kernel_sys_HEADERS = \ + %D%/zfs/sys/policy.h \ + %D%/zfs/sys/sha2.h \ + %D%/zfs/sys/trace_acl.h \ + %D%/zfs/sys/trace_arc.h \ + %D%/zfs/sys/trace_common.h \ + %D%/zfs/sys/trace_dbgmsg.h \ + %D%/zfs/sys/trace_dbuf.h \ + %D%/zfs/sys/trace_dmu.h \ + %D%/zfs/sys/trace_dnode.h \ + %D%/zfs/sys/trace_multilist.h \ + %D%/zfs/sys/trace_rrwlock.h \ + %D%/zfs/sys/trace_txg.h \ + %D%/zfs/sys/trace_vdev.h \ + %D%/zfs/sys/trace_zfs.h \ + %D%/zfs/sys/trace_zil.h \ + %D%/zfs/sys/trace_zio.h \ + %D%/zfs/sys/trace_zrlock.h \ + %D%/zfs/sys/zfs_bootenv_os.h \ + %D%/zfs/sys/zfs_context_os.h \ + %D%/zfs/sys/zfs_ctldir.h \ + %D%/zfs/sys/zfs_dir.h \ + %D%/zfs/sys/zfs_vfsops_os.h \ + %D%/zfs/sys/zfs_vnops_os.h \ + %D%/zfs/sys/zfs_znode_impl.h \ + %D%/zfs/sys/zpl.h + +kernel_spl_rpcdir = $(kerneldir)/spl/rpc +kernel_spl_rpc_HEADERS = \ + %D%/spl/rpc/xdr.h + +kernel_spl_sysdir = $(kerneldir)/spl/sys +kernel_spl_sys_HEADERS = \ + %D%/spl/sys/acl.h \ + %D%/spl/sys/atomic.h \ + %D%/spl/sys/byteorder.h \ + %D%/spl/sys/callb.h \ + %D%/spl/sys/callo.h \ + %D%/spl/sys/cmn_err.h \ + %D%/spl/sys/condvar.h \ + %D%/spl/sys/cred.h \ + %D%/spl/sys/ctype.h \ + %D%/spl/sys/debug.h \ + %D%/spl/sys/disp.h \ + %D%/spl/sys/dkio.h \ + %D%/spl/sys/errno.h \ + %D%/spl/sys/fcntl.h \ + %D%/spl/sys/file.h \ + %D%/spl/sys/inttypes.h \ + %D%/spl/sys/isa_defs.h \ + %D%/spl/sys/kmem.h \ + %D%/spl/sys/kmem_cache.h \ + %D%/spl/sys/kstat.h \ + %D%/spl/sys/list.h \ + %D%/spl/sys/mod_os.h \ + %D%/spl/sys/mutex.h \ + %D%/spl/sys/param.h \ + %D%/spl/sys/proc.h \ + %D%/spl/sys/processor.h \ + %D%/spl/sys/procfs_list.h \ + %D%/spl/sys/random.h \ + %D%/spl/sys/rwlock.h \ + %D%/spl/sys/shrinker.h \ + %D%/spl/sys/sid.h \ + %D%/spl/sys/signal.h \ + %D%/spl/sys/simd.h \ + %D%/spl/sys/stat.h \ + %D%/spl/sys/string.h \ + %D%/spl/sys/sunddi.h \ + %D%/spl/sys/sysmacros.h \ + %D%/spl/sys/systeminfo.h \ + %D%/spl/sys/taskq.h \ + %D%/spl/sys/thread.h \ + %D%/spl/sys/time.h \ + %D%/spl/sys/timer.h \ + %D%/spl/sys/trace.h \ + %D%/spl/sys/trace_spl.h \ + %D%/spl/sys/trace_taskq.h \ + %D%/spl/sys/tsd.h \ + %D%/spl/sys/types.h \ + %D%/spl/sys/types32.h \ + %D%/spl/sys/uio.h \ + %D%/spl/sys/user.h \ + %D%/spl/sys/vfs.h \ + %D%/spl/sys/vmem.h \ + %D%/spl/sys/vmsystm.h \ + %D%/spl/sys/vnode.h \ + %D%/spl/sys/wait.h \ + %D%/spl/sys/wmsum.h \ + %D%/spl/sys/zmod.h \ + %D%/spl/sys/zone.h +endif diff --git a/include/os/linux/kernel/Makefile.am b/include/os/linux/kernel/Makefile.am deleted file mode 100644 index 08b2f5fc5c99..000000000000 --- a/include/os/linux/kernel/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = linux diff --git a/include/os/linux/kernel/linux/Makefile.am b/include/os/linux/kernel/linux/Makefile.am deleted file mode 100644 index 6ff0df506d9c..000000000000 --- a/include/os/linux/kernel/linux/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -KERNEL_H = \ - dcache_compat.h \ - xattr_compat.h \ - vfs_compat.h \ - blkdev_compat.h \ - utsname_compat.h \ - kmap_compat.h \ - percpu_compat.h \ - simd.h \ - simd_x86.h \ - simd_aarch64.h \ - simd_powerpc.h \ - mod_compat.h \ - page_compat.h \ - compiler_compat.h - -if CONFIG_KERNEL -if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include/linux -kernel_HEADERS = $(KERNEL_H) -endif -endif diff --git a/include/os/linux/spl/Makefile.am b/include/os/linux/spl/Makefile.am deleted file mode 100644 index bd781c08f143..000000000000 --- a/include/os/linux/spl/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = rpc sys diff --git a/include/os/linux/spl/rpc/Makefile.am b/include/os/linux/spl/rpc/Makefile.am deleted file mode 100644 index 13d804fce9b6..000000000000 --- a/include/os/linux/spl/rpc/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -KERNEL_H = \ - xdr.h - -if CONFIG_KERNEL -kerneldir = @prefix@/src/zfs-$(VERSION)/include/spl/rpc -kernel_HEADERS = $(KERNEL_H) -endif diff --git a/include/os/linux/spl/sys/Makefile.am b/include/os/linux/spl/sys/Makefile.am deleted file mode 100644 index 0dc9b90c1097..000000000000 --- a/include/os/linux/spl/sys/Makefile.am +++ /dev/null @@ -1,64 +0,0 @@ -KERNEL_H = \ - acl.h \ - atomic.h \ - byteorder.h \ - callb.h \ - callo.h \ - cmn_err.h \ - condvar.h \ - cred.h \ - ctype.h \ - debug.h \ - disp.h \ - dkio.h \ - errno.h \ - fcntl.h \ - file.h \ - inttypes.h \ - isa_defs.h \ - kmem_cache.h \ - kmem.h \ - kstat.h \ - list.h \ - mod_os.h \ - mutex.h \ - param.h \ - processor.h \ - proc.h \ - procfs_list.h \ - random.h \ - rwlock.h \ - shrinker.h \ - sid.h \ - signal.h \ - simd.h \ - stat.h \ - string.h \ - sunddi.h \ - sysmacros.h \ - systeminfo.h \ - taskq.h \ - thread.h \ - time.h \ - timer.h \ - trace.h \ - trace_spl.h \ - trace_taskq.h \ - tsd.h \ - types32.h \ - types.h \ - uio.h \ - user.h \ - vfs.h \ - vmem.h \ - vmsystm.h \ - vnode.h \ - wait.h \ - wmsum.h \ - zmod.h \ - zone.h - -if CONFIG_KERNEL -kerneldir = @prefix@/src/zfs-$(VERSION)/include/spl/sys -kernel_HEADERS = $(KERNEL_H) -endif diff --git a/include/os/linux/zfs/Makefile.am b/include/os/linux/zfs/Makefile.am deleted file mode 100644 index 081839c48c8f..000000000000 --- a/include/os/linux/zfs/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = sys diff --git a/include/os/linux/zfs/sys/Makefile.am b/include/os/linux/zfs/sys/Makefile.am deleted file mode 100644 index a075db476e40..000000000000 --- a/include/os/linux/zfs/sys/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -KERNEL_H = \ - policy.h \ - sha2.h \ - trace_acl.h \ - trace_arc.h \ - trace_common.h \ - trace_zfs.h \ - trace_dbgmsg.h \ - trace_dbuf.h \ - trace_dmu.h \ - trace_dnode.h \ - trace_multilist.h \ - trace_rrwlock.h \ - trace_txg.h \ - trace_vdev.h \ - trace_zil.h \ - trace_zio.h \ - trace_zrlock.h \ - zfs_bootenv_os.h \ - zfs_context_os.h \ - zfs_ctldir.h \ - zfs_dir.h \ - zfs_vfsops_os.h \ - zfs_vnops_os.h \ - zfs_znode_impl.h \ - zpl.h - -if CONFIG_KERNEL -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys -kernel_HEADERS = $(KERNEL_H) -endif diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am deleted file mode 100644 index 54573fbe1b1c..000000000000 --- a/include/sys/Makefile.am +++ /dev/null @@ -1,151 +0,0 @@ -SUBDIRS = fm fs crypto lua sysevent zstd - -COMMON_H = \ - abd.h \ - abd_impl.h \ - aggsum.h \ - arc.h \ - arc_impl.h \ - avl.h \ - avl_impl.h \ - bitops.h \ - blkptr.h \ - bplist.h \ - bpobj.h \ - bptree.h \ - btree.h \ - bqueue.h \ - dataset_kstats.h \ - dbuf.h \ - ddt.h \ - dmu.h \ - dmu_impl.h \ - dmu_objset.h \ - dmu_recv.h \ - dmu_redact.h \ - dmu_send.h \ - dmu_traverse.h \ - dmu_tx.h \ - dmu_zfetch.h \ - dnode.h \ - dsl_bookmark.h \ - dsl_dataset.h \ - dsl_deadlist.h \ - dsl_deleg.h \ - dsl_destroy.h \ - dsl_dir.h \ - dsl_crypt.h \ - dsl_pool.h \ - dsl_prop.h \ - dsl_scan.h \ - dsl_synctask.h \ - dsl_userhold.h \ - edonr.h \ - efi_partition.h \ - frame.h \ - hkdf.h \ - metaslab.h \ - metaslab_impl.h \ - mmp.h \ - mntent.h \ - mod.h \ - multilist.h \ - nvpair.h \ - nvpair_impl.h \ - objlist.h \ - pathname.h \ - qat.h \ - range_tree.h \ - rrwlock.h \ - sa.h \ - sa_impl.h \ - skein.h \ - spa_boot.h \ - spa_checkpoint.h \ - spa_log_spacemap.h \ - space_map.h \ - space_reftree.h \ - spa.h \ - spa_impl.h \ - spa_checksum.h \ - sysevent.h \ - txg.h \ - txg_impl.h \ - u8_textprep_data.h \ - u8_textprep.h \ - uberblock.h \ - uberblock_impl.h \ - uio_impl.h \ - unique.h \ - uuid.h \ - vdev_disk.h \ - vdev_file.h \ - vdev.h \ - vdev_draid.h \ - vdev_impl.h \ - vdev_indirect_births.h \ - vdev_indirect_mapping.h \ - vdev_initialize.h \ - vdev_raidz.h \ - vdev_raidz_impl.h \ - vdev_rebuild.h \ - vdev_removal.h \ - vdev_trim.h \ - xvattr.h \ - zap.h \ - zap_impl.h \ - zap_leaf.h \ - zcp.h \ - zcp_global.h \ - zcp_iter.h \ - zcp_prop.h \ - zcp_set.h \ - zfeature.h \ - zfs_acl.h \ - zfs_bootenv.h \ - zfs_context.h \ - zfs_debug.h \ - zfs_delay.h \ - zfs_file.h \ - zfs_fuid.h \ - zfs_project.h \ - zfs_quota.h \ - zfs_racct.h \ - zfs_ratelimit.h \ - zfs_refcount.h \ - zfs_rlock.h \ - zfs_sa.h \ - zfs_stat.h \ - zfs_sysfs.h \ - zfs_vfsops.h \ - zfs_vnops.h \ - zfs_znode.h \ - zil.h \ - zil_impl.h \ - zio_checksum.h \ - zio_compress.h \ - zio_crypt.h \ - zio.h \ - zio_impl.h \ - zio_priority.h \ - zrlock.h \ - zthr.h - -KERNEL_H = \ - zfs_ioctl.h \ - zfs_ioctl_impl.h \ - zfs_onexit.h \ - zvol.h \ - zvol_impl.h - -if CONFIG_USER -libzfsdir = $(includedir)/libzfs/sys -libzfs_HEADERS = $(COMMON_H) -endif - -if CONFIG_KERNEL -if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys -kernel_HEADERS = $(COMMON_H) $(KERNEL_H) -endif -endif diff --git a/include/sys/crypto/Makefile.am b/include/sys/crypto/Makefile.am deleted file mode 100644 index eb31f6a45743..000000000000 --- a/include/sys/crypto/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -COMMON_H = \ - api.h \ - common.h \ - icp.h - -if CONFIG_USER -libzfsdir = $(includedir)/libzfs/sys/crypto -libzfs_HEADERS = $(COMMON_H) -endif - -if CONFIG_KERNEL -if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/crypto -kernel_HEADERS = $(COMMON_H) -endif -endif diff --git a/include/sys/fm/Makefile.am b/include/sys/fm/Makefile.am deleted file mode 100644 index 7c6c3d49b6e9..000000000000 --- a/include/sys/fm/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -SUBDIRS = fs - -COMMON_H = \ - protocol.h \ - util.h - -if CONFIG_USER -libzfsdir = $(includedir)/libzfs/sys/fm -libzfs_HEADERS = $(COMMON_H) -endif - -if CONFIG_KERNEL -if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/fm -kernel_HEADERS = $(COMMON_H) -endif -endif diff --git a/include/sys/fm/fs/Makefile.am b/include/sys/fm/fs/Makefile.am deleted file mode 100644 index a662753a9e97..000000000000 --- a/include/sys/fm/fs/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -COMMON_H = \ - zfs.h - -if CONFIG_USER -libzfsdir = $(includedir)/libzfs/sys/fm/fs -libzfs_HEADERS = $(COMMON_H) -endif - -if CONFIG_KERNEL -if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/fm/fs -kernel_HEADERS = $(COMMON_H) -endif -endif diff --git a/include/sys/fs/Makefile.am b/include/sys/fs/Makefile.am deleted file mode 100644 index 6a93053c8e2b..000000000000 --- a/include/sys/fs/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -COMMON_H = \ - zfs.h - -if CONFIG_USER -libzfsdir = $(includedir)/libzfs/sys/fs -libzfs_HEADERS = $(COMMON_H) -endif - -if CONFIG_KERNEL -if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/fs -kernel_HEADERS = $(COMMON_H) -endif -endif diff --git a/include/sys/lua/Makefile.am b/include/sys/lua/Makefile.am deleted file mode 100644 index 8b4dafaa8cf7..000000000000 --- a/include/sys/lua/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -COMMON_H = \ - lua.h \ - luaconf.h \ - lualib.h \ - lauxlib.h - -if CONFIG_USER -libzfsdir = $(includedir)/libzfs/sys/lua -libzfs_HEADERS = $(COMMON_H) -endif - -if CONFIG_KERNEL -if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/lua -kernel_HEADERS = $(COMMON_H) -endif -endif diff --git a/include/sys/sysevent/Makefile.am b/include/sys/sysevent/Makefile.am deleted file mode 100644 index 64e53763951a..000000000000 --- a/include/sys/sysevent/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -COMMON_H = \ - eventdefs.h \ - dev.h - -if CONFIG_USER -libzfsdir = $(includedir)/libzfs/sys/sysevent -libzfs_HEADERS = $(COMMON_H) -endif - -if CONFIG_KERNEL -if BUILD_LINUX -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/sysevent -kernel_HEADERS = $(COMMON_H) -endif -endif diff --git a/include/sys/zstd/Makefile.am b/include/sys/zstd/Makefile.am deleted file mode 100644 index 16666fe63355..000000000000 --- a/include/sys/zstd/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -COMMON_H = \ - $(top_srcdir)/include/sys/zstd/zstd.h - -KERNEL_H = - -USER_H = - -EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H) - -if CONFIG_USER -libzfsdir = $(includedir)/libzfs/sys/zstd -libzfs_HEADERS = $(COMMON_H) $(USER_H) -endif - -if CONFIG_KERNEL -kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/zstd -kernel_HEADERS = $(COMMON_H) $(KERNEL_H) -endif From 0a8b1fc6251af5d16d9f87ce696ec6f04edaba31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 9 Apr 2022 18:35:53 +0200 Subject: [PATCH 013/119] autoconf: use include directives instead of recursing down scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 10 ++-- configure.ac | 1 - scripts/Makefile.am | 118 ++++++++++++++++++++++---------------------- 3 files changed, 65 insertions(+), 64 deletions(-) diff --git a/Makefile.am b/Makefile.am index 131066b4d547..514439584188 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,7 @@ CLEANFILES = EXTRA_DIST = INSTALL_DATA_HOOKS = +ALL_LOCAL = include $(top_srcdir)/config/Shellcheck.am include $(top_srcdir)/config/Rules.am @@ -16,7 +17,8 @@ endif CPPCHECKDIRS += etc/systemd/system-generators if CONFIG_USER -SUBDIRS += scripts . man tests etc contrib +SUBDIRS += . man tests etc contrib +include $(srcdir)/%D%/scripts/Makefile.am include $(srcdir)/%D%/lib/Makefile.am include $(srcdir)/%D%/cmd/Makefile.am if BUILD_LINUX @@ -83,8 +85,8 @@ distclean-local: -o -name '*.gcno' \) \ -type f -delete -all-local: - -SCRIPT_COMMON=$(top_builddir)/scripts/common.sh $(top_srcdir)/scripts/zfs-tests.sh -c +PHONY += $(ALL_LOCAL) +all-local: $(ALL_LOCAL) dist-hook: $(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV) @@ -122,7 +124,7 @@ cstyle: filter_executable = -exec test -x '{}' \; -print -SHELLCHECKDIRS = contrib etc scripts tests +SHELLCHECKDIRS = contrib etc tests SHELLCHECKSCRIPTS += autogen.sh PHONY += mancheck diff --git a/configure.ac b/configure.ac index 84159b07e63b..9078f5c1a5a4 100644 --- a/configure.ac +++ b/configure.ac @@ -107,7 +107,6 @@ AC_CONFIG_FILES([ rpm/redhat/zfs-dkms.spec rpm/redhat/zfs-kmod.spec rpm/redhat/zfs.spec - scripts/Makefile tests/Makefile tests/runfiles/Makefile tests/test-runner/Makefile diff --git a/scripts/Makefile.am b/scripts/Makefile.am index af7be462cb84..586ead05b113 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,83 +1,83 @@ -include $(top_srcdir)/config/Shellcheck.am - -pkgdatadir = $(datadir)/@PACKAGE@ - -dist_pkgdata_SCRIPTS = \ - zimport.sh \ - zfs.sh \ - zfs-tests.sh \ - zloop.sh \ - zfs-helpers.sh +scriptsdir = $(datadir)/$(PACKAGE) +dist_scripts_SCRIPTS = \ + %D%/zfs-helpers.sh \ + %D%/zfs-tests.sh \ + %D%/zfs.sh \ + %D%/zimport.sh \ + %D%/zloop.sh EXTRA_SCRIPTS = \ - commitcheck.sh \ - common.sh.in \ - dkms.mkconf \ - dkms.postbuild \ - kmodtool \ - make_gitrev.sh \ - man-dates.sh \ - paxcheck.sh \ - mancheck.sh \ - zfs-tests-color.sh + %D%/commitcheck.sh \ + %D%/common.sh.in \ + %D%/dkms.mkconf \ + %D%/dkms.postbuild \ + %D%/kmodtool \ + %D%/make_gitrev.sh \ + %D%/man-dates.sh \ + %D%/mancheck.sh \ + %D%/paxcheck.sh \ + %D%/zfs-tests-color.sh -EXTRA_DIST = \ - cstyle.pl \ - enum-extract.pl \ - zfs2zol-patch.sed \ - zol2zfs-patch.sed \ +EXTRA_DIST += \ + %D%/cstyle.pl \ + %D%/enum-extract.pl \ + %D%/zfs2zol-patch.sed \ + %D%/zol2zfs-patch.sed \ $(EXTRA_SCRIPTS) -SHELLCHECKSCRIPTS += $(dist_pkgdata_SCRIPTS) $(EXTRA_SCRIPTS) +SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) $(EXTRA_SCRIPTS) -define EXTRA_ENVIRONMENT +define SCRIPTS_EXTRA_ENVIRONMENT # Only required for in-tree use export INTREE="yes" export GDB="libtool --mode=execute gdb" export LDMOD=/sbin/insmod -export CMD_DIR=@abs_top_builddir@ -export UDEV_RULE_DIR=@abs_top_builddir@/udev/rules.d +export CMD_DIR=$(abs_top_builddir) +export UDEV_RULE_DIR=$(abs_top_builddir)/udev/rules.d export ZEDLET_ETC_DIR=$$CMD_DIR/cmd/zed/zed.d export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/cmd/zed/zed.d export ZPOOL_SCRIPT_DIR=$$CMD_DIR/cmd/zpool/zpool.d export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/cmd/zpool/zpool.d export ZPOOL_COMPAT_DIR=$$CMD_DIR/cmd/zpool/compatibility.d -export CONTRIB_DIR=@abs_top_builddir@/contrib -export LIB_DIR=@abs_top_builddir@/.libs -export SYSCONF_DIR=@abs_top_builddir@/etc +export CONTRIB_DIR=$(abs_top_builddir)/contrib +export LIB_DIR=$(abs_top_builddir)/.libs +export SYSCONF_DIR=$(abs_top_builddir)/etc -export INSTALL_UDEV_DIR=@udevdir@ -export INSTALL_UDEV_RULE_DIR=@udevruledir@ -export INSTALL_MOUNT_HELPER_DIR=@mounthelperdir@ -export INSTALL_SYSCONF_DIR=@sysconfdir@ -export INSTALL_PYTHON_DIR=@pythonsitedir@ +export INSTALL_UDEV_DIR=$(udevdir) +export INSTALL_UDEV_RULE_DIR=$(udevruledir) +export INSTALL_MOUNT_HELPER_DIR=$(mounthelperdir) +export INSTALL_SYSCONF_DIR=$(sysconfdir) +export INSTALL_PYTHON_DIR=$(pythonsitedir) -export KMOD_SPL=@abs_top_builddir@/module/spl.ko -export KMOD_ZFS=@abs_top_builddir@/module/zfs.ko -export KMOD_FREEBSD=@abs_top_builddir@/module/openzfs.ko +export KMOD_SPL=$(abs_top_builddir)/module/spl.ko +export KMOD_ZFS=$(abs_top_builddir)/module/zfs.ko +export KMOD_FREEBSD=$(abs_top_builddir)/module/openzfs.ko endef -export EXTRA_ENVIRONMENT +export SCRIPTS_EXTRA_ENVIRONMENT -all-local: - -$(SED) -e '\|^export BIN_DIR=|s|$$|@abs_top_builddir@/tests/zfs-tests/bin|' \ - -e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@|' \ - -e '\|^export LIBEXEC_DIR=|s|$$|@abs_top_builddir@|' \ - -e '\|^export ZTS_DIR=|s|$$|@abs_top_srcdir@/tests|' \ - -e '\|^export SCRIPT_DIR=|s|$$|@abs_top_srcdir@/scripts|' \ - $(abs_top_srcdir)/scripts/common.sh.in >common.sh - -echo "$$EXTRA_ENVIRONMENT" >>common.sh +CLEANFILES += %D%/common.sh +%D%/common.sh: %D%/common.sh.in Makefile + -$(AM_V_at)$(MKDIR_P) $(@D) + -$(AM_V_GEN)$(SED) -e '/^export BIN_DIR=/s|$$|$(abs_top_builddir)/tests/zfs-tests/bin|' \ + -e '/^export SBIN_DIR=/s|$$|$(abs_top_builddir)|' \ + -e '/^export LIBEXEC_DIR=/s|$$|$(abs_top_builddir)|' \ + -e '/^export ZTS_DIR=/s|$$|$(abs_top_srcdir)/tests|' \ + -e '/^export SCRIPT_DIR=/s|$$|$(abs_top_srcdir)/scripts|' \ + $< >$@ + -$(AM_V_at)echo "$$SCRIPTS_EXTRA_ENVIRONMENT" >>$@ -clean-local: - -$(RM) common.sh +ALL_LOCAL += scripts-all-local +scripts-all-local: %D%/common.sh + -SCRIPT_COMMON=$< $(srcdir)/%D%/zfs-tests.sh -c -install-data-hook: - -$(SED) -e '\|^export BIN_DIR=|s|$$|@bindir@|' \ - -e '\|^export SBIN_DIR=|s|$$|@sbindir@|' \ - -e '\|^export LIBEXEC_DIR=|s|$$|@zfsexecdir@|' \ - -e '\|^export ZTS_DIR=|s|$$|@datadir@/@PACKAGE@|' \ - -e '\|^export SCRIPT_DIR=|s|$$|@datadir@/@PACKAGE@|' \ - $(abs_top_srcdir)/scripts/common.sh.in \ - >$(DESTDIR)$(datadir)/@PACKAGE@/common.sh +INSTALL_DATA_HOOKS += scripts-install-data-hook +scripts-install-data-hook: %D%/common.sh.in Makefile + -$(SED) -e '/^export BIN_DIR=/s|$$|$(bindir)|' \ + -e '/^export SBIN_DIR=/s|$$|$(sbindir)|' \ + -e '/^export LIBEXEC_DIR=/s|$$|$(zfsexecdir)|' \ + -e '/^export ZTS_DIR=/s|$$|$(datadir)/$(PACKAGE)|' \ + -e '/^export SCRIPT_DIR=/s|$$|$(datadir)/$(PACKAGE)|' \ + $< >$(DESTDIR)$(datadir)/$(PACKAGE)/common.sh From 0f6c4fd00ef7ae320860f792b17f103166511507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 9 Apr 2022 19:19:09 +0200 Subject: [PATCH 014/119] autoconf: use include directives instead of recursing down man MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 9 +- configure.ac | 1 - man/Makefile.am | 201 +++++++++++++++--------------- tests/test-runner/man/Makefile.am | 3 - 4 files changed, 104 insertions(+), 110 deletions(-) diff --git a/Makefile.am b/Makefile.am index 514439584188..89f258a1d83c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,10 +17,11 @@ endif CPPCHECKDIRS += etc/systemd/system-generators if CONFIG_USER -SUBDIRS += . man tests etc contrib -include $(srcdir)/%D%/scripts/Makefile.am -include $(srcdir)/%D%/lib/Makefile.am +SUBDIRS += . tests etc contrib include $(srcdir)/%D%/cmd/Makefile.am +include $(srcdir)/%D%/lib/Makefile.am +include $(srcdir)/%D%/man/Makefile.am +include $(srcdir)/%D%/scripts/Makefile.am if BUILD_LINUX SUBDIRS += udev endif @@ -129,7 +130,7 @@ SHELLCHECKSCRIPTS += autogen.sh PHONY += mancheck mancheck: - ${top_srcdir}/scripts/mancheck.sh ${top_srcdir}/man ${top_srcdir}/tests/test-runner/man + $(top_srcdir)/scripts/mancheck.sh $(top_srcdir)/man $(top_srcdir)/tests/test-runner/man PHONY += testscheck testscheck: diff --git a/configure.ac b/configure.ac index 9078f5c1a5a4..42f6fa619828 100644 --- a/configure.ac +++ b/configure.ac @@ -95,7 +95,6 @@ AC_CONFIG_FILES([ lib/libzfs/libzfs.pc lib/libzfsbootenv/libzfsbootenv.pc lib/libzfs_core/libzfs_core.pc - man/Makefile module/Kbuild module/Makefile rpm/Makefile diff --git a/man/Makefile.am b/man/Makefile.am index e58683739e72..86e23c58f116 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,112 +1,108 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am - EXTRA_DIST += \ - man1/cstyle.1 + %D%/man1/cstyle.1 dist_man_MANS = \ - man1/zhack.1 \ - man1/ztest.1 \ - man1/raidz_test.1 \ - man1/zvol_wait.1 \ - man1/arcstat.1 \ + %D%/man1/arcstat.1 \ + %D%/man1/raidz_test.1 \ + %D%/man1/zhack.1 \ + %D%/man1/ztest.1 \ + %D%/man1/zvol_wait.1 \ \ - man5/vdev_id.conf.5 \ + %D%/man5/vdev_id.conf.5 \ \ - man4/spl.4 \ - man4/zfs.4 \ + %D%/man4/spl.4 \ + %D%/man4/zfs.4 \ \ - man7/dracut.zfs.7 \ - man7/zpool-features.7 \ - man7/zfsconcepts.7 \ - man7/zfsprops.7 \ - man7/zpoolconcepts.7 \ - man7/zpoolprops.7 \ + %D%/man7/dracut.zfs.7 \ + %D%/man7/zfsconcepts.7 \ + %D%/man7/zfsprops.7 \ + %D%/man7/zpool-features.7 \ + %D%/man7/zpoolconcepts.7 \ + %D%/man7/zpoolprops.7 \ \ - man8/fsck.zfs.8 \ - man8/mount.zfs.8 \ - man8/vdev_id.8 \ - man8/zdb.8 \ - man8/zfs.8 \ - man8/zfs-allow.8 \ - man8/zfs-bookmark.8 \ - man8/zfs-change-key.8 \ - man8/zfs-clone.8 \ - man8/zfs-create.8 \ - man8/zfs-destroy.8 \ - man8/zfs-diff.8 \ - man8/zfs-get.8 \ - man8/zfs-groupspace.8 \ - man8/zfs-hold.8 \ - man8/zfs-inherit.8 \ - man8/zfs-jail.8 \ - man8/zfs-list.8 \ - man8/zfs-load-key.8 \ - man8/zfs-mount.8 \ - man8/zfs-program.8 \ - man8/zfs-project.8 \ - man8/zfs-projectspace.8 \ - man8/zfs-promote.8 \ - man8/zfs-receive.8 \ - man8/zfs-recv.8 \ - man8/zfs-redact.8 \ - man8/zfs-release.8 \ - man8/zfs-rename.8 \ - man8/zfs-rollback.8 \ - man8/zfs-send.8 \ - man8/zfs-set.8 \ - man8/zfs-share.8 \ - man8/zfs-snapshot.8 \ - man8/zfs-unallow.8 \ - man8/zfs-unjail.8 \ - man8/zfs-unload-key.8 \ - man8/zfs-unmount.8 \ - man8/zfs-upgrade.8 \ - man8/zfs-userspace.8 \ - man8/zfs-wait.8 \ - man8/zfs_ids_to_path.8 \ - man8/zgenhostid.8 \ - man8/zinject.8 \ - man8/zpool.8 \ - man8/zpool-add.8 \ - man8/zpool-attach.8 \ - man8/zpool-checkpoint.8 \ - man8/zpool-clear.8 \ - man8/zpool-create.8 \ - man8/zpool-destroy.8 \ - man8/zpool-detach.8 \ - man8/zpool-events.8 \ - man8/zpool-export.8 \ - man8/zpool-get.8 \ - man8/zpool-history.8 \ - man8/zpool-import.8 \ - man8/zpool-initialize.8 \ - man8/zpool-iostat.8 \ - man8/zpool-labelclear.8 \ - man8/zpool-list.8 \ - man8/zpool-offline.8 \ - man8/zpool-online.8 \ - man8/zpool-reguid.8 \ - man8/zpool-remove.8 \ - man8/zpool-reopen.8 \ - man8/zpool-replace.8 \ - man8/zpool-resilver.8 \ - man8/zpool-scrub.8 \ - man8/zpool-set.8 \ - man8/zpool-split.8 \ - man8/zpool-status.8 \ - man8/zpool-sync.8 \ - man8/zpool-trim.8 \ - man8/zpool-upgrade.8 \ - man8/zpool-wait.8 \ - man8/zstream.8 \ - man8/zstreamdump.8 \ - man8/zpool_influxdb.8 + %D%/man8/fsck.zfs.8 \ + %D%/man8/mount.zfs.8 \ + %D%/man8/vdev_id.8 \ + %D%/man8/zdb.8 \ + %D%/man8/zfs.8 \ + %D%/man8/zfs-allow.8 \ + %D%/man8/zfs-bookmark.8 \ + %D%/man8/zfs-change-key.8 \ + %D%/man8/zfs-clone.8 \ + %D%/man8/zfs-create.8 \ + %D%/man8/zfs-destroy.8 \ + %D%/man8/zfs-diff.8 \ + %D%/man8/zfs-get.8 \ + %D%/man8/zfs-groupspace.8 \ + %D%/man8/zfs-hold.8 \ + %D%/man8/zfs-inherit.8 \ + %D%/man8/zfs-jail.8 \ + %D%/man8/zfs-list.8 \ + %D%/man8/zfs-load-key.8 \ + %D%/man8/zfs-mount.8 \ + %D%/man8/zfs-program.8 \ + %D%/man8/zfs-project.8 \ + %D%/man8/zfs-projectspace.8 \ + %D%/man8/zfs-promote.8 \ + %D%/man8/zfs-receive.8 \ + %D%/man8/zfs-recv.8 \ + %D%/man8/zfs-redact.8 \ + %D%/man8/zfs-release.8 \ + %D%/man8/zfs-rename.8 \ + %D%/man8/zfs-rollback.8 \ + %D%/man8/zfs-send.8 \ + %D%/man8/zfs-set.8 \ + %D%/man8/zfs-share.8 \ + %D%/man8/zfs-snapshot.8 \ + %D%/man8/zfs-unallow.8 \ + %D%/man8/zfs-unjail.8 \ + %D%/man8/zfs-unload-key.8 \ + %D%/man8/zfs-unmount.8 \ + %D%/man8/zfs-upgrade.8 \ + %D%/man8/zfs-userspace.8 \ + %D%/man8/zfs-wait.8 \ + %D%/man8/zfs_ids_to_path.8 \ + %D%/man8/zgenhostid.8 \ + %D%/man8/zinject.8 \ + %D%/man8/zpool.8 \ + %D%/man8/zpool-add.8 \ + %D%/man8/zpool-attach.8 \ + %D%/man8/zpool-checkpoint.8 \ + %D%/man8/zpool-clear.8 \ + %D%/man8/zpool-create.8 \ + %D%/man8/zpool-destroy.8 \ + %D%/man8/zpool-detach.8 \ + %D%/man8/zpool-events.8 \ + %D%/man8/zpool-export.8 \ + %D%/man8/zpool-get.8 \ + %D%/man8/zpool-history.8 \ + %D%/man8/zpool-import.8 \ + %D%/man8/zpool-initialize.8 \ + %D%/man8/zpool-iostat.8 \ + %D%/man8/zpool-labelclear.8 \ + %D%/man8/zpool-list.8 \ + %D%/man8/zpool-offline.8 \ + %D%/man8/zpool-online.8 \ + %D%/man8/zpool-reguid.8 \ + %D%/man8/zpool-remove.8 \ + %D%/man8/zpool-reopen.8 \ + %D%/man8/zpool-replace.8 \ + %D%/man8/zpool-resilver.8 \ + %D%/man8/zpool-scrub.8 \ + %D%/man8/zpool-set.8 \ + %D%/man8/zpool-split.8 \ + %D%/man8/zpool-status.8 \ + %D%/man8/zpool-sync.8 \ + %D%/man8/zpool-trim.8 \ + %D%/man8/zpool-upgrade.8 \ + %D%/man8/zpool-wait.8 \ + %D%/man8/zstream.8 \ + %D%/man8/zstreamdump.8 \ + %D%/man8/zpool_influxdb.8 nodist_man_MANS = \ - man8/zed.8 \ - man8/zfs-mount-generator.8 + %D%/man8/zed.8 \ + %D%/man8/zfs-mount-generator.8 SUBSTFILES += $(nodist_man_MANS) @@ -115,6 +111,7 @@ if BUILD_LINUX # The manual pager in most Linux distros defaults to "BSD" when .Os is blank, # but leaving it blank makes things a lot easier on # FreeBSD when OpenZFS is vendored in the base system. -install-data-hook: - cd $(DESTDIR)$(mandir) && $(SED) ${ac_inplace} -e 's/^\.Os$$/.Os OpenZFS/' $(dist_man_MANS) $(nodist_man_MANS) +INSTALL_DATA_HOOKS += man-install-data-hook +man-install-data-hook: + cd $(DESTDIR)$(mandir) && $(SED) $(ac_inplace) 's/^\.Os$$/.Os OpenZFS/' $(subst %D%/,,$(dist_man_MANS) $(nodist_man_MANS)) endif diff --git a/tests/test-runner/man/Makefile.am b/tests/test-runner/man/Makefile.am index a7017f5f0535..503a5694f453 100644 --- a/tests/test-runner/man/Makefile.am +++ b/tests/test-runner/man/Makefile.am @@ -1,4 +1 @@ dist_man_MANS = test-runner.1 - -install-data-local: - $(INSTALL) -d -m 0755 "$(DESTDIR)$(mandir)/man1" From 93a8c85e7bf5acfc3d2d9c6fade77c921c4ae396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 9 Apr 2022 19:20:52 +0200 Subject: [PATCH 015/119] Move test-runner.1 into top-level man/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dist delta: +zfs-2.1.99/man/man1/test-runner.1 -zfs-2.1.99/tests/test-runner/man/ -zfs-2.1.99/tests/test-runner/man/test-runner.1 Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 36 +++++++++---------- configure.ac | 1 - man/Makefile.am | 6 ++++ .../man => man/man1}/test-runner.1 | 0 tests/test-runner/Makefile.am | 2 +- tests/test-runner/man/Makefile.am | 1 - 6 files changed, 23 insertions(+), 23 deletions(-) rename {tests/test-runner/man => man/man1}/test-runner.1 (100%) delete mode 100644 tests/test-runner/man/Makefile.am diff --git a/Makefile.am b/Makefile.am index 89f258a1d83c..09d5a6b804d7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,7 @@ CLEANFILES = EXTRA_DIST = INSTALL_DATA_HOOKS = ALL_LOCAL = +CHECKS = shellcheck checkbashisms include $(top_srcdir)/config/Shellcheck.am include $(top_srcdir)/config/Rules.am @@ -93,8 +94,11 @@ dist-hook: $(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV) $(SED) $(ac_inplace) 's/\(Release:[[:space:]]*\).*/\1$(RELEASE)/' $(distdir)/META -PHONY += codecheck -codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck zstdcheck +PHONY += codecheck $(CHECKS) +codecheck: $(CHECKS) + +SHELLCHECKDIRS = contrib etc tests +SHELLCHECKSCRIPTS += autogen.sh PHONY += checkstyle checkstyle: codecheck commitcheck @@ -110,7 +114,7 @@ cstyle_line = -print0 | parallel -X0 ${top_srcdir}/scripts/cstyle.pl -cpP {} else cstyle_line = -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} + endif -PHONY += cstyle +CHECKS += cstyle cstyle: @find ${top_srcdir} -name build -prune \ -o -type f -name '*.[hc]' \ @@ -124,31 +128,23 @@ cstyle: $(cstyle_line) filter_executable = -exec test -x '{}' \; -print - -SHELLCHECKDIRS = contrib etc tests -SHELLCHECKSCRIPTS += autogen.sh - -PHONY += mancheck -mancheck: - $(top_srcdir)/scripts/mancheck.sh $(top_srcdir)/man $(top_srcdir)/tests/test-runner/man - -PHONY += testscheck +CHECKS += testscheck testscheck: - @[ $$(find ${top_srcdir}/tests/zfs-tests -type f \ - \( -name '*.ksh' -not ${filter_executable} \) -o \ - \( -name '*.kshlib' ${filter_executable} \) -o \ - \( -name '*.shlib' ${filter_executable} \) -o \ - \( -name '*.cfg' ${filter_executable} \) | \ + @[ $$(find $(top_srcdir)/tests/zfs-tests -type f \ + \( -name '*.ksh' -not $(filter_executable) \) -o \ + \( -name '*.kshlib' $(filter_executable) \) -o \ + \( -name '*.shlib' $(filter_executable) \) -o \ + \( -name '*.cfg' $(filter_executable) \) | \ tee /dev/stderr | wc -l) -eq 0 ] -PHONY += vcscheck +CHECKS += vcscheck vcscheck: @if git rev-parse --git-dir > /dev/null 2>&1; then \ git ls-files . --exclude-standard --others | \ awk '{c++; print} END {if(c>0) exit 1}' ; \ fi -PHONY += zstdcheck +CHECKS += zstdcheck zstdcheck: @$(MAKE) -C module check-zstd-symbols @@ -163,7 +159,7 @@ paxcheck: echo "skipping paxcheck because scanelf is not installed"; \ fi -PHONY += flake8 +CHECKS += flake8 flake8: @if type flake8 > /dev/null 2>&1; then \ flake8 ${top_srcdir}; \ diff --git a/configure.ac b/configure.ac index 42f6fa619828..dd1f63f492f9 100644 --- a/configure.ac +++ b/configure.ac @@ -111,7 +111,6 @@ AC_CONFIG_FILES([ tests/test-runner/Makefile tests/test-runner/bin/Makefile tests/test-runner/include/Makefile - tests/test-runner/man/Makefile tests/zfs-tests/Makefile tests/zfs-tests/callbacks/Makefile tests/zfs-tests/cmd/Makefile diff --git a/man/Makefile.am b/man/Makefile.am index 86e23c58f116..362ee9b7e149 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -4,6 +4,7 @@ EXTRA_DIST += \ dist_man_MANS = \ %D%/man1/arcstat.1 \ %D%/man1/raidz_test.1 \ + %D%/man1/test-runner.1 \ %D%/man1/zhack.1 \ %D%/man1/ztest.1 \ %D%/man1/zvol_wait.1 \ @@ -107,6 +108,11 @@ nodist_man_MANS = \ SUBSTFILES += $(nodist_man_MANS) +CHECKS += mancheck +mancheck: + $(top_srcdir)/scripts/mancheck.sh $(srcdir)/%D% + + if BUILD_LINUX # The manual pager in most Linux distros defaults to "BSD" when .Os is blank, # but leaving it blank makes things a lot easier on diff --git a/tests/test-runner/man/test-runner.1 b/man/man1/test-runner.1 similarity index 100% rename from tests/test-runner/man/test-runner.1 rename to man/man1/test-runner.1 diff --git a/tests/test-runner/Makefile.am b/tests/test-runner/Makefile.am index db3d966142d6..4d4b639dbeac 100644 --- a/tests/test-runner/Makefile.am +++ b/tests/test-runner/Makefile.am @@ -1 +1 @@ -SUBDIRS = bin include man +SUBDIRS = bin include diff --git a/tests/test-runner/man/Makefile.am b/tests/test-runner/man/Makefile.am deleted file mode 100644 index 503a5694f453..000000000000 --- a/tests/test-runner/man/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -dist_man_MANS = test-runner.1 From 2820719800cde2576baa12a43e4b9124a1906e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 9 Apr 2022 19:44:40 +0200 Subject: [PATCH 016/119] autoconf: use include directives instead of recursing down rpm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also simplify .gitignore Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 2 +- configure.ac | 3 --- rpm/.gitignore | 1 + rpm/Makefile.am | 9 ++++++++- rpm/generic/.gitignore | 3 --- rpm/generic/Makefile.am | 1 - rpm/redhat/.gitignore | 3 --- rpm/redhat/Makefile.am | 1 - 8 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 rpm/.gitignore delete mode 100644 rpm/generic/.gitignore delete mode 100644 rpm/generic/Makefile.am delete mode 100644 rpm/redhat/.gitignore delete mode 100644 rpm/redhat/Makefile.am diff --git a/Makefile.am b/Makefile.am index 09d5a6b804d7..7830f2bdd4e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ ACLOCAL_AMFLAGS = -I config SUBDIRS = include if BUILD_LINUX -SUBDIRS += rpm +include $(srcdir)/%D%/rpm/Makefile.am endif CPPCHECKDIRS += etc/systemd/system-generators diff --git a/configure.ac b/configure.ac index dd1f63f492f9..292f9a45f1d1 100644 --- a/configure.ac +++ b/configure.ac @@ -97,12 +97,9 @@ AC_CONFIG_FILES([ lib/libzfs_core/libzfs_core.pc module/Kbuild module/Makefile - rpm/Makefile - rpm/generic/Makefile rpm/generic/zfs-dkms.spec rpm/generic/zfs-kmod.spec rpm/generic/zfs.spec - rpm/redhat/Makefile rpm/redhat/zfs-dkms.spec rpm/redhat/zfs-kmod.spec rpm/redhat/zfs.spec diff --git a/rpm/.gitignore b/rpm/.gitignore new file mode 100644 index 000000000000..f83960d1a7c0 --- /dev/null +++ b/rpm/.gitignore @@ -0,0 +1 @@ +/*/*.spec diff --git a/rpm/Makefile.am b/rpm/Makefile.am index f2cf72cef13c..216cb731fea9 100644 --- a/rpm/Makefile.am +++ b/rpm/Makefile.am @@ -1 +1,8 @@ -SUBDIRS = generic redhat +EXTRA_DIST += \ + %D%/generic/zfs-dkms.spec.in \ + %D%/generic/zfs-kmod.spec.in \ + %D%/generic/zfs.spec.in \ + \ + %D%/redhat/zfs-dkms.spec.in \ + %D%/redhat/zfs-kmod.spec.in \ + %D%/redhat/zfs.spec.in diff --git a/rpm/generic/.gitignore b/rpm/generic/.gitignore deleted file mode 100644 index 7f5daafdd6d4..000000000000 --- a/rpm/generic/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/zfs-dkms.spec -/zfs-kmod.spec -/zfs.spec diff --git a/rpm/generic/Makefile.am b/rpm/generic/Makefile.am deleted file mode 100644 index 89b13640d622..000000000000 --- a/rpm/generic/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST = zfs.spec.in zfs-kmod.spec.in zfs-dkms.spec.in diff --git a/rpm/redhat/.gitignore b/rpm/redhat/.gitignore deleted file mode 100644 index 7f5daafdd6d4..000000000000 --- a/rpm/redhat/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/zfs-dkms.spec -/zfs-kmod.spec -/zfs.spec diff --git a/rpm/redhat/Makefile.am b/rpm/redhat/Makefile.am deleted file mode 100644 index 89b13640d622..000000000000 --- a/rpm/redhat/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST = zfs.spec.in zfs-kmod.spec.in zfs-dkms.spec.in From 674a9f3727f6e54fb3a391d4d6257a96f3a81a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 9 Apr 2022 20:05:18 +0200 Subject: [PATCH 017/119] autoconf: use include directives instead of recursing down udev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 2 +- configure.ac | 2 -- udev/Makefile.am | 7 ++++++- udev/rules.d/Makefile.am | 10 ---------- 4 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 udev/rules.d/Makefile.am diff --git a/Makefile.am b/Makefile.am index 7830f2bdd4e4..e90a2eb5157d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,7 +24,7 @@ include $(srcdir)/%D%/lib/Makefile.am include $(srcdir)/%D%/man/Makefile.am include $(srcdir)/%D%/scripts/Makefile.am if BUILD_LINUX -SUBDIRS += udev +include $(srcdir)/%D%/udev/Makefile.am endif endif CPPCHECKDIRS += module diff --git a/configure.ac b/configure.ac index 292f9a45f1d1..d4aa71e27d99 100644 --- a/configure.ac +++ b/configure.ac @@ -290,8 +290,6 @@ AC_CONFIG_FILES([ tests/zfs-tests/tests/perf/regression/Makefile tests/zfs-tests/tests/perf/scripts/Makefile tests/zfs-tests/tests/stress/Makefile - udev/Makefile - udev/rules.d/Makefile zfs.release ]) diff --git a/udev/Makefile.am b/udev/Makefile.am index f930941fb083..27d45a36a42f 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -1 +1,6 @@ -SUBDIRS = rules.d +udevrule_DATA = \ + %D%/rules.d/69-vdev.rules \ + %D%/rules.d/60-zvol.rules \ + %D%/rules.d/90-zfs.rules + +SUBSTFILES += $(udevrule_DATA) diff --git a/udev/rules.d/Makefile.am b/udev/rules.d/Makefile.am deleted file mode 100644 index c62b05e53f5d..000000000000 --- a/udev/rules.d/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am - -udevrule_DATA = \ - 69-vdev.rules \ - 60-zvol.rules \ - 90-zfs.rules - -SUBSTFILES += $(udevrule_DATA) From 50d2c9e4fd2a891cad9530da39b39a173307e1f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 00:16:59 +0200 Subject: [PATCH 018/119] autoconf: use include directives instead of recursing down contrib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also make the pyzfs build actually out-of-tree and quiet by default Reviewed-by: Brian Behlendorf Co-authored-by: Rapptz Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 5 ++- config/Substfiles.am | 2 + configure.ac | 16 ------- contrib/Makefile.am | 15 +++---- contrib/bash_completion.d/Makefile.am | 16 ++----- contrib/bpftrace/Makefile.am | 8 ++-- contrib/dracut/{90zfs => }/.gitignore | 0 .../dracut/02zfsexpandknowledge/.gitignore | 1 - .../dracut/02zfsexpandknowledge/Makefile.am | 11 ----- contrib/dracut/90zfs/Makefile.am | 27 ------------ contrib/dracut/Makefile.am | 29 +++++++++++-- contrib/initramfs/Makefile.am | 42 +++++++++++++++---- contrib/initramfs/conf-hooks.d/Makefile.am | 4 -- contrib/initramfs/conf.d/Makefile.am | 4 -- contrib/initramfs/hooks/Makefile.am | 13 ------ contrib/initramfs/scripts/Makefile.am | 12 ------ .../initramfs/scripts/local-top/Makefile.am | 8 ---- contrib/pam_zfs_key/Makefile.am | 25 ++++++----- contrib/pyzfs/Makefile.am | 29 ++++++------- contrib/pyzfs/setup.py.in | 8 ++-- contrib/zcp/Makefile.am | 2 +- 21 files changed, 111 insertions(+), 166 deletions(-) rename contrib/dracut/{90zfs => }/.gitignore (100%) delete mode 100644 contrib/dracut/02zfsexpandknowledge/.gitignore delete mode 100644 contrib/dracut/02zfsexpandknowledge/Makefile.am delete mode 100644 contrib/dracut/90zfs/Makefile.am delete mode 100644 contrib/initramfs/conf-hooks.d/Makefile.am delete mode 100644 contrib/initramfs/conf.d/Makefile.am delete mode 100644 contrib/initramfs/hooks/Makefile.am delete mode 100644 contrib/initramfs/scripts/Makefile.am delete mode 100644 contrib/initramfs/scripts/local-top/Makefile.am diff --git a/Makefile.am b/Makefile.am index e90a2eb5157d..ca2093781dc0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,8 +18,9 @@ endif CPPCHECKDIRS += etc/systemd/system-generators if CONFIG_USER -SUBDIRS += . tests etc contrib +SUBDIRS += . tests etc include $(srcdir)/%D%/cmd/Makefile.am +include $(srcdir)/%D%/contrib/Makefile.am include $(srcdir)/%D%/lib/Makefile.am include $(srcdir)/%D%/man/Makefile.am include $(srcdir)/%D%/scripts/Makefile.am @@ -97,7 +98,7 @@ dist-hook: PHONY += codecheck $(CHECKS) codecheck: $(CHECKS) -SHELLCHECKDIRS = contrib etc tests +SHELLCHECKDIRS = etc tests SHELLCHECKSCRIPTS += autogen.sh PHONY += checkstyle diff --git a/config/Substfiles.am b/config/Substfiles.am index 7f069877a6ca..ce02ac9c7ef1 100644 --- a/config/Substfiles.am +++ b/config/Substfiles.am @@ -1,4 +1,5 @@ subst_sed_cmd = \ + -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \ -e 's|@bindir[@]|$(bindir)|g' \ -e 's|@sbindir[@]|$(sbindir)|g' \ -e 's|@datadir[@]|$(datadir)|g' \ @@ -12,6 +13,7 @@ subst_sed_cmd = \ -e 's|@udevdir[@]|$(udevdir)|g' \ -e 's|@udevruledir[@]|$(udevruledir)|g' \ -e 's|@zfsexecdir[@]|$(zfsexecdir)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' \ -e 's|@PYTHON[@]|$(PYTHON)|g' \ -e 's|@PYTHON_SHEBANG[@]|$(PYTHON_SHEBANG)|g' \ -e 's|@DEFAULT_INIT_NFS_SERVER[@]|$(DEFAULT_INIT_NFS_SERVER)|g' \ diff --git a/configure.ac b/configure.ac index d4aa71e27d99..f536ff2fc2a4 100644 --- a/configure.ac +++ b/configure.ac @@ -66,22 +66,6 @@ ZFS_AC_DEBUG_INVARIANTS AC_CONFIG_FILES([ Makefile - contrib/Makefile - contrib/bash_completion.d/Makefile - contrib/bpftrace/Makefile - contrib/dracut/02zfsexpandknowledge/Makefile - contrib/dracut/90zfs/Makefile - contrib/dracut/Makefile - contrib/initramfs/Makefile - contrib/initramfs/conf.d/Makefile - contrib/initramfs/conf-hooks.d/Makefile - contrib/initramfs/hooks/Makefile - contrib/initramfs/scripts/Makefile - contrib/initramfs/scripts/local-top/Makefile - contrib/pam_zfs_key/Makefile - contrib/pyzfs/Makefile - contrib/pyzfs/setup.py - contrib/zcp/Makefile etc/Makefile etc/default/Makefile etc/init.d/Makefile diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 5ec13ece5327..fa51bd941d27 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -1,12 +1,13 @@ -include $(top_srcdir)/config/Shellcheck.am +include $(srcdir)/%D%/bash_completion.d/Makefile.am +include $(srcdir)/%D%/pyzfs/Makefile.am +include $(srcdir)/%D%/zcp/Makefile.am -SUBDIRS = bash_completion.d pyzfs zcp if BUILD_LINUX -SUBDIRS += bpftrace dracut initramfs +include $(srcdir)/%D%/bpftrace/Makefile.am +include $(srcdir)/%D%/dracut/Makefile.am +include $(srcdir)/%D%/initramfs/Makefile.am endif + if PAM_ZFS_ENABLED -SUBDIRS += pam_zfs_key +include $(srcdir)/%D%/pam_zfs_key/Makefile.am endif -DIST_SUBDIRS = bash_completion.d bpftrace dracut initramfs pam_zfs_key pyzfs zcp - -SHELLCHECKDIRS = bash_completion.d bpftrace dracut initramfs diff --git a/contrib/bash_completion.d/Makefile.am b/contrib/bash_completion.d/Makefile.am index 0295843ebcbe..4f451fb1d82b 100644 --- a/contrib/bash_completion.d/Makefile.am +++ b/contrib/bash_completion.d/Makefile.am @@ -1,14 +1,6 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -bashcompletiondir = $(sysconfdir)/bash_completion.d - -noinst_DATA = zfs - -EXTRA_DIST += $(noinst_DATA) -SUBSTFILES += $(noinst_DATA) +noinst_DATA = %D%/zfs +EXTRA_DIST += $(noinst_DATA) +SUBSTFILES += $(noinst_DATA) SHELLCHECKSCRIPTS += $(noinst_DATA) -SHELLCHECK_SHELL = bash +$(call SHELLCHECK_OPTS,$(noinst_DATA)): SHELLCHECK_SHELL = bash diff --git a/contrib/bpftrace/Makefile.am b/contrib/bpftrace/Makefile.am index 7194ec689205..5382f1e1de42 100644 --- a/contrib/bpftrace/Makefile.am +++ b/contrib/bpftrace/Makefile.am @@ -1,7 +1,5 @@ -include $(top_srcdir)/config/Shellcheck.am - -EXTRA_DIST = \ +EXTRA_DIST += $(addprefix %D%/, \ taskqlatency.bt \ - zfs-trace.sh + zfs-trace.sh) -SHELLCHECKSCRIPTS += zfs-trace.sh +SHELLCHECKSCRIPTS += %D%/zfs-trace.sh diff --git a/contrib/dracut/90zfs/.gitignore b/contrib/dracut/.gitignore similarity index 100% rename from contrib/dracut/90zfs/.gitignore rename to contrib/dracut/.gitignore diff --git a/contrib/dracut/02zfsexpandknowledge/.gitignore b/contrib/dracut/02zfsexpandknowledge/.gitignore deleted file mode 100644 index 7fb6b964f058..000000000000 --- a/contrib/dracut/02zfsexpandknowledge/.gitignore +++ /dev/null @@ -1 +0,0 @@ -module-setup.sh diff --git a/contrib/dracut/02zfsexpandknowledge/Makefile.am b/contrib/dracut/02zfsexpandknowledge/Makefile.am deleted file mode 100644 index 23fcc0a3c066..000000000000 --- a/contrib/dracut/02zfsexpandknowledge/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -pkgdracutdir = $(dracutdir)/modules.d/02zfsexpandknowledge -pkgdracut_SCRIPTS = \ - module-setup.sh - -SUBSTFILES += $(pkgdracut_SCRIPTS) -SHELLCHECKSCRIPTS += $(pkgdracut_SCRIPTS) diff --git a/contrib/dracut/90zfs/Makefile.am b/contrib/dracut/90zfs/Makefile.am deleted file mode 100644 index 28bedfb394e7..000000000000 --- a/contrib/dracut/90zfs/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -pkgdracutdir = $(dracutdir)/modules.d/90zfs -pkgdracut_SCRIPTS = \ - export-zfs.sh \ - module-setup.sh \ - mount-zfs.sh \ - parse-zfs.sh \ - zfs-generator.sh \ - zfs-load-key.sh \ - zfs-needshutdown.sh \ - zfs-lib.sh \ - import-opts-generator.sh - -pkgdracut_DATA = \ - zfs-env-bootfs.service \ - zfs-snapshot-bootfs.service \ - zfs-rollback-bootfs.service - -SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA) - -# Provided by /bin/sleep, and, again, every implementation of that supports this -CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.' -SHELLCHECKSCRIPTS += $(pkgdracut_SCRIPTS) diff --git a/contrib/dracut/Makefile.am b/contrib/dracut/Makefile.am index 09805277ffb0..f0c103b0a4da 100644 --- a/contrib/dracut/Makefile.am +++ b/contrib/dracut/Makefile.am @@ -1,6 +1,27 @@ -include $(top_srcdir)/config/Shellcheck.am +pkgdracut_02dir = $(dracutdir)/modules.d/02zfsexpandknowledge +pkgdracut_02_SCRIPTS = \ + %D%/02zfsexpandknowledge/module-setup.sh -SUBDIRS = 02zfsexpandknowledge 90zfs -SHELLCHECKDIRS = $(SUBDIRS) +pkgdracut_90dir = $(dracutdir)/modules.d/90zfs +pkgdracut_90_SCRIPTS = \ + %D%/90zfs/export-zfs.sh \ + %D%/90zfs/import-opts-generator.sh \ + %D%/90zfs/module-setup.sh \ + %D%/90zfs/mount-zfs.sh \ + %D%/90zfs/parse-zfs.sh \ + %D%/90zfs/zfs-generator.sh \ + %D%/90zfs/zfs-lib.sh \ + %D%/90zfs/zfs-load-key.sh \ + %D%/90zfs/zfs-needshutdown.sh -EXTRA_DIST = README.md +pkgdracut_90_DATA = \ + %D%/90zfs/zfs-env-bootfs.service \ + %D%/90zfs/zfs-rollback-bootfs.service \ + %D%/90zfs/zfs-snapshot-bootfs.service + +SUBSTFILES += $(pkgdracut_02_SCRIPTS) $(pkgdracut_90_SCRIPTS) $(pkgdracut_90_DATA) +SHELLCHECKSCRIPTS += $(pkgdracut_02_SCRIPTS) $(pkgdracut_90_SCRIPTS) +# Provided by /bin/sleep, and, again, every implementation of that supports this +$(call SHELLCHECK_OPTS,$(pkgdracut_90_SCRIPTS)): CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.' + +EXTRA_DIST += $(addprefix %D%/,README.md) diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am index 5ee8e16a0a21..6917b517f330 100644 --- a/contrib/initramfs/Makefile.am +++ b/contrib/initramfs/Makefile.am @@ -1,11 +1,39 @@ -include $(top_srcdir)/config/Shellcheck.am +i_tdir = /usr/share/initramfs-tools +dist_i_t_SCRIPTS = \ + %D%/zfsunlock -initrddir = /usr/share/initramfs-tools -dist_initrd_SCRIPTS = \ - zfsunlock +i_t_confhooks_ddir = $(i_tdir)/conf-hooks.d +dist_i_t_confhooks_d_DATA = \ + %D%/conf-hooks.d/zfs -SUBDIRS = conf.d conf-hooks.d hooks scripts -SHELLCHECKDIRS = hooks scripts -EXTRA_DIST = README.md +i_t_conf_ddir = $(i_tdir)/conf.d +dist_i_t_conf_d_DATA = \ + %D%/conf.d/zfs + + +i_t_hooksdir = $(i_tdir)/hooks +i_t_hooks_SCRIPTS = \ + %D%/hooks/zfs \ + %D%/hooks/zfsunlock + +SUBSTFILES += $(i_t_hooks_SCRIPTS) + + +i_t_scriptsdir = $(i_tdir)/scripts +dist_i_t_scripts_SCRIPTS = \ + %D%/scripts/zfs + + +i_t_scripts_localtopdir = $(i_t_scriptsdir)/local-top +dist_i_t_scripts_localtop_SCRIPTS = \ + %D%/scripts/local-top/zfs + + +i_t_check_scripts = $(dist_i_t_SCRIPTS) $(i_t_hooks_SCRIPTS) $(dist_i_t_scripts_SCRIPTS) $(dist_i_t_scripts_localtop_SCRIPTS) +SHELLCHECKSCRIPTS += $(i_t_check_scripts) +$(call SHELLCHECK_OPTS,$(i_t_check_scripts)): SHELLCHECK_SHELL = sh + + +EXTRA_DIST += $(addprefix %D%/,README.md) diff --git a/contrib/initramfs/conf-hooks.d/Makefile.am b/contrib/initramfs/conf-hooks.d/Makefile.am deleted file mode 100644 index f84ba5cc7e37..000000000000 --- a/contrib/initramfs/conf-hooks.d/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -confhooksddir = /usr/share/initramfs-tools/conf-hooks.d - -dist_confhooksd_DATA = \ - zfs diff --git a/contrib/initramfs/conf.d/Makefile.am b/contrib/initramfs/conf.d/Makefile.am deleted file mode 100644 index 5ef27e0aa1ce..000000000000 --- a/contrib/initramfs/conf.d/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -confddir = /usr/share/initramfs-tools/conf.d - -dist_confd_DATA = \ - zfs diff --git a/contrib/initramfs/hooks/Makefile.am b/contrib/initramfs/hooks/Makefile.am deleted file mode 100644 index e872c0a00b1d..000000000000 --- a/contrib/initramfs/hooks/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -hooksdir = /usr/share/initramfs-tools/hooks - -hooks_SCRIPTS = \ - zfs \ - zfsunlock - -SUBSTFILES += $(hooks_SCRIPTS) -SHELLCHECKSCRIPTS += $(hooks_SCRIPTS) diff --git a/contrib/initramfs/scripts/Makefile.am b/contrib/initramfs/scripts/Makefile.am deleted file mode 100644 index 8b48f2056888..000000000000 --- a/contrib/initramfs/scripts/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -include $(top_srcdir)/config/Shellcheck.am - -scriptsdir = /usr/share/initramfs-tools/scripts - -dist_scripts_SCRIPTS = \ - zfs - -SUBDIRS = local-top - -SHELLCHECKDIRS = $(SUBDIRS) -SHELLCHECK_SHELL = sh -SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) diff --git a/contrib/initramfs/scripts/local-top/Makefile.am b/contrib/initramfs/scripts/local-top/Makefile.am deleted file mode 100644 index f64665f4b27b..000000000000 --- a/contrib/initramfs/scripts/local-top/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -include $(top_srcdir)/config/Shellcheck.am - -localtopdir = /usr/share/initramfs-tools/scripts/local-top - -dist_localtop_SCRIPTS = \ - zfs - -SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) diff --git a/contrib/pam_zfs_key/Makefile.am b/contrib/pam_zfs_key/Makefile.am index bcb60b71ce41..aaa608b7da2b 100644 --- a/contrib/pam_zfs_key/Makefile.am +++ b/contrib/pam_zfs_key/Makefile.am @@ -1,19 +1,18 @@ -include $(top_srcdir)/config/Rules.am +%C%_pam_zfs_key_la_CFLAGS = $(AM_CFLAGS) +%C%_pam_zfs_key_la_CFLAGS += $(LIBCRYPTO_CFLAGS) -AM_CFLAGS += $(LIBCRYPTO_CFLAGS) +pammodule_LTLIBRARIES = %D%/pam_zfs_key.la -pammodule_LTLIBRARIES = pam_zfs_key.la +%C%_pam_zfs_key_la_SOURCES = %D%/pam_zfs_key.c -pam_zfs_key_la_SOURCES = pam_zfs_key.c +%C%_pam_zfs_key_la_LIBADD = \ + libnvpair.la \ + libuutil.la \ + libzfs.la \ + libzfs_core.la -pam_zfs_key_la_LIBADD = \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libuutil.la \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la +%C%_pam_zfs_key_la_LIBADD += -lpam $(LIBCRYPTO_LIBS) -pam_zfs_key_la_LDFLAGS = -version-info 1:0:0 -avoid-version -module -shared +%C%_pam_zfs_key_la_LDFLAGS = -version-info 1:0:0 -avoid-version -module -shared -pam_zfs_key_la_LIBADD += -lpam $(LIBCRYPTO_LIBS) - -dist_pamconfigs_DATA = zfs_key +dist_pamconfigs_DATA = %D%/zfs_key diff --git a/contrib/pyzfs/Makefile.am b/contrib/pyzfs/Makefile.am index fa1bb32ce2eb..1bcbfd042bc1 100644 --- a/contrib/pyzfs/Makefile.am +++ b/contrib/pyzfs/Makefile.am @@ -1,10 +1,11 @@ -EXTRA_DIST = libzfs_core setup.py.in README LICENSE docs +EXTRA_DIST += $(addprefix %D%/,libzfs_core README LICENSE docs) +SUBSTFILES += %D%/setup.py if PYZFS_ENABLED -all: - -all-local: - $(PYTHON) setup.py build +ALL_LOCAL += pyzfs-all-local +pyzfs_V_1 = -v +pyzfs-all-local: %D%/setup.py + cd %D% && $(PYTHON) setup.py -q $(pyzfs_V_$(V)) egg_info -e . build # # On Debian (Ubuntu, and other downstream distros) the install location of @@ -24,17 +25,13 @@ all-local: # files are later created by manually loading the Python modules. # install-exec-local: - $(PYTHON) $(builddir)/setup.py install \ - --prefix $(prefix) \ - --root $(DESTDIR)/ \ - --install-lib $(pythonsitedir) \ - --single-version-externally-managed \ - --verbose - -clean: clean-local - rm -rf build/ pyzfs.egg-info/ + cd %D% && $(PYTHON) setup.py egg_info -e . install \ + --prefix $(prefix) \ + --root $(DESTDIR)/ \ + --install-lib $(pythonsitedir) \ + --single-version-externally-managed \ + --verbose clean-local: - -check-local: all + -$(RM) -r %D%/build/ %D%/pyzfs.egg-info/ endif diff --git a/contrib/pyzfs/setup.py.in b/contrib/pyzfs/setup.py.in index 934b3189ebe1..43a1accfaf02 100644 --- a/contrib/pyzfs/setup.py.in +++ b/contrib/pyzfs/setup.py.in @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from __future__ import absolute_import, division, print_function - from setuptools import setup, find_packages +import os.path + +srcdir = "@abs_top_srcdir@/contrib/pyzfs" setup( name="pyzfs", @@ -44,7 +45,8 @@ setup( "libzfs_core", ], - packages=find_packages(), + packages=find_packages(where=srcdir), + package_dir={"": os.path.relpath(srcdir)}, include_package_data=True, install_requires=[ "cffi", diff --git a/contrib/zcp/Makefile.am b/contrib/zcp/Makefile.am index e6a777ad7ba7..759a9d529dc8 100644 --- a/contrib/zcp/Makefile.am +++ b/contrib/zcp/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = autosnap.lua +EXTRA_DIST += $(addprefix %D%/,autosnap.lua) From 48f4379974d5b28bba9c22fcf3bab6ceb2844ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 01:19:15 +0200 Subject: [PATCH 019/119] autoconf: use include directives instead of recursing down etc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dist diff: -zfs-2.1.99/etc/systemd/system/50-zfs.preset.in +zfs-2.1.99/etc/systemd/system/50-zfs.preset Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 8 +- config/CppCheck.am | 4 +- config/Shellcheck.am | 4 +- config/user-systemd.m4 | 7 +- config/user-sysvinit.m4 | 7 +- config/zfs-build.m4 | 8 ++ configure.ac | 9 -- etc/Makefile.am | 96 ++++++++++++++++++- etc/default/Makefile.am | 11 --- etc/init.d/Makefile.am | 13 --- etc/modules-load.d/.gitignore | 1 - etc/modules-load.d/Makefile.am | 2 - etc/sudoers.d/Makefile.am | 5 - etc/systemd/Makefile.am | 1 - etc/systemd/system-generators/Makefile.am | 15 --- etc/systemd/system/.gitignore | 1 - .../{50-zfs.preset.in => 50-zfs.preset} | 0 etc/systemd/system/Makefile.am | 26 ----- etc/zfs/Makefile.am | 21 ---- tests/Makefile.am | 1 + 20 files changed, 113 insertions(+), 127 deletions(-) delete mode 100644 etc/default/Makefile.am delete mode 100644 etc/init.d/Makefile.am delete mode 100644 etc/modules-load.d/.gitignore delete mode 100644 etc/modules-load.d/Makefile.am delete mode 100644 etc/sudoers.d/Makefile.am delete mode 100644 etc/systemd/Makefile.am delete mode 100644 etc/systemd/system-generators/Makefile.am rename etc/systemd/system/{50-zfs.preset.in => 50-zfs.preset} (100%) delete mode 100644 etc/systemd/system/Makefile.am delete mode 100644 etc/zfs/Makefile.am diff --git a/Makefile.am b/Makefile.am index ca2093781dc0..e1d311c1328f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,9 +4,9 @@ INSTALL_DATA_HOOKS = ALL_LOCAL = CHECKS = shellcheck checkbashisms -include $(top_srcdir)/config/Shellcheck.am include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/CppCheck.am +include $(top_srcdir)/config/Shellcheck.am include $(top_srcdir)/config/Substfiles.am ACLOCAL_AMFLAGS = -I config @@ -16,11 +16,11 @@ if BUILD_LINUX include $(srcdir)/%D%/rpm/Makefile.am endif -CPPCHECKDIRS += etc/systemd/system-generators if CONFIG_USER -SUBDIRS += . tests etc +SUBDIRS += . tests include $(srcdir)/%D%/cmd/Makefile.am include $(srcdir)/%D%/contrib/Makefile.am +include $(srcdir)/%D%/etc/Makefile.am include $(srcdir)/%D%/lib/Makefile.am include $(srcdir)/%D%/man/Makefile.am include $(srcdir)/%D%/scripts/Makefile.am @@ -98,7 +98,7 @@ dist-hook: PHONY += codecheck $(CHECKS) codecheck: $(CHECKS) -SHELLCHECKDIRS = etc tests +SHELLCHECKDIRS = tests SHELLCHECKSCRIPTS += autogen.sh PHONY += checkstyle diff --git a/config/CppCheck.am b/config/CppCheck.am index 3fa6bddda89a..d0f1d6f1920f 100644 --- a/config/CppCheck.am +++ b/config/CppCheck.am @@ -13,9 +13,9 @@ CPPCHECKTARGETS = cppcheck-recursive-%: $(MAKE) -C $(subst ^,/,$(subst cppcheck-recursive-,,$@)) cppcheck -_CTGT = $(subst -,_,$(subst .,_,$(subst cppcheck-for-,,$@))) +_CTGT = $(subst cppcheck-for-,,$@) cppcheck-for-%: @[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)$(nodist_$(_CTGT)_SOURCES)" ] $(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES) $(nodist_$(_CTGT)_SOURCES) -cppcheck: $(addprefix cppcheck-for-,$(CPPCHECKTARGETS)) $(addprefix cppcheck-recursive-,$(subst /,^,$(CPPCHECKDIRS))) +cppcheck: $(addprefix cppcheck-for-,$(subst -,_,$(subst .,_,$(subst /,_,$(CPPCHECKTARGETS))))) $(addprefix cppcheck-recursive-,$(CPPCHECKDIRS)) diff --git a/config/Shellcheck.am b/config/Shellcheck.am index 873fb8eae079..9002b76dee3a 100644 --- a/config/Shellcheck.am +++ b/config/Shellcheck.am @@ -12,7 +12,7 @@ JUST_SHELLCHECK_OPTS = $(addprefix shellcheck-here-,$(subst /,^,$(1))) JUST_CHECKBASHISMS_OPTS = $(addprefix checkbashisms-here-,$(subst /,^,$(1))) SHELLCHECK_OPTS = $(call JUST_SHELLCHECK_OPTS,$(1)) $(call JUST_CHECKBASHISMS_OPTS,$(1)) -.PHONY: shellcheck shellcheck-recursive +PHONY += shellcheck shellcheck-recursive shellcheck-recursive: @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done @@ -28,7 +28,7 @@ endif shellcheck: $(SHELLCHECKSCRIPTS) $(call JUST_SHELLCHECK_OPTS,$(SHELLCHECKSCRIPTS)) shellcheck-recursive -.PHONY: checkbashisms checkbashisms-recursive +PHONY += checkbashisms checkbashisms-recursive checkbashisms-recursive: @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done diff --git a/config/user-systemd.m4 b/config/user-systemd.m4 index 63f02ad2a82b..e4fd0b57c2b7 100644 --- a/config/user-systemd.m4 +++ b/config/user-systemd.m4 @@ -35,16 +35,15 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [ AC_MSG_RESULT([$enable_systemd]) AS_IF([test "x$enable_systemd" = xyes], [ - ZFS_INIT_SYSTEMD=systemd - ZFS_MODULE_LOAD=modules-load.d DEFINE_SYSTEMD='--with systemd --define "_unitdir $(systemdunitdir)" --define "_presetdir $(systemdpresetdir)" --define "_generatordir $(systemdgeneratordir)"' modulesloaddir=$systemdmodulesloaddir ],[ DEFINE_SYSTEMD='--without systemd' ]) - AC_SUBST(ZFS_INIT_SYSTEMD) - AC_SUBST(ZFS_MODULE_LOAD) + ZFS_INIT_SYSTEMD=$enable_systemd + ZFS_WANT_MODULES_LOAD_D=$enable_systemd + AC_SUBST(DEFINE_SYSTEMD) AC_SUBST(systemdunitdir) AC_SUBST(systemdpresetdir) diff --git a/config/user-sysvinit.m4 b/config/user-sysvinit.m4 index b6b63f1cfa36..cf3c8129f0d2 100644 --- a/config/user-sysvinit.m4 +++ b/config/user-sysvinit.m4 @@ -2,10 +2,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSVINIT], [ AC_ARG_ENABLE(sysvinit, AS_HELP_STRING([--enable-sysvinit], [install SysV init scripts [default: yes]]), - [],enable_sysvinit=yes) + [], enable_sysvinit=yes) - AS_IF([test "x$enable_sysvinit" = xyes], - [ZFS_INIT_SYSV=init.d]) - - AC_SUBST(ZFS_INIT_SYSV) + ZFS_INIT_SYSV=$enable_sysvinit ]) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 726b4b420c77..59bca5579252 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -259,6 +259,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [ AC_SUBST(TEST_JOBS) ]) + ZFS_INIT_SYSV= + ZFS_INIT_SYSTEMD= + ZFS_WANT_MODULES_LOAD_D= + case "$ZFS_CONFIG" in kernel) ZFS_AC_CONFIG_KERNEL ;; user) ZFS_AC_CONFIG_USER ;; @@ -271,6 +275,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [ user kernel|user|all|srpm]) ;; esac + AM_CONDITIONAL([INIT_SYSV], [test "x$ZFS_INIT_SYSV" = "xyes"]) + AM_CONDITIONAL([INIT_SYSTEMD], [test "x$ZFS_INIT_SYSTEMD" = "xyes"]) + AM_CONDITIONAL([WANT_MODULES_LOAD_D], [test "x$ZFS_WANT_MODULES_LOAD_D" = "xyes"]) + AM_CONDITIONAL([CONFIG_USER], [test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all]) AM_CONDITIONAL([CONFIG_KERNEL], diff --git a/configure.ac b/configure.ac index f536ff2fc2a4..c5af86c605c7 100644 --- a/configure.ac +++ b/configure.ac @@ -66,15 +66,6 @@ ZFS_AC_DEBUG_INVARIANTS AC_CONFIG_FILES([ Makefile - etc/Makefile - etc/default/Makefile - etc/init.d/Makefile - etc/modules-load.d/Makefile - etc/sudoers.d/Makefile - etc/systemd/Makefile - etc/systemd/system-generators/Makefile - etc/systemd/system/Makefile - etc/zfs/Makefile include/Makefile lib/libzfs/libzfs.pc lib/libzfsbootenv/libzfsbootenv.pc diff --git a/etc/Makefile.am b/etc/Makefile.am index 179c2400978c..ffe5fad2b4a9 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -1,9 +1,95 @@ -include $(top_srcdir)/config/Shellcheck.am +sudoersddir = $(sysconfdir)/sudoers.d +sudoersd_DATA = \ + %D%/sudoers.d/zfs + +EXTRA_DIST += $(sudoersd_DATA) + + +sysconf_zfsdir = $(sysconfdir)/zfs + +dist_sysconf_zfs_DATA = \ + %D%/zfs/vdev_id.conf.alias.example \ + %D%/zfs/vdev_id.conf.multipath.example \ + %D%/zfs/vdev_id.conf.sas_direct.example \ + %D%/zfs/vdev_id.conf.sas_switch.example \ + %D%/zfs/vdev_id.conf.scsi.example + +sysconf_zfs_SCRIPTS = \ + %D%/zfs/zfs-functions + +SUBSTFILES += $(sysconf_zfs_SCRIPTS) +SHELLCHECKSCRIPTS += $(sysconf_zfs_SCRIPTS) +$(call SHELLCHECK_OPTS,$(sysconf_zfs_SCRIPTS)): SHELLCHECK_SHELL = sh -SUBDIRS = zfs sudoers.d -SHELLCHECKDIRS = default $(ZFS_INIT_SYSV) zfs if BUILD_LINUX -SUBDIRS += default $(ZFS_INIT_SYSTEMD) $(ZFS_INIT_SYSV) $(ZFS_MODULE_LOAD) +initconf_SCRIPTS = \ + %D%/default/zfs + +SUBSTFILES += $(initconf_SCRIPTS) +SHELLCHECKSCRIPTS += $(initconf_SCRIPTS) +$(call SHELLCHECK_OPTS,$(initconf_SCRIPTS)): SHELLCHECK_SHELL = sh + + +if INIT_SYSV +EXTRA_DIST += $(addprefix %D%/,init.d/README.md) + +init_SCRIPTS = \ + %D%/init.d/zfs-import \ + %D%/init.d/zfs-load-key \ + %D%/init.d/zfs-mount \ + %D%/init.d/zfs-share \ + %D%/init.d/zfs-zed + +SUBSTFILES += $(init_SCRIPTS) +SHELLCHECKSCRIPTS += $(init_SCRIPTS) +$(call SHELLCHECK_OPTS,$(init_SCRIPTS)): SHELLCHECK_SHELL = sh +endif + + +if INIT_SYSTEMD +dist_systemdpreset_DATA = \ + %D%/systemd/system/50-zfs.preset + +systemdunit_DATA = \ + %D%/systemd/system/zfs-import-cache.service \ + %D%/systemd/system/zfs-import-scan.service \ + %D%/systemd/system/zfs-import.target \ + %D%/systemd/system/zfs-mount.service \ + %D%/systemd/system/zfs-scrub-monthly@.timer \ + %D%/systemd/system/zfs-scrub-weekly@.timer \ + %D%/systemd/system/zfs-scrub@.service \ + %D%/systemd/system/zfs-share.service \ + %D%/systemd/system/zfs-volume-wait.service \ + %D%/systemd/system/zfs-volumes.target \ + %D%/systemd/system/zfs-zed.service \ + %D%/systemd/system/zfs.target + +SUBSTFILES += $(systemdunit_DATA) + +INSTALL_DATA_HOOKS += systemd-install-data-hook +systemd-install-data-hook: + $(MKDIR_P) "$(DESTDIR)$(systemdunitdir)" + ln -sf /dev/null "$(DESTDIR)$(systemdunitdir)/zfs-import.service" + + +systemdgenerator_PROGRAMS = \ + %D%/systemd/system-generators/zfs-mount-generator + +%C%_systemd_system_generators_zfs_mount_generator_SOURCES = \ + %D%/systemd/system-generators/zfs-mount-generator.c + +%C%_systemd_system_generators_zfs_mount_generator_LDADD = \ + libzfs.la + +%C%_systemd_system_generators_zfs_mount_generator_LDFLAGS = -pthread + +CPPCHECKTARGETS += $(systemdgenerator_PROGRAMS) +endif + + +if WANT_MODULES_LOAD_D +dist_modulesload_DATA = \ + %D%/modules-load.d/zfs.conf +endif endif -DIST_SUBDIRS = default init.d zfs systemd modules-load.d sudoers.d diff --git a/etc/default/Makefile.am b/etc/default/Makefile.am deleted file mode 100644 index 98f22b8da6ea..000000000000 --- a/etc/default/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -initconf_SCRIPTS = zfs - -SUBSTFILES += $(initconf_SCRIPTS) - -SHELLCHECK_SHELL = sh -SHELLCHECKSCRIPTS += $(initconf_SCRIPTS) diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am deleted file mode 100644 index 0a997f44552b..000000000000 --- a/etc/init.d/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -EXTRA_DIST += README.md - -init_SCRIPTS = zfs-import zfs-load-key zfs-mount zfs-share zfs-zed - -SUBSTFILES += $(init_SCRIPTS) - -SHELLCHECK_SHELL = sh -SHELLCHECKSCRIPTS += $(init_SCRIPTS) diff --git a/etc/modules-load.d/.gitignore b/etc/modules-load.d/.gitignore deleted file mode 100644 index fee921708337..000000000000 --- a/etc/modules-load.d/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.conf diff --git a/etc/modules-load.d/Makefile.am b/etc/modules-load.d/Makefile.am deleted file mode 100644 index 8a2955767b1e..000000000000 --- a/etc/modules-load.d/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -dist_modulesload_DATA = \ - zfs.conf diff --git a/etc/sudoers.d/Makefile.am b/etc/sudoers.d/Makefile.am deleted file mode 100644 index 6f7ac8dbfd61..000000000000 --- a/etc/sudoers.d/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -sudoersddir = $(sysconfdir)/sudoers.d -sudoersd_DATA = zfs - -EXTRA_DIST = \ - zfs diff --git a/etc/systemd/Makefile.am b/etc/systemd/Makefile.am deleted file mode 100644 index 7b47b93fc105..000000000000 --- a/etc/systemd/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = system system-generators diff --git a/etc/systemd/system-generators/Makefile.am b/etc/systemd/system-generators/Makefile.am deleted file mode 100644 index ee51d1c75e8b..000000000000 --- a/etc/systemd/system-generators/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -systemdgenerator_PROGRAMS = \ - zfs-mount-generator - -zfs_mount_generator_SOURCES = \ - zfs-mount-generator.c - -zfs_mount_generator_LDADD = \ - $(abs_top_builddir)/libzfs.la - -zfs_mount_generator_LDFLAGS = -pthread - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zfs-mount-generator diff --git a/etc/systemd/system/.gitignore b/etc/systemd/system/.gitignore index 4813c65a25a8..95d33fdd436d 100644 --- a/etc/systemd/system/.gitignore +++ b/etc/systemd/system/.gitignore @@ -1,4 +1,3 @@ *.service *.target -*.preset *.timer diff --git a/etc/systemd/system/50-zfs.preset.in b/etc/systemd/system/50-zfs.preset similarity index 100% rename from etc/systemd/system/50-zfs.preset.in rename to etc/systemd/system/50-zfs.preset diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am deleted file mode 100644 index b5fcddbf594f..000000000000 --- a/etc/systemd/system/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am - -systemdpreset_DATA = \ - 50-zfs.preset - -systemdunit_DATA = \ - zfs-zed.service \ - zfs-import-cache.service \ - zfs-import-scan.service \ - zfs-mount.service \ - zfs-share.service \ - zfs-volume-wait.service \ - zfs-import.target \ - zfs-volumes.target \ - zfs.target \ - zfs-scrub-monthly@.timer \ - zfs-scrub-weekly@.timer \ - zfs-scrub@.service - -SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA) - -install-data-hook: - $(MKDIR_P) "$(DESTDIR)$(systemdunitdir)" - ln -sf /dev/null "$(DESTDIR)$(systemdunitdir)/zfs-import.service" diff --git a/etc/zfs/Makefile.am b/etc/zfs/Makefile.am deleted file mode 100644 index f62c687c6727..000000000000 --- a/etc/zfs/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -pkgsysconfdir = $(sysconfdir)/zfs - -dist_pkgsysconf_DATA = \ - vdev_id.conf.alias.example \ - vdev_id.conf.sas_direct.example \ - vdev_id.conf.sas_switch.example \ - vdev_id.conf.multipath.example \ - vdev_id.conf.scsi.example - -pkgsysconf_SCRIPTS = \ - zfs-functions - -SUBSTFILES += $(pkgsysconf_SCRIPTS) - -SHELLCHECK_SHELL = sh -SHELLCHECKSCRIPTS += $(pkgsysconf_SCRIPTS) diff --git a/tests/Makefile.am b/tests/Makefile.am index 73191549863e..e839957d4c98 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,3 +1,4 @@ +PHONY = include $(top_srcdir)/config/Shellcheck.am SUBDIRS = runfiles test-runner zfs-tests From 0425d58852a4b834b1813e0feb1a1ba6d5b72de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 02:46:19 +0200 Subject: [PATCH 020/119] autoconf: use include directives instead of recursing down tests (mostly) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only down to tests/zfs-tests/tests, but pull out C programs into the main Makefile ‒ this means we get correct dependency tracking for all programs (and parallelise across them) dist diff: -zfs-2.1.99/tests/zfs-tests/tests/stress/ -zfs-2.1.99/tests/zfs-tests/tests/stress/Makefile.am -zfs-2.1.99/tests/zfs-tests/tests/stress/Makefile.in Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 3 +- config/CppCheck.am | 2 +- config/Shellcheck.am | 14 +- configure.ac | 11 - tests/Makefile.am | 32 ++- tests/runfiles/Makefile.am | 9 - tests/test-runner/Makefile.am | 1 - tests/test-runner/bin/Makefile.am | 10 - tests/test-runner/include/Makefile.am | 4 - tests/zfs-tests/Makefile.am | 49 +++- tests/zfs-tests/callbacks/Makefile.am | 6 - tests/zfs-tests/cmd/Makefile.am | 234 +++++++----------- tests/zfs-tests/include/Makefile.am | 16 -- tests/zfs-tests/tests/Makefile.am | 2 +- tests/zfs-tests/tests/functional/Makefile.am | 1 - .../tests/functional/hkdf/Makefile.am | 8 - .../tests/functional/libzfs/Makefile.am | 8 - .../tests/functional/tmpfile/Makefile.am | 11 - tests/zfs-tests/tests/stress/Makefile.am | 1 - 19 files changed, 169 insertions(+), 253 deletions(-) delete mode 100644 tests/runfiles/Makefile.am delete mode 100644 tests/test-runner/Makefile.am delete mode 100644 tests/test-runner/bin/Makefile.am delete mode 100644 tests/test-runner/include/Makefile.am delete mode 100644 tests/zfs-tests/callbacks/Makefile.am delete mode 100644 tests/zfs-tests/include/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/hkdf/Makefile.am delete mode 100644 tests/zfs-tests/tests/stress/Makefile.am diff --git a/Makefile.am b/Makefile.am index e1d311c1328f..c474f905c50a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,13 +17,13 @@ include $(srcdir)/%D%/rpm/Makefile.am endif if CONFIG_USER -SUBDIRS += . tests include $(srcdir)/%D%/cmd/Makefile.am include $(srcdir)/%D%/contrib/Makefile.am include $(srcdir)/%D%/etc/Makefile.am include $(srcdir)/%D%/lib/Makefile.am include $(srcdir)/%D%/man/Makefile.am include $(srcdir)/%D%/scripts/Makefile.am +include $(srcdir)/%D%/tests/Makefile.am if BUILD_LINUX include $(srcdir)/%D%/udev/Makefile.am endif @@ -98,7 +98,6 @@ dist-hook: PHONY += codecheck $(CHECKS) codecheck: $(CHECKS) -SHELLCHECKDIRS = tests SHELLCHECKSCRIPTS += autogen.sh PHONY += checkstyle diff --git a/config/CppCheck.am b/config/CppCheck.am index d0f1d6f1920f..0c2502f3ddde 100644 --- a/config/CppCheck.am +++ b/config/CppCheck.am @@ -11,7 +11,7 @@ CPPCHECKDIRS = CPPCHECKTARGETS = cppcheck-recursive-%: - $(MAKE) -C $(subst ^,/,$(subst cppcheck-recursive-,,$@)) cppcheck + $(MAKE) -C $(subst cppcheck-recursive-,,$@) cppcheck _CTGT = $(subst cppcheck-for-,,$@) cppcheck-for-%: diff --git a/config/Shellcheck.am b/config/Shellcheck.am index 9002b76dee3a..878919575321 100644 --- a/config/Shellcheck.am +++ b/config/Shellcheck.am @@ -12,10 +12,7 @@ JUST_SHELLCHECK_OPTS = $(addprefix shellcheck-here-,$(subst /,^,$(1))) JUST_CHECKBASHISMS_OPTS = $(addprefix checkbashisms-here-,$(subst /,^,$(1))) SHELLCHECK_OPTS = $(call JUST_SHELLCHECK_OPTS,$(1)) $(call JUST_CHECKBASHISMS_OPTS,$(1)) -PHONY += shellcheck shellcheck-recursive - -shellcheck-recursive: - @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done +PHONY += shellcheck _STGT = $(subst ^,/,$(subst shellcheck-here-,,$@)) shellcheck-here-%: @@ -25,13 +22,10 @@ else @echo "skipping shellcheck of" $(_STGT) "because shellcheck is not installed" endif -shellcheck: $(SHELLCHECKSCRIPTS) $(call JUST_SHELLCHECK_OPTS,$(SHELLCHECKSCRIPTS)) shellcheck-recursive - +shellcheck: $(SHELLCHECKSCRIPTS) $(call JUST_SHELLCHECK_OPTS,$(SHELLCHECKSCRIPTS)) -PHONY += checkbashisms checkbashisms-recursive -checkbashisms-recursive: - @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done +PHONY += checkbashisms # command -v *is* specified by POSIX and every shell in existence supports it _BTGT = $(subst ^,/,$(subst checkbashisms-here-,,$@)) @@ -43,4 +37,4 @@ else @echo "skipping checkbashisms of" $(_BTGT) "because checkbashisms is not installed" endif -checkbashisms: $(SHELLCHECKSCRIPTS) $(call JUST_CHECKBASHISMS_OPTS,$(SHELLCHECKSCRIPTS)) checkbashisms-recursive +checkbashisms: $(SHELLCHECKSCRIPTS) $(call JUST_CHECKBASHISMS_OPTS,$(SHELLCHECKSCRIPTS)) diff --git a/configure.ac b/configure.ac index c5af86c605c7..77859f87e83b 100644 --- a/configure.ac +++ b/configure.ac @@ -78,15 +78,6 @@ AC_CONFIG_FILES([ rpm/redhat/zfs-dkms.spec rpm/redhat/zfs-kmod.spec rpm/redhat/zfs.spec - tests/Makefile - tests/runfiles/Makefile - tests/test-runner/Makefile - tests/test-runner/bin/Makefile - tests/test-runner/include/Makefile - tests/zfs-tests/Makefile - tests/zfs-tests/callbacks/Makefile - tests/zfs-tests/cmd/Makefile - tests/zfs-tests/include/Makefile tests/zfs-tests/tests/Makefile tests/zfs-tests/tests/functional/Makefile tests/zfs-tests/tests/functional/acl/Makefile @@ -196,7 +187,6 @@ AC_CONFIG_FILES([ tests/zfs-tests/tests/functional/features/large_dnode/Makefile tests/zfs-tests/tests/functional/grow/Makefile tests/zfs-tests/tests/functional/history/Makefile - tests/zfs-tests/tests/functional/hkdf/Makefile tests/zfs-tests/tests/functional/inheritance/Makefile tests/zfs-tests/tests/functional/inuse/Makefile tests/zfs-tests/tests/functional/io/Makefile @@ -264,7 +254,6 @@ AC_CONFIG_FILES([ tests/zfs-tests/tests/perf/fio/Makefile tests/zfs-tests/tests/perf/regression/Makefile tests/zfs-tests/tests/perf/scripts/Makefile - tests/zfs-tests/tests/stress/Makefile zfs.release ]) diff --git a/tests/Makefile.am b/tests/Makefile.am index e839957d4c98..d6ca957eccc8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,8 +1,30 @@ -PHONY = -include $(top_srcdir)/config/Shellcheck.am +include $(srcdir)/%D%/zfs-tests/Makefile.am -SUBDIRS = runfiles test-runner zfs-tests -EXTRA_DIST = README.md +scripts_test_runner_bindir = $(datadir)/$(PACKAGE)/test-runner/bin +scripts_test_runner_bin_SCRIPTS = \ + %D%/test-runner/bin/test-runner.py \ + %D%/test-runner/bin/zts-report.py -SHELLCHECKSCRIPTS += $(shell find $(srcdir) -name '*.sh') +SUBSTFILES += $(scripts_test_runner_bin_SCRIPTS) + + +scripts_test_runner_includedir = $(datadir)/$(PACKAGE)/test-runner/include +dist_scripts_test_runner_include_DATA = \ + %D%/test-runner/include/logapi.shlib + + +scripts_runfilesdir = $(datadir)/$(PACKAGE)/runfiles +dist_scripts_runfiles_DATA = \ + %D%/runfiles/common.run \ + %D%/runfiles/freebsd.run \ + %D%/runfiles/linux.run \ + %D%/runfiles/longevity.run \ + %D%/runfiles/perf-regression.run \ + %D%/runfiles/sanity.run \ + %D%/runfiles/sunos.run + + +EXTRA_DIST += $(addprefix %D%/,README.md) + +SHELLCHECKSCRIPTS += $(shell find $(srcdir)/%D% -name '*.sh') diff --git a/tests/runfiles/Makefile.am b/tests/runfiles/Makefile.am deleted file mode 100644 index 278e94934fe1..000000000000 --- a/tests/runfiles/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/runfiles -dist_pkgdata_DATA = \ - common.run \ - freebsd.run \ - linux.run \ - longevity.run \ - perf-regression.run \ - sanity.run \ - sunos.run diff --git a/tests/test-runner/Makefile.am b/tests/test-runner/Makefile.am deleted file mode 100644 index 4d4b639dbeac..000000000000 --- a/tests/test-runner/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = bin include diff --git a/tests/test-runner/bin/Makefile.am b/tests/test-runner/bin/Makefile.am deleted file mode 100644 index 74b98fa69fc3..000000000000 --- a/tests/test-runner/bin/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am - -pkgdatadir = $(datadir)/@PACKAGE@/test-runner/bin -pkgdata_SCRIPTS = \ - test-runner.py \ - zts-report.py - -SUBSTFILES += $(pkgdata_SCRIPTS) diff --git a/tests/test-runner/include/Makefile.am b/tests/test-runner/include/Makefile.am deleted file mode 100644 index 62817ded8a34..000000000000 --- a/tests/test-runner/include/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/test-runner/include - -dist_pkgdata_DATA = \ - logapi.shlib diff --git a/tests/zfs-tests/Makefile.am b/tests/zfs-tests/Makefile.am index ef4e6be9e980..f8166352489e 100644 --- a/tests/zfs-tests/Makefile.am +++ b/tests/zfs-tests/Makefile.am @@ -1 +1,48 @@ -SUBDIRS = cmd include tests callbacks +SUBDIRS += %D%/tests + +include $(srcdir)/%D%/cmd/Makefile.am + + +scripts_zfs_tests_functional_libzfsdir = $(datadir)/$(PACKAGE)/zfs-tests/tests/functional/libzfs +scripts_zfs_tests_functional_libzfs_PROGRAMS = %D%/tests/functional/libzfs/many_fds +%C%_tests_functional_libzfs_many_fds_LDADD = \ + libzfs.la + +scripts_zfs_tests_functional_hkdfdir = $(datadir)/$(PACKAGE)/zfs-tests/tests/functional/hkdf +scripts_zfs_tests_functional_hkdf_PROGRAMS = %D%/tests/functional/hkdf/hkdf_test +%C%_tests_functional_hkdf_hkdf_test_LDADD = \ + libzpool.la + +if BUILD_LINUX +scripts_zfs_tests_functional_tmpfiledir = $(datadir)/$(PACKAGE)/zfs-tests/tests/functional/tmpfile +scripts_zfs_tests_functional_tmpfile_PROGRAMS = \ + %D%/tests/functional/tmpfile/tmpfile_001_pos \ + %D%/tests/functional/tmpfile/tmpfile_002_pos \ + %D%/tests/functional/tmpfile/tmpfile_003_pos \ + %D%/tests/functional/tmpfile/tmpfile_stat_mode \ + %D%/tests/functional/tmpfile/tmpfile_test +endif + + +scripts_zfs_tests_callbacksdir = $(datadir)/$(PACKAGE)/zfs-tests/callbacks +dist_scripts_zfs_tests_callbacks_SCRIPTS = \ + %D%/callbacks/zfs_dbgmsg.ksh \ + %D%/callbacks/zfs_dmesg.ksh \ + %D%/callbacks/zfs_failsafe.ksh \ + %D%/callbacks/zfs_mmp.ksh + + +scripts_zfs_tests_includedir = $(datadir)/$(PACKAGE)/zfs-tests/include +dist_scripts_zfs_tests_include_DATA = \ + %D%/include/blkdev.shlib \ + %D%/include/commands.cfg \ + %D%/include/libtest.shlib \ + %D%/include/math.shlib \ + %D%/include/properties.shlib \ + %D%/include/tunables.cfg \ + %D%/include/zpool_script.shlib + +nodist_scripts_zfs_tests_include_DATA = \ + %D%/include/default.cfg + +SUBSTFILES += $(nodist_scripts_zfs_tests_include_DATA) diff --git a/tests/zfs-tests/callbacks/Makefile.am b/tests/zfs-tests/callbacks/Makefile.am deleted file mode 100644 index 512a737bb5c9..000000000000 --- a/tests/zfs-tests/callbacks/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/callbacks -dist_pkgdata_SCRIPTS = \ - zfs_failsafe.ksh \ - zfs_dbgmsg.ksh \ - zfs_dmesg.ksh \ - zfs_mmp.ksh diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am index 266d2cdb9c08..b5609b523d05 100644 --- a/tests/zfs-tests/cmd/Makefile.am +++ b/tests/zfs-tests/cmd/Makefile.am @@ -1,187 +1,127 @@ -include $(top_srcdir)/config/Rules.am +scripts_zfs_tests_bindir = $(datadir)/$(PACKAGE)/zfs-tests/bin -pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin +scripts_zfs_tests_bin_PROGRAMS = %D%/chg_usr_exec +scripts_zfs_tests_bin_PROGRAMS += %D%/cp_files +scripts_zfs_tests_bin_PROGRAMS += %D%/ctime +scripts_zfs_tests_bin_PROGRAMS += %D%/dir_rd_update +scripts_zfs_tests_bin_PROGRAMS += %D%/dosmode_readonly_write +scripts_zfs_tests_bin_PROGRAMS += %D%/get_diff +scripts_zfs_tests_bin_PROGRAMS += %D%/rename_dir +scripts_zfs_tests_bin_PROGRAMS += %D%/suid_write_to_file +scripts_zfs_tests_bin_PROGRAMS += %D%/truncate_test +scripts_zfs_tests_bin_PROGRAMS += %D%/zfs_diff-socket -pkgexec_PROGRAMS = badsend -badsend_SOURCES = badsend.c -badsend_LDADD = \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libnvpair.la +scripts_zfs_tests_bin_PROGRAMS += %D%/badsend +%C%_badsend_LDADD = \ + libzfs_core.la \ + libzfs.la \ + libnvpair.la -pkgexec_PROGRAMS += btree_test -btree_test_SOURCES = btree_test.c -btree_test_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -btree_test_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la - -pkgexec_PROGRAMS += chg_usr_exec -chg_usr_exec_SOURCES = chg_usr_exec.c +scripts_zfs_tests_bin_PROGRAMS += %D%/btree_test +%C%_btree_test_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) +%C%_btree_test_LDADD = \ + libzpool.la \ + libzfs_core.la if WANT_DEVNAME2DEVID -pkgexec_PROGRAMS += devname2devid -devname2devid_SOURCES = devname2devid.c -devname2devid_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) -devname2devid_LDADD = $(LIBUDEV_LIBS) +scripts_zfs_tests_bin_PROGRAMS += %D%/devname2devid +%C%_devname2devid_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) +%C%_devname2devid_LDADD = $(LIBUDEV_LIBS) endif -pkgexec_PROGRAMS += dir_rd_update -dir_rd_update_SOURCES = dir_rd_update.c - - -pkgexec_PROGRAMS += draid -draid_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) -draid_SOURCES = draid.c -draid_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libnvpair.la -draid_LDADD += $(ZLIB_LIBS) - - -EXTRA_DIST = file/file_common.h -pkgexec_PROGRAMS += file_check file_trunc file_write largest_file randwritecomp -file_check_SOURCES = file/file_check.c -file_trunc_SOURCES = file/file_trunc.c -file_write_SOURCES = file/file_write.c -largest_file_SOURCES = file/largest_file.c -randwritecomp_SOURCES = file/randwritecomp.c +scripts_zfs_tests_bin_PROGRAMS += %D%/draid +%C%_draid_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) +%C%_draid_LDADD = \ + libzpool.la \ + libnvpair.la +%C%_draid_LDADD += $(ZLIB_LIBS) -pkgexec_PROGRAMS += get_diff -get_diff_SOURCES = get_diff.c +EXTRA_DIST += $(addprefix %D%/,file/file_common.h) +scripts_zfs_tests_bin_PROGRAMS += %D%/file_check %D%/file_trunc %D%/file_write %D%/largest_file %D%/randwritecomp +%C%_file_check_SOURCES = %D%/file/file_check.c +%C%_file_trunc_SOURCES = %D%/file/file_trunc.c +%C%_file_write_SOURCES = %D%/file/file_write.c +%C%_largest_file_SOURCES = %D%/file/largest_file.c +%C%_randwritecomp_SOURCES = %D%/file/randwritecomp.c -pkgexec_PROGRAMS += libzfs_input_check -libzfs_input_check_SOURCES = libzfs_input_check.c -if BUILD_FREEBSD -libzfs_input_check_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/include/os/freebsd/zfs -endif -if BUILD_LINUX -libzfs_input_check_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/include/os/linux/zfs -endif -libzfs_input_check_LDADD = \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - +scripts_zfs_tests_bin_PROGRAMS += %D%/libzfs_input_check +%C%_libzfs_input_check_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/include/os/@ac_system_l@/zfs +%C%_libzfs_input_check_LDADD = \ + libzfs_core.la \ + libnvpair.la -pkgexec_PROGRAMS += mkbusy mkfile mkfiles mktree -mkbusy_SOURCES = mkbusy.c -mkfile_SOURCES = mkfile.c -mkfile_LDADD = $(LTLIBINTL) -mkfiles_SOURCES = mkfiles.c -mktree_SOURCES = mktree.c +scripts_zfs_tests_bin_PROGRAMS += %D%/mkbusy %D%/mkfile %D%/mkfiles %D%/mktree +%C%_mkfile_LDADD = $(LTLIBINTL) -pkgexec_PROGRAMS += mmap_exec mmap_seek mmap_sync mmapwrite readmmap -mmap_exec_SOURCES = mmap_exec.c -mmap_seek_SOURCES = mmap_seek.c -mmap_sync_SOURCES = mmap_sync.c -mmapwrite_SOURCES = mmapwrite.c -mmapwrite_LDADD = -lpthread -readmmap_SOURCES = readmmap.c +scripts_zfs_tests_bin_PROGRAMS += %D%/mmap_exec %D%/mmap_seek %D%/mmap_sync %D%/mmapwrite %D%/readmmap +%C%_mmapwrite_LDADD = -lpthread if WANT_MMAP_LIBAIO -pkgexec_PROGRAMS += mmap_libaio -mmap_libaio_SOURCES = mmap_libaio.c -mmap_libaio_CFLAGS = $(AM_CFLAGS) $(LIBAIO_CFLAGS) -mmap_libaio_LDADD = $(LIBAIO_LIBS) +scripts_zfs_tests_bin_PROGRAMS += %D%/mmap_libaio +%C%_mmap_libaio_CFLAGS = $(AM_CFLAGS) $(LIBAIO_CFLAGS) +%C%_mmap_libaio_LDADD = $(LIBAIO_LIBS) endif -pkgexec_PROGRAMS += nvlist_to_lua -nvlist_to_lua_SOURCES = nvlist_to_lua.c -nvlist_to_lua_LDADD = \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la +scripts_zfs_tests_bin_PROGRAMS += %D%/nvlist_to_lua +%C%_nvlist_to_lua_LDADD = \ + libzfs_core.la \ + libnvpair.la +scripts_zfs_tests_bin_PROGRAMS += %D%/rm_lnkcnt_zero_file +%C%_rm_lnkcnt_zero_file_LDADD = -lpthread -pkgexec_PROGRAMS += rename_dir -rename_dir_SOURCES = rename_dir.c +scripts_zfs_tests_bin_PROGRAMS += %D%/send_doall +%C%_send_doall_LDADD = \ + libzfs_core.la \ + libzfs.la \ + libnvpair.la -pkgexec_PROGRAMS += rm_lnkcnt_zero_file -rm_lnkcnt_zero_file_SOURCES = rm_lnkcnt_zero_file.c -rm_lnkcnt_zero_file_LDADD = -lpthread +scripts_zfs_tests_bin_PROGRAMS += %D%/stride_dd +%C%_stride_dd_LDADD = -lrt -pkgexec_PROGRAMS += send_doall -send_doall_SOURCES = send_doall.c -send_doall_LDADD = \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libnvpair.la +scripts_zfs_tests_bin_PROGRAMS += %D%/threadsappend +%C%_threadsappend_LDADD = -lpthread -pkgexec_PROGRAMS += stride_dd -stride_dd_SOURCES = stride_dd.c -stride_dd_LDADD = -lrt +scripts_zfs_tests_bin_PROGRAMS += %D%/ereports +%C%_ereports_LDADD = \ + libnvpair.la \ + libzfs.la -pkgexec_PROGRAMS += threadsappend -threadsappend_SOURCES = threadsappend.c -threadsappend_LDADD = -lpthread -pkgexec_PROGRAMS += suid_write_to_file -suid_write_to_file_SOURCES = suid_write_to_file.c - -pkgexec_PROGRAMS += cp_files -cp_files_SOURCES = cp_files.c - -pkgexec_PROGRAMS += ctime -ctime_SOURCES = ctime.c - -pkgexec_PROGRAMS += truncate_test -truncate_test_SOURCES = truncate_test.c - -pkgexec_PROGRAMS += ereports -ereports_SOURCES = ereports.c -ereports_LDADD = \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libzfs.la - -pkgexec_PROGRAMS += zfs_diff-socket -zfs_diff_socket_SOURCES = zfs_diff-socket.c - -pkgexec_PROGRAMS += dosmode_readonly_write -dosmode_readonly_write_SOURCES = dosmode_readonly_write.c - - -pkgexec_PROGRAMS += edonr_test skein_test sha2_test -skein_test_SOURCES = checksum/skein_test.c -sha2_test_SOURCES = checksum/sha2_test.c -edonr_test_SOURCES = checksum/edonr_test.c -skein_test_LDADD = \ - $(abs_top_builddir)/libicp.la \ - $(abs_top_builddir)/libspl_assert.la -sha2_test_LDADD = \ - $(abs_top_builddir)/libicp.la \ - $(abs_top_builddir)/libspl_assert.la -edonr_test_LDADD = \ - $(abs_top_builddir)/libicp.la \ - $(abs_top_builddir)/libspl_assert.la +scripts_zfs_tests_bin_PROGRAMS += %D%/edonr_test %D%/skein_test %D%/sha2_test +%C%_skein_test_SOURCES = %D%/checksum/skein_test.c +%C%_sha2_test_SOURCES = %D%/checksum/sha2_test.c +%C%_edonr_test_SOURCES = %D%/checksum/edonr_test.c +%C%_skein_test_LDADD = \ + libicp.la \ + libspl_assert.la +%C%_sha2_test_LDADD = $(%C%_skein_test_LDADD) +%C%_edonr_test_LDADD = $(%C%_skein_test_LDADD) if BUILD_LINUX -pkgexec_PROGRAMS += getversion -getversion_SOURCES = getversion.c - -EXTRA_DIST += linux_dos_attributes/dos_attributes.h -pkgexec_PROGRAMS += read_dos_attributes write_dos_attributes -read_dos_attributes_SOURCES = linux_dos_attributes/read_dos_attributes.c -write_dos_attributes_SOURCES = linux_dos_attributes/write_dos_attributes.c +scripts_zfs_tests_bin_PROGRAMS += %D%/getversion +scripts_zfs_tests_bin_PROGRAMS += %D%/user_ns_exec +scripts_zfs_tests_bin_PROGRAMS += %D%/xattrtest +scripts_zfs_tests_bin_PROGRAMS += %D%/zed_fd_spill-zedlet -pkgexec_PROGRAMS += randfree_file -randfree_file_SOURCES = file/randfree_file.c -pkgexec_PROGRAMS += user_ns_exec -user_ns_exec_SOURCES = user_ns_exec.c +EXTRA_DIST += $(addprefix %D%/,linux_dos_attributes/dos_attributes.h) +scripts_zfs_tests_bin_PROGRAMS += %D%/read_dos_attributes %D%/write_dos_attributes +%C%_read_dos_attributes_SOURCES = %D%/linux_dos_attributes/read_dos_attributes.c +%C%_write_dos_attributes_SOURCES = %D%/linux_dos_attributes/write_dos_attributes.c -pkgexec_PROGRAMS += xattrtest -xattrtest_SOURCES = xattrtest.c -pkgexec_PROGRAMS += zed_fd_spill-zedlet -zed_fd_spill_zedlet_SOURCES = zed_fd_spill-zedlet.c +scripts_zfs_tests_bin_PROGRAMS += %D%/randfree_file +%C%_randfree_file_SOURCES = %D%/file/randfree_file.c endif diff --git a/tests/zfs-tests/include/Makefile.am b/tests/zfs-tests/include/Makefile.am deleted file mode 100644 index b6f723267240..000000000000 --- a/tests/zfs-tests/include/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/include -dist_pkgdata_DATA = \ - blkdev.shlib \ - commands.cfg \ - libtest.shlib \ - math.shlib \ - properties.shlib \ - tunables.cfg \ - zpool_script.shlib - -nodist_pkgdata_DATA = default.cfg -SUBSTFILES += $(nodist_pkgdata_DATA) diff --git a/tests/zfs-tests/tests/Makefile.am b/tests/zfs-tests/tests/Makefile.am index f7494791524e..c35143187726 100644 --- a/tests/zfs-tests/tests/Makefile.am +++ b/tests/zfs-tests/tests/Makefile.am @@ -1 +1 @@ -SUBDIRS = functional perf stress +SUBDIRS = functional perf diff --git a/tests/zfs-tests/tests/functional/Makefile.am b/tests/zfs-tests/tests/functional/Makefile.am index 9164650e3419..785958816657 100644 --- a/tests/zfs-tests/tests/functional/Makefile.am +++ b/tests/zfs-tests/tests/functional/Makefile.am @@ -29,7 +29,6 @@ SUBDIRS = \ features \ grow \ history \ - hkdf \ inheritance \ inuse \ io \ diff --git a/tests/zfs-tests/tests/functional/hkdf/Makefile.am b/tests/zfs-tests/tests/functional/hkdf/Makefile.am deleted file mode 100644 index bb8a41f6c0c1..000000000000 --- a/tests/zfs-tests/tests/functional/hkdf/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf - -pkgexec_PROGRAMS = hkdf_test -hkdf_test_SOURCES = hkdf_test.c -hkdf_test_LDADD = \ - $(abs_top_builddir)/libzpool.la diff --git a/tests/zfs-tests/tests/functional/libzfs/Makefile.am b/tests/zfs-tests/tests/functional/libzfs/Makefile.am index f9cce0c6b280..fb1374255a6a 100644 --- a/tests/zfs-tests/tests/functional/libzfs/Makefile.am +++ b/tests/zfs-tests/tests/functional/libzfs/Makefile.am @@ -1,14 +1,6 @@ -include $(top_srcdir)/config/Rules.am - pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/libzfs -pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/libzfs dist_pkgdata_SCRIPTS = \ cleanup.ksh \ setup.ksh \ libzfs_input.ksh - -pkgexec_PROGRAMS = many_fds -many_fds_SOURCES = many_fds.c -many_fds_LDADD = \ - $(abs_top_builddir)/libzfs.la diff --git a/tests/zfs-tests/tests/functional/tmpfile/Makefile.am b/tests/zfs-tests/tests/functional/tmpfile/Makefile.am index 35a1f44c1693..65b0d64bc53f 100644 --- a/tests/zfs-tests/tests/functional/tmpfile/Makefile.am +++ b/tests/zfs-tests/tests/functional/tmpfile/Makefile.am @@ -1,16 +1,5 @@ -include $(top_srcdir)/config/Rules.am - pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/tmpfile dist_pkgdata_SCRIPTS = \ cleanup.ksh \ setup.ksh - -pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/tmpfile - -pkgexec_PROGRAMS = tmpfile_test tmpfile_001_pos tmpfile_002_pos \ - tmpfile_003_pos tmpfile_stat_mode -tmpfile_test_SOURCES= tmpfile_test.c -tmpfile_001_pos_SOURCES = tmpfile_001_pos.c -tmpfile_002_pos_SOURCES = tmpfile_002_pos.c -tmpfile_003_pos_SOURCES = tmpfile_003_pos.c diff --git a/tests/zfs-tests/tests/stress/Makefile.am b/tests/zfs-tests/tests/stress/Makefile.am deleted file mode 100644 index 741f85085609..000000000000 --- a/tests/zfs-tests/tests/stress/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = From ea04cc4a22a865199ab6ef1c4215117d5b1bae64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 18:24:48 +0200 Subject: [PATCH 021/119] autoconf: use include directives instead of recursing down test data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We drop /multiple/ seconds off the generation, a dozen off a clean rebuild, 185 files, and trivialise the distribution, which can now be trivially generated via the provided snippets Dist diff: -zfs-2.1.99/tests/zfs-tests/tests/functional/pam/utilities.kshlib +zfs-2.1.99/tests/zfs-tests/tests/functional/pam/utilities.kshlib.in Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- config/Substfiles.am | 18 +- configure.ac | 177 +- tests/zfs-tests/tests/Makefile.am | 1953 ++++++++++++++++- tests/zfs-tests/tests/functional/Makefile.am | 94 - .../tests/functional/acl/Makefile.am | 6 - .../tests/functional/acl/off/Makefile.am | 7 - .../tests/functional/acl/posix-sa/Makefile.am | 8 - .../tests/functional/acl/posix/Makefile.am | 8 - .../tests/functional/alloc_class/Makefile.am | 21 - .../tests/functional/arc/Makefile.am | 8 - .../tests/functional/atime/Makefile.am | 14 - .../tests/functional/bootfs/Makefile.am | 12 - .../tests/functional/btree/Makefile.am | 20 - .../tests/functional/cache/Makefile.am | 20 - .../tests/functional/cachefile/Makefile.am | 12 - .../tests/functional/casenorm/Makefile.am | 25 - .../functional/channel_program/Makefile.am | 6 - .../channel_program/lua_core/Makefile.am | 46 - .../channel_program/synctask_core/Makefile.am | 53 - .../tests/functional/chattr/Makefile.am | 6 - .../tests/functional/checksum/Makefile.am | 13 - .../tests/functional/clean_mirror/Makefile.am | 12 - .../tests/functional/cli_root/Makefile.am | 67 - .../tests/functional/cli_root/zdb/Makefile.am | 20 - .../tests/functional/cli_root/zfs/Makefile.am | 7 - .../cli_root/zfs_bookmark/Makefile.am | 5 - .../cli_root/zfs_change-key/Makefile.am | 12 - .../functional/cli_root/zfs_clone/Makefile.am | 17 - .../cli_root/zfs_copies/Makefile.am | 14 - .../cli_root/zfs_create/Makefile.am | 28 - .../cli_root/zfs_destroy/Makefile.am | 30 - .../functional/cli_root/zfs_diff/Makefile.am | 11 - .../functional/cli_root/zfs_get/Makefile.am | 18 - .../cli_root/zfs_ids_to_path/Makefile.am | 5 - .../cli_root/zfs_inherit/Makefile.am | 8 - .../functional/cli_root/zfs_jail/Makefile.am | 6 - .../cli_root/zfs_load-key/Makefile.am | 18 - .../functional/cli_root/zfs_mount/Makefile.am | 29 - .../cli_root/zfs_program/Makefile.am | 5 - .../cli_root/zfs_promote/Makefile.am | 16 - .../cli_root/zfs_property/Makefile.am | 5 - .../cli_root/zfs_receive/Makefile.am | 34 - .../cli_root/zfs_rename/Makefile.am | 26 - .../cli_root/zfs_reservation/Makefile.am | 6 - .../cli_root/zfs_rollback/Makefile.am | 12 - .../functional/cli_root/zfs_send/Makefile.am | 20 - .../functional/cli_root/zfs_set/Makefile.am | 35 - .../functional/cli_root/zfs_share/Makefile.am | 21 - .../cli_root/zfs_snapshot/Makefile.am | 16 - .../functional/cli_root/zfs_sysfs/Makefile.am | 10 - .../cli_root/zfs_unload-key/Makefile.am | 7 - .../cli_root/zfs_unmount/Makefile.am | 20 - .../cli_root/zfs_unshare/Makefile.am | 11 - .../cli_root/zfs_upgrade/Makefile.am | 14 - .../functional/cli_root/zfs_wait/Makefile.am | 9 - .../functional/cli_root/zhack/Makefile.am | 3 - .../functional/cli_root/zpool/Makefile.am | 8 - .../functional/cli_root/zpool_add/Makefile.am | 22 - .../cli_root/zpool_attach/Makefile.am | 6 - .../cli_root/zpool_clear/Makefile.am | 11 - .../cli_root/zpool_create/Makefile.am | 50 - .../cli_root/zpool_destroy/Makefile.am | 8 - .../cli_root/zpool_detach/Makefile.am | 5 - .../cli_root/zpool_events/Makefile.am | 16 - .../cli_root/zpool_expand/Makefile.am | 12 - .../cli_root/zpool_export/Makefile.am | 12 - .../functional/cli_root/zpool_get/Makefile.am | 12 - .../cli_root/zpool_history/Makefile.am | 6 - .../cli_root/zpool_import/Makefile.am | 51 - .../zpool_import/blockfiles/Makefile.am | 5 - .../cli_root/zpool_initialize/Makefile.am | 18 - .../cli_root/zpool_labelclear/Makefile.am | 9 - .../cli_root/zpool_offline/Makefile.am | 7 - .../cli_root/zpool_online/Makefile.am | 6 - .../cli_root/zpool_remove/Makefile.am | 10 - .../cli_root/zpool_reopen/Makefile.am | 15 - .../cli_root/zpool_replace/Makefile.am | 7 - .../cli_root/zpool_resilver/Makefile.am | 9 - .../cli_root/zpool_scrub/Makefile.am | 16 - .../functional/cli_root/zpool_set/Makefile.am | 9 - .../cli_root/zpool_split/Makefile.am | 19 - .../cli_root/zpool_status/Makefile.am | 9 - .../cli_root/zpool_sync/Makefile.am | 6 - .../cli_root/zpool_trim/Makefile.am | 25 - .../cli_root/zpool_upgrade/Makefile.am | 20 - .../zpool_upgrade/blockfiles/Makefile.am | 54 - .../cli_root/zpool_wait/Makefile.am | 22 - .../cli_root/zpool_wait/scan/Makefile.am | 11 - .../tests/functional/cli_user/Makefile.am | 6 - .../functional/cli_user/misc/Makefile.am | 52 - .../functional/cli_user/zfs_list/Makefile.am | 15 - .../cli_user/zpool_iostat/Makefile.am | 12 - .../cli_user/zpool_list/Makefile.am | 6 - .../cli_user/zpool_status/Makefile.am | 8 - .../tests/functional/compression/Makefile.am | 17 - .../tests/functional/cp_files/Makefile.am | 6 - .../tests/functional/crtime/Makefile.am | 5 - .../tests/functional/ctime/Makefile.am | 6 - .../tests/functional/deadman/Makefile.am | 8 - .../tests/functional/delegate/Makefile.am | 28 - .../tests/functional/devices/Makefile.am | 11 - .../functional/dos_attributes/Makefile.am | 8 - .../tests/functional/events/Makefile.am | 12 - .../tests/functional/exec/Makefile.am | 9 - .../tests/functional/fallocate/Makefile.am | 7 - .../tests/functional/fault/Makefile.am | 20 - .../tests/functional/features/Makefile.am | 3 - .../features/async_destroy/Makefile.am | 5 - .../features/large_dnode/Makefile.am | 13 - .../tests/functional/grow/Makefile.am | 7 - .../tests/functional/history/Makefile.am | 23 - .../tests/functional/inheritance/Makefile.am | 57 - .../tests/functional/inuse/Makefile.am | 14 - .../zfs-tests/tests/functional/io/Makefile.am | 13 - .../tests/functional/l2arc/Makefile.am | 15 - .../tests/functional/large_files/Makefile.am | 6 - .../tests/functional/largest_pool/Makefile.am | 6 - .../tests/functional/libzfs/Makefile.am | 6 - .../tests/functional/limits/Makefile.am | 9 - .../tests/functional/link_count/Makefile.am | 6 - .../tests/functional/log_spacemap/Makefile.am | 2 - .../tests/functional/migration/Makefile.am | 20 - .../tests/functional/mmap/Makefile.am | 12 - .../tests/functional/mmp/Makefile.am | 21 - .../tests/functional/mount/Makefile.am | 7 - .../tests/functional/mv_files/Makefile.am | 11 - .../tests/functional/nestedfs/Makefile.am | 5 - .../tests/functional/no_space/Makefile.am | 12 - .../tests/functional/nopwrite/Makefile.am | 15 - .../functional/online_offline/Makefile.am | 10 - .../tests/functional/pam/Makefile.am | 11 - .../functional/pool_checkpoint/Makefile.am | 26 - .../tests/functional/pool_names/Makefile.am | 4 - .../tests/functional/poolversion/Makefile.am | 6 - .../tests/functional/privilege/Makefile.am | 6 - .../tests/functional/procfs/Makefile.am | 8 - .../tests/functional/projectquota/Makefile.am | 27 - .../tests/functional/pyzfs/Makefile.am | 9 - .../tests/functional/quota/Makefile.am | 14 - .../tests/functional/raidz/Makefile.am | 8 - .../functional/redacted_send/Makefile.am | 26 - .../tests/functional/redundancy/Makefile.am | 22 - .../tests/functional/refquota/Makefile.am | 12 - .../tests/functional/refreserv/Makefile.am | 14 - .../tests/functional/removal/Makefile.am | 38 - .../tests/functional/rename_dirs/Makefile.am | 5 - .../tests/functional/replacement/Makefile.am | 21 - .../tests/functional/reservation/Makefile.am | 30 - .../tests/functional/rootpool/Makefile.am | 7 - .../tests/functional/rsend/Makefile.am | 73 - .../tests/functional/scrub_mirror/Makefile.am | 12 - .../tests/functional/simd/Makefile.am | 2 - .../tests/functional/slog/Makefile.am | 27 - .../tests/functional/snapshot/Makefile.am | 28 - .../tests/functional/snapused/Makefile.am | 12 - .../tests/functional/sparse/Makefile.am | 8 - .../tests/functional/stat/Makefile.am | 8 - .../tests/functional/suid/Makefile.am | 10 - .../functional/threadsappend/Makefile.am | 8 - .../tests/functional/tmpfile/Makefile.am | 5 - .../tests/functional/trim/Makefile.am | 12 - .../tests/functional/truncate/Makefile.am | 11 - .../tests/functional/upgrade/Makefile.am | 10 - .../functional/user_namespace/Makefile.am | 9 - .../tests/functional/userquota/Makefile.am | 29 - .../tests/functional/vdev_zaps/Makefile.am | 14 - .../tests/functional/write_dirs/Makefile.am | 6 - .../tests/functional/xattr/Makefile.am | 22 - .../functional/zpool_influxdb/Makefile.am | 5 - .../tests/functional/zvol/Makefile.am | 10 - .../functional/zvol/zvol_ENOSPC/Makefile.am | 8 - .../functional/zvol/zvol_cli/Makefile.am | 10 - .../functional/zvol/zvol_misc/Makefile.am | 19 - .../functional/zvol/zvol_swap/Makefile.am | 13 - tests/zfs-tests/tests/perf/Makefile.am | 9 - tests/zfs-tests/tests/perf/fio/Makefile.am | 10 - .../tests/perf/regression/Makefile.am | 13 - .../zfs-tests/tests/perf/scripts/Makefile.am | 2 - 178 files changed, 1963 insertions(+), 2870 deletions(-) delete mode 100644 tests/zfs-tests/tests/functional/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/acl/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/acl/off/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/acl/posix/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/alloc_class/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/arc/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/atime/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/bootfs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/btree/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cache/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cachefile/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/casenorm/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/channel_program/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/chattr/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/checksum/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/clean_mirror/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zhack/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_user/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/compression/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/cp_files/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/crtime/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/ctime/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/deadman/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/delegate/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/devices/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/dos_attributes/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/events/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/exec/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/fallocate/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/fault/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/features/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/features/async_destroy/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/grow/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/history/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/inheritance/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/inuse/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/io/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/l2arc/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/large_files/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/largest_pool/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/libzfs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/limits/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/link_count/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/log_spacemap/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/migration/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/mmap/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/mmp/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/mount/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/mv_files/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/nestedfs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/no_space/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/nopwrite/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/online_offline/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/pam/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/pool_names/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/poolversion/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/privilege/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/procfs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/projectquota/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/pyzfs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/quota/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/raidz/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/redacted_send/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/redundancy/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/refquota/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/refreserv/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/removal/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/rename_dirs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/replacement/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/reservation/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/rootpool/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/rsend/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/scrub_mirror/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/simd/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/slog/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/snapshot/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/snapused/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/sparse/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/stat/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/suid/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/threadsappend/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/tmpfile/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/trim/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/truncate/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/upgrade/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/user_namespace/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/userquota/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/vdev_zaps/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/write_dirs/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/xattr/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/zpool_influxdb/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/zvol/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am delete mode 100644 tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile.am delete mode 100644 tests/zfs-tests/tests/perf/Makefile.am delete mode 100644 tests/zfs-tests/tests/perf/fio/Makefile.am delete mode 100644 tests/zfs-tests/tests/perf/regression/Makefile.am delete mode 100644 tests/zfs-tests/tests/perf/scripts/Makefile.am diff --git a/config/Substfiles.am b/config/Substfiles.am index ce02ac9c7ef1..733073dd20ca 100644 --- a/config/Substfiles.am +++ b/config/Substfiles.am @@ -1,27 +1,29 @@ subst_sed_cmd = \ -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \ -e 's|@bindir[@]|$(bindir)|g' \ - -e 's|@sbindir[@]|$(sbindir)|g' \ -e 's|@datadir[@]|$(datadir)|g' \ - -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ - -e 's|@runstatedir[@]|$(runstatedir)|g' \ -e 's|@initconfdir[@]|$(initconfdir)|g' \ -e 's|@initdir[@]|$(initdir)|g' \ -e 's|@mounthelperdir[@]|$(mounthelperdir)|g' \ + -e 's|@pammoduledir[@]|$(pammoduledir)|g' \ + -e 's|@runstatedir[@]|$(runstatedir)|g' \ + -e 's|@sbindir[@]|$(sbindir)|g' \ + -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ -e 's|@systemdgeneratordir[@]|$(systemdgeneratordir)|g' \ -e 's|@systemdunitdir[@]|$(systemdunitdir)|g' \ -e 's|@udevdir[@]|$(udevdir)|g' \ -e 's|@udevruledir[@]|$(udevruledir)|g' \ -e 's|@zfsexecdir[@]|$(zfsexecdir)|g' \ - -e 's|@VERSION[@]|$(VERSION)|g' \ - -e 's|@PYTHON[@]|$(PYTHON)|g' \ - -e 's|@PYTHON_SHEBANG[@]|$(PYTHON_SHEBANG)|g' \ + \ + -e 's|@ASAN_ENABLED[@]|$(ASAN_ENABLED)|g' \ -e 's|@DEFAULT_INIT_NFS_SERVER[@]|$(DEFAULT_INIT_NFS_SERVER)|g' \ -e 's|@DEFAULT_INIT_SHELL[@]|$(DEFAULT_INIT_SHELL)|g' \ -e 's|@LIBFETCH_DYNAMIC[@]|$(LIBFETCH_DYNAMIC)|g' \ -e 's|@LIBFETCH_SONAME[@]|$(LIBFETCH_SONAME)|g' \ - -e 's|@ASAN_ENABLED[@]|$(ASAN_ENABLED)|g' \ - -e 's|@UBSAN_ENABLED[@]|$(UBSAN_ENABLED)|g' + -e 's|@PYTHON[@]|$(PYTHON)|g' \ + -e 's|@PYTHON_SHEBANG[@]|$(PYTHON_SHEBANG)|g' \ + -e 's|@UBSAN_ENABLED[@]|$(UBSAN_ENABLED)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' define SUBST $(1) : $(2)$(1).in Makefile; diff --git a/configure.ac b/configure.ac index 77859f87e83b..3e2ff3e8fb7c 100644 --- a/configure.ac +++ b/configure.ac @@ -68,8 +68,8 @@ AC_CONFIG_FILES([ Makefile include/Makefile lib/libzfs/libzfs.pc - lib/libzfsbootenv/libzfsbootenv.pc lib/libzfs_core/libzfs_core.pc + lib/libzfsbootenv/libzfsbootenv.pc module/Kbuild module/Makefile rpm/generic/zfs-dkms.spec @@ -79,181 +79,6 @@ AC_CONFIG_FILES([ rpm/redhat/zfs-kmod.spec rpm/redhat/zfs.spec tests/zfs-tests/tests/Makefile - tests/zfs-tests/tests/functional/Makefile - tests/zfs-tests/tests/functional/acl/Makefile - tests/zfs-tests/tests/functional/acl/off/Makefile - tests/zfs-tests/tests/functional/acl/posix/Makefile - tests/zfs-tests/tests/functional/acl/posix-sa/Makefile - tests/zfs-tests/tests/functional/alloc_class/Makefile - tests/zfs-tests/tests/functional/arc/Makefile - tests/zfs-tests/tests/functional/atime/Makefile - tests/zfs-tests/tests/functional/bootfs/Makefile - tests/zfs-tests/tests/functional/btree/Makefile - tests/zfs-tests/tests/functional/cache/Makefile - tests/zfs-tests/tests/functional/cachefile/Makefile - tests/zfs-tests/tests/functional/casenorm/Makefile - tests/zfs-tests/tests/functional/channel_program/Makefile - tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile - tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile - tests/zfs-tests/tests/functional/chattr/Makefile - tests/zfs-tests/tests/functional/checksum/Makefile - tests/zfs-tests/tests/functional/clean_mirror/Makefile - tests/zfs-tests/tests/functional/cli_root/Makefile - tests/zfs-tests/tests/functional/cli_root/zdb/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile - tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile - tests/zfs-tests/tests/functional/cli_root/zhack/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile - tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile - tests/zfs-tests/tests/functional/cli_user/Makefile - tests/zfs-tests/tests/functional/cli_user/misc/Makefile - tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile - tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile - tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile - tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile - tests/zfs-tests/tests/functional/compression/Makefile - tests/zfs-tests/tests/functional/cp_files/Makefile - tests/zfs-tests/tests/functional/crtime/Makefile - tests/zfs-tests/tests/functional/ctime/Makefile - tests/zfs-tests/tests/functional/deadman/Makefile - tests/zfs-tests/tests/functional/delegate/Makefile - tests/zfs-tests/tests/functional/devices/Makefile - tests/zfs-tests/tests/functional/dos_attributes/Makefile - tests/zfs-tests/tests/functional/events/Makefile - tests/zfs-tests/tests/functional/exec/Makefile - tests/zfs-tests/tests/functional/fallocate/Makefile - tests/zfs-tests/tests/functional/fault/Makefile - tests/zfs-tests/tests/functional/features/Makefile - tests/zfs-tests/tests/functional/features/async_destroy/Makefile - tests/zfs-tests/tests/functional/features/large_dnode/Makefile - tests/zfs-tests/tests/functional/grow/Makefile - tests/zfs-tests/tests/functional/history/Makefile - tests/zfs-tests/tests/functional/inheritance/Makefile - tests/zfs-tests/tests/functional/inuse/Makefile - tests/zfs-tests/tests/functional/io/Makefile - tests/zfs-tests/tests/functional/l2arc/Makefile - tests/zfs-tests/tests/functional/large_files/Makefile - tests/zfs-tests/tests/functional/largest_pool/Makefile - tests/zfs-tests/tests/functional/libzfs/Makefile - tests/zfs-tests/tests/functional/limits/Makefile - tests/zfs-tests/tests/functional/link_count/Makefile - tests/zfs-tests/tests/functional/log_spacemap/Makefile - tests/zfs-tests/tests/functional/migration/Makefile - tests/zfs-tests/tests/functional/mmap/Makefile - tests/zfs-tests/tests/functional/mmp/Makefile - tests/zfs-tests/tests/functional/mount/Makefile - tests/zfs-tests/tests/functional/mv_files/Makefile - tests/zfs-tests/tests/functional/nestedfs/Makefile - tests/zfs-tests/tests/functional/no_space/Makefile - tests/zfs-tests/tests/functional/nopwrite/Makefile - tests/zfs-tests/tests/functional/online_offline/Makefile - tests/zfs-tests/tests/functional/pam/Makefile - tests/zfs-tests/tests/functional/pool_checkpoint/Makefile - tests/zfs-tests/tests/functional/pool_names/Makefile - tests/zfs-tests/tests/functional/poolversion/Makefile - tests/zfs-tests/tests/functional/privilege/Makefile - tests/zfs-tests/tests/functional/procfs/Makefile - tests/zfs-tests/tests/functional/projectquota/Makefile - tests/zfs-tests/tests/functional/pyzfs/Makefile - tests/zfs-tests/tests/functional/quota/Makefile - tests/zfs-tests/tests/functional/raidz/Makefile - tests/zfs-tests/tests/functional/redacted_send/Makefile - tests/zfs-tests/tests/functional/redundancy/Makefile - tests/zfs-tests/tests/functional/refquota/Makefile - tests/zfs-tests/tests/functional/refreserv/Makefile - tests/zfs-tests/tests/functional/removal/Makefile - tests/zfs-tests/tests/functional/rename_dirs/Makefile - tests/zfs-tests/tests/functional/replacement/Makefile - tests/zfs-tests/tests/functional/reservation/Makefile - tests/zfs-tests/tests/functional/rootpool/Makefile - tests/zfs-tests/tests/functional/rsend/Makefile - tests/zfs-tests/tests/functional/scrub_mirror/Makefile - tests/zfs-tests/tests/functional/simd/Makefile - tests/zfs-tests/tests/functional/slog/Makefile - tests/zfs-tests/tests/functional/snapshot/Makefile - tests/zfs-tests/tests/functional/snapused/Makefile - tests/zfs-tests/tests/functional/sparse/Makefile - tests/zfs-tests/tests/functional/stat/Makefile - tests/zfs-tests/tests/functional/suid/Makefile - tests/zfs-tests/tests/functional/threadsappend/Makefile - tests/zfs-tests/tests/functional/tmpfile/Makefile - tests/zfs-tests/tests/functional/trim/Makefile - tests/zfs-tests/tests/functional/truncate/Makefile - tests/zfs-tests/tests/functional/upgrade/Makefile - tests/zfs-tests/tests/functional/user_namespace/Makefile - tests/zfs-tests/tests/functional/userquota/Makefile - tests/zfs-tests/tests/functional/vdev_zaps/Makefile - tests/zfs-tests/tests/functional/write_dirs/Makefile - tests/zfs-tests/tests/functional/xattr/Makefile - tests/zfs-tests/tests/functional/zpool_influxdb/Makefile - tests/zfs-tests/tests/functional/zvol/Makefile - tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile - tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile - tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile - tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile - tests/zfs-tests/tests/perf/Makefile - tests/zfs-tests/tests/perf/fio/Makefile - tests/zfs-tests/tests/perf/regression/Makefile - tests/zfs-tests/tests/perf/scripts/Makefile zfs.release ]) diff --git a/tests/zfs-tests/tests/Makefile.am b/tests/zfs-tests/tests/Makefile.am index c35143187726..355ad727dfe2 100644 --- a/tests/zfs-tests/tests/Makefile.am +++ b/tests/zfs-tests/tests/Makefile.am @@ -1 +1,1952 @@ -SUBDIRS = functional perf +CLEANFILES = +EXTRA_DIST = +include $(top_srcdir)/config/Substfiles.am + + +datadir_zfs_tests_testsdir = $(datadir)/$(PACKAGE)/zfs-tests/tests +nobase_dist_datadir_zfs_tests_tests_DATA = \ + perf/nfs-sample.cfg \ + perf/perf.shlib \ + \ + perf/fio/mkfiles.fio \ + perf/fio/random_reads.fio \ + perf/fio/random_readwrite.fio \ + perf/fio/random_readwrite_fixed.fio \ + perf/fio/random_writes.fio \ + perf/fio/sequential_reads.fio \ + perf/fio/sequential_readwrite.fio \ + perf/fio/sequential_writes.fio + +nobase_dist_datadir_zfs_tests_tests_SCRIPTS = \ + perf/regression/random_reads.ksh \ + perf/regression/random_readwrite.ksh \ + perf/regression/random_readwrite_fixed.ksh \ + perf/regression/random_writes.ksh \ + perf/regression/random_writes_zil.ksh \ + perf/regression/sequential_reads_arc_cached_clone.ksh \ + perf/regression/sequential_reads_arc_cached.ksh \ + perf/regression/sequential_reads_dbuf_cached.ksh \ + perf/regression/sequential_reads.ksh \ + perf/regression/sequential_writes.ksh \ + perf/regression/setup.ksh \ + \ + perf/scripts/prefetch_io.sh + +# These lists can be regenerated by running, on a *clean* source: +# find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' ! -executable -name '*.in' | sort | sed 's/\.in$//;s/^/\t/;$!s/$/ \\/' +# find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' -executable -name '*.in' | sort | sed 's/\.in$//;s/^/\t/;$!s/$/ \\/' +# find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' ! -name '*.in' ! -name '*.c' | grep -Fe /simd -e /tmpfile | sort | sed 's/^/\t/;$!s/$/ \\/' +# find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' ! -executable ! -name '*.in' ! -name '*.c' | grep -vFe /simd -e /tmpfile | sort | sed 's/^/\t/;$!s/$/ \\/' +# find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' -executable ! -name '*.in' ! -name '*.c' | grep -vFe /simd -e /tmpfile | sort | sed 's/^/\t/;$!s/$/ \\/' +# +# simd and tmpfile are Linux-only and not installed elsewhere +# +# C programs are specced in ../Makefile.am above as part of the main Makefile + +nobase_nodist_datadir_zfs_tests_tests_DATA = \ + functional/pam/utilities.kshlib +nobase_nodist_datadir_zfs_tests_tests_SCRIPTS = \ + functional/pyzfs/pyzfs_unittest.ksh + +SUBSTFILES += $(nobase_nodist_datadir_zfs_tests_tests_DATA) $(nobase_nodist_datadir_zfs_tests_tests_SCRIPTS) + +if BUILD_LINUX +nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \ + functional/simd/simd_supported.ksh \ + functional/tmpfile/cleanup.ksh \ + functional/tmpfile/setup.ksh +endif + +nobase_dist_datadir_zfs_tests_tests_DATA += \ + functional/acl/acl.cfg \ + functional/acl/acl_common.kshlib \ + functional/alloc_class/alloc_class.cfg \ + functional/alloc_class/alloc_class.kshlib \ + functional/atime/atime.cfg \ + functional/atime/atime_common.kshlib \ + functional/cache/cache.cfg \ + functional/cache/cache.kshlib \ + functional/cachefile/cachefile.cfg \ + functional/cachefile/cachefile.kshlib \ + functional/casenorm/casenorm.cfg \ + functional/casenorm/casenorm.kshlib \ + functional/channel_program/channel_common.kshlib \ + functional/channel_program/lua_core/tst.args_to_lua.out \ + functional/channel_program/lua_core/tst.args_to_lua.zcp \ + functional/channel_program/lua_core/tst.divide_by_zero.err \ + functional/channel_program/lua_core/tst.divide_by_zero.zcp \ + functional/channel_program/lua_core/tst.exists.zcp \ + functional/channel_program/lua_core/tst.large_prog.out \ + functional/channel_program/lua_core/tst.large_prog.zcp \ + functional/channel_program/lua_core/tst.lib_base.lua \ + functional/channel_program/lua_core/tst.lib_coroutine.lua \ + functional/channel_program/lua_core/tst.lib_strings.lua \ + functional/channel_program/lua_core/tst.lib_table.lua \ + functional/channel_program/lua_core/tst.nested_neg.zcp \ + functional/channel_program/lua_core/tst.nested_pos.zcp \ + functional/channel_program/lua_core/tst.recursive.zcp \ + functional/channel_program/lua_core/tst.return_large.zcp \ + functional/channel_program/lua_core/tst.return_recursive_table.zcp \ + functional/channel_program/lua_core/tst.stack_gsub.err \ + functional/channel_program/lua_core/tst.stack_gsub.zcp \ + functional/channel_program/lua_core/tst.timeout.zcp \ + functional/channel_program/synctask_core/tst.bookmark.copy.zcp \ + functional/channel_program/synctask_core/tst.bookmark.create.zcp \ + functional/channel_program/synctask_core/tst.get_index_props.out \ + functional/channel_program/synctask_core/tst.get_index_props.zcp \ + functional/channel_program/synctask_core/tst.get_number_props.out \ + functional/channel_program/synctask_core/tst.get_number_props.zcp \ + functional/channel_program/synctask_core/tst.get_string_props.out \ + functional/channel_program/synctask_core/tst.get_string_props.zcp \ + functional/channel_program/synctask_core/tst.promote_conflict.zcp \ + functional/channel_program/synctask_core/tst.set_props.zcp \ + functional/channel_program/synctask_core/tst.snapshot_destroy.zcp \ + functional/channel_program/synctask_core/tst.snapshot_neg.zcp \ + functional/channel_program/synctask_core/tst.snapshot_recursive.zcp \ + functional/channel_program/synctask_core/tst.snapshot_simple.zcp \ + functional/checksum/default.cfg \ + functional/clean_mirror/clean_mirror_common.kshlib \ + functional/clean_mirror/default.cfg \ + functional/cli_root/cli_common.kshlib \ + functional/cli_root/zfs_copies/zfs_copies.cfg \ + functional/cli_root/zfs_copies/zfs_copies.kshlib \ + functional/cli_root/zfs_create/properties.kshlib \ + functional/cli_root/zfs_create/zfs_create.cfg \ + functional/cli_root/zfs_create/zfs_create_common.kshlib \ + functional/cli_root/zfs_destroy/zfs_destroy.cfg \ + functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib \ + functional/cli_root/zfs_get/zfs_get_common.kshlib \ + functional/cli_root/zfs_get/zfs_get_list_d.kshlib \ + functional/cli_root/zfs_jail/jail.conf \ + functional/cli_root/zfs_load-key/HEXKEY \ + functional/cli_root/zfs_load-key/PASSPHRASE \ + functional/cli_root/zfs_load-key/RAWKEY \ + functional/cli_root/zfs_load-key/zfs_load-key.cfg \ + functional/cli_root/zfs_load-key/zfs_load-key_common.kshlib \ + functional/cli_root/zfs_mount/zfs_mount.cfg \ + functional/cli_root/zfs_mount/zfs_mount.kshlib \ + functional/cli_root/zfs_promote/zfs_promote.cfg \ + functional/cli_root/zfs_receive/zstd_test_data.txt \ + functional/cli_root/zfs_rename/zfs_rename.cfg \ + functional/cli_root/zfs_rename/zfs_rename.kshlib \ + functional/cli_root/zfs_rollback/zfs_rollback.cfg \ + functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib \ + functional/cli_root/zfs_send/zfs_send.cfg \ + functional/cli_root/zfs_set/zfs_set_common.kshlib \ + functional/cli_root/zfs_share/zfs_share.cfg \ + functional/cli_root/zfs_snapshot/zfs_snapshot.cfg \ + functional/cli_root/zfs_unmount/zfs_unmount.cfg \ + functional/cli_root/zfs_unmount/zfs_unmount.kshlib \ + functional/cli_root/zfs_upgrade/zfs_upgrade.kshlib \ + functional/cli_root/zfs_wait/zfs_wait.kshlib \ + functional/cli_root/zpool_add/zpool_add.cfg \ + functional/cli_root/zpool_add/zpool_add.kshlib \ + functional/cli_root/zpool_clear/zpool_clear.cfg \ + functional/cli_root/zpool_create/draidcfg.gz \ + functional/cli_root/zpool_create/zpool_create.cfg \ + functional/cli_root/zpool_create/zpool_create.shlib \ + functional/cli_root/zpool_destroy/zpool_destroy.cfg \ + functional/cli_root/zpool_events/zpool_events.cfg \ + functional/cli_root/zpool_events/zpool_events.kshlib \ + functional/cli_root/zpool_expand/zpool_expand.cfg \ + functional/cli_root/zpool_export/zpool_export.cfg \ + functional/cli_root/zpool_export/zpool_export.kshlib \ + functional/cli_root/zpool_get/zpool_get.cfg \ + functional/cli_root/zpool_get/zpool_get_parsable.cfg \ + functional/cli_root/zpool_import/blockfiles/cryptv0.dat.bz2 \ + functional/cli_root/zpool_import/blockfiles/missing_ivset.dat.bz2 \ + functional/cli_root/zpool_import/blockfiles/unclean_export.dat.bz2 \ + functional/cli_root/zpool_import/zpool_import.cfg \ + functional/cli_root/zpool_import/zpool_import.kshlib \ + functional/cli_root/zpool_initialize/zpool_initialize.kshlib \ + functional/cli_root/zpool_labelclear/labelclear.cfg \ + functional/cli_root/zpool_remove/zpool_remove.cfg \ + functional/cli_root/zpool_reopen/zpool_reopen.cfg \ + functional/cli_root/zpool_reopen/zpool_reopen.shlib \ + functional/cli_root/zpool_resilver/zpool_resilver.cfg \ + functional/cli_root/zpool_scrub/zpool_scrub.cfg \ + functional/cli_root/zpool_split/zpool_split.cfg \ + functional/cli_root/zpool_trim/zpool_trim.kshlib \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-broken-mirror1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-broken-mirror2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v10.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v11.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v12.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v13.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v14.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v15.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1mirror1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1mirror2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1mirror3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1raidz1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1raidz2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1raidz3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1stripe1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1stripe2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1stripe3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2mirror1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2mirror2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2mirror3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2raidz1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2raidz2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2raidz3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2stripe1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2stripe2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v2stripe3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3hotspare1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3hotspare2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3hotspare3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3mirror1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3mirror2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3mirror3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz21.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz22.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz23.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3raidz3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3stripe1.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3stripe2.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v3stripe3.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v4.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v5.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v6.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v7.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v8.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v999.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v9.dat.bz2 \ + functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-vBROKEN.dat.bz2 \ + functional/cli_root/zpool_upgrade/zpool_upgrade.cfg \ + functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib \ + functional/cli_root/zpool_wait/zpool_wait.kshlib \ + functional/cli_user/misc/misc.cfg \ + functional/cli_user/zfs_list/zfs_list.cfg \ + functional/cli_user/zfs_list/zfs_list.kshlib \ + functional/compression/compress.cfg \ + functional/compression/testpool_zstd.tar.gz \ + functional/deadman/deadman.cfg \ + functional/delegate/delegate.cfg \ + functional/delegate/delegate_common.kshlib \ + functional/devices/devices.cfg \ + functional/devices/devices_common.kshlib \ + functional/events/events.cfg \ + functional/events/events_common.kshlib \ + functional/fault/fault.cfg \ + functional/grow/grow.cfg \ + functional/history/history.cfg \ + functional/history/history_common.kshlib \ + functional/history/i386.migratedpool.DAT.Z \ + functional/history/i386.orig_history.txt \ + functional/history/sparc.migratedpool.DAT.Z \ + functional/history/sparc.orig_history.txt \ + functional/history/zfs-pool-v4.dat.Z \ + functional/inheritance/config001.cfg \ + functional/inheritance/config002.cfg \ + functional/inheritance/config003.cfg \ + functional/inheritance/config004.cfg \ + functional/inheritance/config005.cfg \ + functional/inheritance/config006.cfg \ + functional/inheritance/config007.cfg \ + functional/inheritance/config008.cfg \ + functional/inheritance/config009.cfg \ + functional/inheritance/config010.cfg \ + functional/inheritance/config011.cfg \ + functional/inheritance/config012.cfg \ + functional/inheritance/config013.cfg \ + functional/inheritance/config014.cfg \ + functional/inheritance/config015.cfg \ + functional/inheritance/config016.cfg \ + functional/inheritance/config017.cfg \ + functional/inheritance/config018.cfg \ + functional/inheritance/config019.cfg \ + functional/inheritance/config020.cfg \ + functional/inheritance/config021.cfg \ + functional/inheritance/config022.cfg \ + functional/inheritance/config023.cfg \ + functional/inheritance/config024.cfg \ + functional/inheritance/inherit.kshlib \ + functional/inheritance/README.config \ + functional/inheritance/README.state \ + functional/inheritance/state001.cfg \ + functional/inheritance/state002.cfg \ + functional/inheritance/state003.cfg \ + functional/inheritance/state004.cfg \ + functional/inheritance/state005.cfg \ + functional/inheritance/state006.cfg \ + functional/inheritance/state007.cfg \ + functional/inheritance/state008.cfg \ + functional/inheritance/state009.cfg \ + functional/inheritance/state010.cfg \ + functional/inheritance/state011.cfg \ + functional/inheritance/state012.cfg \ + functional/inheritance/state013.cfg \ + functional/inheritance/state014.cfg \ + functional/inheritance/state015.cfg \ + functional/inheritance/state016.cfg \ + functional/inheritance/state017.cfg \ + functional/inheritance/state018.cfg \ + functional/inheritance/state019.cfg \ + functional/inheritance/state020.cfg \ + functional/inheritance/state021.cfg \ + functional/inheritance/state022.cfg \ + functional/inheritance/state023.cfg \ + functional/inheritance/state024.cfg \ + functional/inuse/inuse.cfg \ + functional/io/io.cfg \ + functional/l2arc/l2arc.cfg \ + functional/largest_pool/largest_pool.cfg \ + functional/migration/migration.cfg \ + functional/migration/migration.kshlib \ + functional/mmap/mmap.cfg \ + functional/mmp/mmp.cfg \ + functional/mmp/mmp.kshlib \ + functional/mv_files/mv_files.cfg \ + functional/mv_files/mv_files_common.kshlib \ + functional/nopwrite/nopwrite.shlib \ + functional/no_space/enospc.cfg \ + functional/online_offline/online_offline.cfg \ + functional/pool_checkpoint/pool_checkpoint.kshlib \ + functional/projectquota/projectquota.cfg \ + functional/projectquota/projectquota_common.kshlib \ + functional/quota/quota.cfg \ + functional/quota/quota.kshlib \ + functional/redacted_send/redacted.cfg \ + functional/redacted_send/redacted.kshlib \ + functional/redundancy/redundancy.cfg \ + functional/redundancy/redundancy.kshlib \ + functional/refreserv/refreserv.cfg \ + functional/removal/removal.kshlib \ + functional/replacement/replacement.cfg \ + functional/reservation/reservation.cfg \ + functional/reservation/reservation.shlib \ + functional/rsend/dedup_encrypted_zvol.bz2 \ + functional/rsend/dedup_encrypted_zvol.zsend.bz2 \ + functional/rsend/dedup.zsend.bz2 \ + functional/rsend/fs.tar.gz \ + functional/rsend/rsend.cfg \ + functional/rsend/rsend.kshlib \ + functional/scrub_mirror/default.cfg \ + functional/scrub_mirror/scrub_mirror_common.kshlib \ + functional/slog/slog.cfg \ + functional/slog/slog.kshlib \ + functional/snapshot/snapshot.cfg \ + functional/snapused/snapused.kshlib \ + functional/sparse/sparse.cfg \ + functional/trim/trim.cfg \ + functional/trim/trim.kshlib \ + functional/truncate/truncate.cfg \ + functional/upgrade/upgrade_common.kshlib \ + functional/user_namespace/user_namespace.cfg \ + functional/user_namespace/user_namespace_common.kshlib \ + functional/userquota/userquota.cfg \ + functional/userquota/userquota_common.kshlib \ + functional/vdev_zaps/vdev_zaps.kshlib \ + functional/xattr/xattr.cfg \ + functional/xattr/xattr_common.kshlib \ + functional/zvol/zvol.cfg \ + functional/zvol/zvol_cli/zvol_cli.cfg \ + functional/zvol/zvol_common.shlib \ + functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg \ + functional/zvol/zvol_misc/zvol_misc_common.kshlib \ + functional/zvol/zvol_swap/zvol_swap.cfg + +nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \ + functional/acl/off/cleanup.ksh \ + functional/acl/off/dosmode.ksh \ + functional/acl/off/posixmode.ksh \ + functional/acl/off/setup.ksh \ + functional/acl/posix/cleanup.ksh \ + functional/acl/posix/posix_001_pos.ksh \ + functional/acl/posix/posix_002_pos.ksh \ + functional/acl/posix/posix_003_pos.ksh \ + functional/acl/posix/posix_004_pos.ksh \ + functional/acl/posix-sa/cleanup.ksh \ + functional/acl/posix-sa/posix_001_pos.ksh \ + functional/acl/posix-sa/posix_002_pos.ksh \ + functional/acl/posix-sa/posix_003_pos.ksh \ + functional/acl/posix-sa/posix_004_pos.ksh \ + functional/acl/posix-sa/setup.ksh \ + functional/acl/posix/setup.ksh \ + functional/alloc_class/alloc_class_001_pos.ksh \ + functional/alloc_class/alloc_class_002_neg.ksh \ + functional/alloc_class/alloc_class_003_pos.ksh \ + functional/alloc_class/alloc_class_004_pos.ksh \ + functional/alloc_class/alloc_class_005_pos.ksh \ + functional/alloc_class/alloc_class_006_pos.ksh \ + functional/alloc_class/alloc_class_007_pos.ksh \ + functional/alloc_class/alloc_class_008_pos.ksh \ + functional/alloc_class/alloc_class_009_pos.ksh \ + functional/alloc_class/alloc_class_010_pos.ksh \ + functional/alloc_class/alloc_class_011_neg.ksh \ + functional/alloc_class/alloc_class_012_pos.ksh \ + functional/alloc_class/alloc_class_013_pos.ksh \ + functional/alloc_class/cleanup.ksh \ + functional/alloc_class/setup.ksh \ + functional/arc/arcstats_runtime_tuning.ksh \ + functional/arc/cleanup.ksh \ + functional/arc/dbufstats_001_pos.ksh \ + functional/arc/dbufstats_002_pos.ksh \ + functional/arc/dbufstats_003_pos.ksh \ + functional/arc/setup.ksh \ + functional/atime/atime_001_pos.ksh \ + functional/atime/atime_002_neg.ksh \ + functional/atime/atime_003_pos.ksh \ + functional/atime/cleanup.ksh \ + functional/atime/root_atime_off.ksh \ + functional/atime/root_atime_on.ksh \ + functional/atime/root_relatime_on.ksh \ + functional/atime/setup.ksh \ + functional/bootfs/bootfs_001_pos.ksh \ + functional/bootfs/bootfs_002_neg.ksh \ + functional/bootfs/bootfs_003_pos.ksh \ + functional/bootfs/bootfs_004_neg.ksh \ + functional/bootfs/bootfs_005_neg.ksh \ + functional/bootfs/bootfs_006_pos.ksh \ + functional/bootfs/bootfs_007_pos.ksh \ + functional/bootfs/bootfs_008_pos.ksh \ + functional/bootfs/cleanup.ksh \ + functional/bootfs/setup.ksh \ + functional/btree/btree_negative.ksh \ + functional/btree/btree_positive.ksh \ + functional/cache/cache_001_pos.ksh \ + functional/cache/cache_002_pos.ksh \ + functional/cache/cache_003_pos.ksh \ + functional/cache/cache_004_neg.ksh \ + functional/cache/cache_005_neg.ksh \ + functional/cache/cache_006_pos.ksh \ + functional/cache/cache_007_neg.ksh \ + functional/cache/cache_008_neg.ksh \ + functional/cache/cache_009_pos.ksh \ + functional/cache/cache_010_pos.ksh \ + functional/cache/cache_011_pos.ksh \ + functional/cache/cache_012_pos.ksh \ + functional/cache/cleanup.ksh \ + functional/cachefile/cachefile_001_pos.ksh \ + functional/cachefile/cachefile_002_pos.ksh \ + functional/cachefile/cachefile_003_pos.ksh \ + functional/cachefile/cachefile_004_pos.ksh \ + functional/cachefile/cleanup.ksh \ + functional/cachefile/setup.ksh \ + functional/cache/setup.ksh \ + functional/casenorm/case_all_values.ksh \ + functional/casenorm/cleanup.ksh \ + functional/casenorm/insensitive_formd_delete.ksh \ + functional/casenorm/insensitive_formd_lookup.ksh \ + functional/casenorm/insensitive_none_delete.ksh \ + functional/casenorm/insensitive_none_lookup.ksh \ + functional/casenorm/mixed_create_failure.ksh \ + functional/casenorm/mixed_formd_delete.ksh \ + functional/casenorm/mixed_formd_lookup_ci.ksh \ + functional/casenorm/mixed_formd_lookup.ksh \ + functional/casenorm/mixed_none_delete.ksh \ + functional/casenorm/mixed_none_lookup_ci.ksh \ + functional/casenorm/mixed_none_lookup.ksh \ + functional/casenorm/norm_all_values.ksh \ + functional/casenorm/sensitive_formd_delete.ksh \ + functional/casenorm/sensitive_formd_lookup.ksh \ + functional/casenorm/sensitive_none_delete.ksh \ + functional/casenorm/sensitive_none_lookup.ksh \ + functional/casenorm/setup.ksh \ + functional/channel_program/lua_core/cleanup.ksh \ + functional/channel_program/lua_core/setup.ksh \ + functional/channel_program/lua_core/tst.args_to_lua.ksh \ + functional/channel_program/lua_core/tst.divide_by_zero.ksh \ + functional/channel_program/lua_core/tst.exists.ksh \ + functional/channel_program/lua_core/tst.integer_illegal.ksh \ + functional/channel_program/lua_core/tst.integer_overflow.ksh \ + functional/channel_program/lua_core/tst.language_functions_neg.ksh \ + functional/channel_program/lua_core/tst.language_functions_pos.ksh \ + functional/channel_program/lua_core/tst.large_prog.ksh \ + functional/channel_program/lua_core/tst.libraries.ksh \ + functional/channel_program/lua_core/tst.memory_limit.ksh \ + functional/channel_program/lua_core/tst.nested_neg.ksh \ + functional/channel_program/lua_core/tst.nested_pos.ksh \ + functional/channel_program/lua_core/tst.nvlist_to_lua.ksh \ + functional/channel_program/lua_core/tst.recursive_neg.ksh \ + functional/channel_program/lua_core/tst.recursive_pos.ksh \ + functional/channel_program/lua_core/tst.return_large.ksh \ + functional/channel_program/lua_core/tst.return_nvlist_neg.ksh \ + functional/channel_program/lua_core/tst.return_nvlist_pos.ksh \ + functional/channel_program/lua_core/tst.return_recursive_table.ksh \ + functional/channel_program/lua_core/tst.stack_gsub.ksh \ + functional/channel_program/lua_core/tst.timeout.ksh \ + functional/channel_program/synctask_core/cleanup.ksh \ + functional/channel_program/synctask_core/setup.ksh \ + functional/channel_program/synctask_core/tst.bookmark.copy.ksh \ + functional/channel_program/synctask_core/tst.bookmark.create.ksh \ + functional/channel_program/synctask_core/tst.destroy_fs.ksh \ + functional/channel_program/synctask_core/tst.destroy_snap.ksh \ + functional/channel_program/synctask_core/tst.get_count_and_limit.ksh \ + functional/channel_program/synctask_core/tst.get_index_props.ksh \ + functional/channel_program/synctask_core/tst.get_mountpoint.ksh \ + functional/channel_program/synctask_core/tst.get_neg.ksh \ + functional/channel_program/synctask_core/tst.get_number_props.ksh \ + functional/channel_program/synctask_core/tst.get_string_props.ksh \ + functional/channel_program/synctask_core/tst.get_type.ksh \ + functional/channel_program/synctask_core/tst.get_userquota.ksh \ + functional/channel_program/synctask_core/tst.get_written.ksh \ + functional/channel_program/synctask_core/tst.inherit.ksh \ + functional/channel_program/synctask_core/tst.list_bookmarks.ksh \ + functional/channel_program/synctask_core/tst.list_children.ksh \ + functional/channel_program/synctask_core/tst.list_clones.ksh \ + functional/channel_program/synctask_core/tst.list_holds.ksh \ + functional/channel_program/synctask_core/tst.list_snapshots.ksh \ + functional/channel_program/synctask_core/tst.list_system_props.ksh \ + functional/channel_program/synctask_core/tst.list_user_props.ksh \ + functional/channel_program/synctask_core/tst.parse_args_neg.ksh \ + functional/channel_program/synctask_core/tst.promote_conflict.ksh \ + functional/channel_program/synctask_core/tst.promote_multiple.ksh \ + functional/channel_program/synctask_core/tst.promote_simple.ksh \ + functional/channel_program/synctask_core/tst.rollback_mult.ksh \ + functional/channel_program/synctask_core/tst.rollback_one.ksh \ + functional/channel_program/synctask_core/tst.set_props.ksh \ + functional/channel_program/synctask_core/tst.snapshot_destroy.ksh \ + functional/channel_program/synctask_core/tst.snapshot_neg.ksh \ + functional/channel_program/synctask_core/tst.snapshot_recursive.ksh \ + functional/channel_program/synctask_core/tst.snapshot_simple.ksh \ + functional/channel_program/synctask_core/tst.terminate_by_signal.ksh \ + functional/chattr/chattr_001_pos.ksh \ + functional/chattr/chattr_002_neg.ksh \ + functional/chattr/cleanup.ksh \ + functional/chattr/setup.ksh \ + functional/checksum/cleanup.ksh \ + functional/checksum/filetest_001_pos.ksh \ + functional/checksum/filetest_002_pos.ksh \ + functional/checksum/run_edonr_test.ksh \ + functional/checksum/run_sha2_test.ksh \ + functional/checksum/run_skein_test.ksh \ + functional/checksum/setup.ksh \ + functional/clean_mirror/clean_mirror_001_pos.ksh \ + functional/clean_mirror/clean_mirror_002_pos.ksh \ + functional/clean_mirror/clean_mirror_003_pos.ksh \ + functional/clean_mirror/clean_mirror_004_pos.ksh \ + functional/clean_mirror/cleanup.ksh \ + functional/clean_mirror/setup.ksh \ + functional/cli_root/zdb/zdb_002_pos.ksh \ + functional/cli_root/zdb/zdb_003_pos.ksh \ + functional/cli_root/zdb/zdb_004_pos.ksh \ + functional/cli_root/zdb/zdb_005_pos.ksh \ + functional/cli_root/zdb/zdb_006_pos.ksh \ + functional/cli_root/zdb/zdb_args_neg.ksh \ + functional/cli_root/zdb/zdb_args_pos.ksh \ + functional/cli_root/zdb/zdb_block_size_histogram.ksh \ + functional/cli_root/zdb/zdb_checksum.ksh \ + functional/cli_root/zdb/zdb_decompress.ksh \ + functional/cli_root/zdb/zdb_decompress_zstd.ksh \ + functional/cli_root/zdb/zdb_display_block.ksh \ + functional/cli_root/zdb/zdb_label_checksum.ksh \ + functional/cli_root/zdb/zdb_object_range_neg.ksh \ + functional/cli_root/zdb/zdb_object_range_pos.ksh \ + functional/cli_root/zdb/zdb_objset_id.ksh \ + functional/cli_root/zdb/zdb_recover_2.ksh \ + functional/cli_root/zdb/zdb_recover.ksh \ + functional/cli_root/zfs_bookmark/cleanup.ksh \ + functional/cli_root/zfs_bookmark/setup.ksh \ + functional/cli_root/zfs_bookmark/zfs_bookmark_cliargs.ksh \ + functional/cli_root/zfs_change-key/cleanup.ksh \ + functional/cli_root/zfs_change-key/setup.ksh \ + functional/cli_root/zfs_change-key/zfs_change-key_child.ksh \ + functional/cli_root/zfs_change-key/zfs_change-key_clones.ksh \ + functional/cli_root/zfs_change-key/zfs_change-key_format.ksh \ + functional/cli_root/zfs_change-key/zfs_change-key_inherit.ksh \ + functional/cli_root/zfs_change-key/zfs_change-key.ksh \ + functional/cli_root/zfs_change-key/zfs_change-key_load.ksh \ + functional/cli_root/zfs_change-key/zfs_change-key_location.ksh \ + functional/cli_root/zfs_change-key/zfs_change-key_pbkdf2iters.ksh \ + functional/cli_root/zfs/cleanup.ksh \ + functional/cli_root/zfs_clone/cleanup.ksh \ + functional/cli_root/zfs_clone/setup.ksh \ + functional/cli_root/zfs_clone/zfs_clone_001_neg.ksh \ + functional/cli_root/zfs_clone/zfs_clone_002_pos.ksh \ + functional/cli_root/zfs_clone/zfs_clone_003_pos.ksh \ + functional/cli_root/zfs_clone/zfs_clone_004_pos.ksh \ + functional/cli_root/zfs_clone/zfs_clone_005_pos.ksh \ + functional/cli_root/zfs_clone/zfs_clone_006_pos.ksh \ + functional/cli_root/zfs_clone/zfs_clone_007_pos.ksh \ + functional/cli_root/zfs_clone/zfs_clone_008_neg.ksh \ + functional/cli_root/zfs_clone/zfs_clone_009_neg.ksh \ + functional/cli_root/zfs_clone/zfs_clone_010_pos.ksh \ + functional/cli_root/zfs_clone/zfs_clone_deeply_nested.ksh \ + functional/cli_root/zfs_clone/zfs_clone_encrypted.ksh \ + functional/cli_root/zfs_clone/zfs_clone_rm_nested.ksh \ + functional/cli_root/zfs_copies/cleanup.ksh \ + functional/cli_root/zfs_copies/setup.ksh \ + functional/cli_root/zfs_copies/zfs_copies_001_pos.ksh \ + functional/cli_root/zfs_copies/zfs_copies_002_pos.ksh \ + functional/cli_root/zfs_copies/zfs_copies_003_pos.ksh \ + functional/cli_root/zfs_copies/zfs_copies_004_neg.ksh \ + functional/cli_root/zfs_copies/zfs_copies_005_neg.ksh \ + functional/cli_root/zfs_copies/zfs_copies_006_pos.ksh \ + functional/cli_root/zfs_create/cleanup.ksh \ + functional/cli_root/zfs_create/setup.ksh \ + functional/cli_root/zfs_create/zfs_create_001_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_002_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_003_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_004_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_005_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_006_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_007_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_008_neg.ksh \ + functional/cli_root/zfs_create/zfs_create_009_neg.ksh \ + functional/cli_root/zfs_create/zfs_create_010_neg.ksh \ + functional/cli_root/zfs_create/zfs_create_011_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_012_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_013_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_014_pos.ksh \ + functional/cli_root/zfs_create/zfs_create_crypt_combos.ksh \ + functional/cli_root/zfs_create/zfs_create_dryrun.ksh \ + functional/cli_root/zfs_create/zfs_create_encrypted.ksh \ + functional/cli_root/zfs_create/zfs_create_nomount.ksh \ + functional/cli_root/zfs_create/zfs_create_verbose.ksh \ + functional/cli_root/zfs_destroy/cleanup.ksh \ + functional/cli_root/zfs_destroy/setup.ksh \ + functional/cli_root/zfs_destroy/zfs_clone_livelist_condense_and_disable.ksh \ + functional/cli_root/zfs_destroy/zfs_clone_livelist_condense_races.ksh \ + functional/cli_root/zfs_destroy/zfs_clone_livelist_dedup.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_001_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_002_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_003_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_004_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_005_neg.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_006_neg.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_007_neg.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_008_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_009_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_010_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_011_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_012_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_013_neg.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_014_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_015_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_016_pos.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_clone_livelist.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_dev_removal_condense.ksh \ + functional/cli_root/zfs_destroy/zfs_destroy_dev_removal.ksh \ + functional/cli_root/zfs_diff/cleanup.ksh \ + functional/cli_root/zfs_diff/setup.ksh \ + functional/cli_root/zfs_diff/zfs_diff_changes.ksh \ + functional/cli_root/zfs_diff/zfs_diff_cliargs.ksh \ + functional/cli_root/zfs_diff/zfs_diff_encrypted.ksh \ + functional/cli_root/zfs_diff/zfs_diff_mangle.ksh \ + functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh \ + functional/cli_root/zfs_diff/zfs_diff_types.ksh \ + functional/cli_root/zfs_get/cleanup.ksh \ + functional/cli_root/zfs_get/setup.ksh \ + functional/cli_root/zfs_get/zfs_get_001_pos.ksh \ + functional/cli_root/zfs_get/zfs_get_002_pos.ksh \ + functional/cli_root/zfs_get/zfs_get_003_pos.ksh \ + functional/cli_root/zfs_get/zfs_get_004_pos.ksh \ + functional/cli_root/zfs_get/zfs_get_005_neg.ksh \ + functional/cli_root/zfs_get/zfs_get_006_neg.ksh \ + functional/cli_root/zfs_get/zfs_get_007_neg.ksh \ + functional/cli_root/zfs_get/zfs_get_008_pos.ksh \ + functional/cli_root/zfs_get/zfs_get_009_pos.ksh \ + functional/cli_root/zfs_get/zfs_get_010_neg.ksh \ + functional/cli_root/zfs_ids_to_path/cleanup.ksh \ + functional/cli_root/zfs_ids_to_path/setup.ksh \ + functional/cli_root/zfs_ids_to_path/zfs_ids_to_path_001_pos.ksh \ + functional/cli_root/zfs_inherit/cleanup.ksh \ + functional/cli_root/zfs_inherit/setup.ksh \ + functional/cli_root/zfs_inherit/zfs_inherit_001_neg.ksh \ + functional/cli_root/zfs_inherit/zfs_inherit_002_neg.ksh \ + functional/cli_root/zfs_inherit/zfs_inherit_003_pos.ksh \ + functional/cli_root/zfs_inherit/zfs_inherit_mountpoint.ksh \ + functional/cli_root/zfs_jail/cleanup.ksh \ + functional/cli_root/zfs_jail/setup.ksh \ + functional/cli_root/zfs_jail/zfs_jail_001_pos.ksh \ + functional/cli_root/zfs_load-key/cleanup.ksh \ + functional/cli_root/zfs_load-key/setup.ksh \ + functional/cli_root/zfs_load-key/zfs_load-key_all.ksh \ + functional/cli_root/zfs_load-key/zfs_load-key_file.ksh \ + functional/cli_root/zfs_load-key/zfs_load-key_https.ksh \ + functional/cli_root/zfs_load-key/zfs_load-key.ksh \ + functional/cli_root/zfs_load-key/zfs_load-key_location.ksh \ + functional/cli_root/zfs_load-key/zfs_load-key_noop.ksh \ + functional/cli_root/zfs_load-key/zfs_load-key_recursive.ksh \ + functional/cli_root/zfs_mount/cleanup.ksh \ + functional/cli_root/zfs_mount/setup.ksh \ + functional/cli_root/zfs_mount/zfs_mount_001_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_002_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_003_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_004_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_006_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_008_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_009_neg.ksh \ + functional/cli_root/zfs_mount/zfs_mount_010_neg.ksh \ + functional/cli_root/zfs_mount/zfs_mount_011_neg.ksh \ + functional/cli_root/zfs_mount/zfs_mount_012_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_014_neg.ksh \ + functional/cli_root/zfs_mount/zfs_mount_all_001_pos.ksh \ + functional/cli_root/zfs_mount/zfs_mount_all_fail.ksh \ + functional/cli_root/zfs_mount/zfs_mount_all_mountpoints.ksh \ + functional/cli_root/zfs_mount/zfs_mount_encrypted.ksh \ + functional/cli_root/zfs_mount/zfs_mount_remount.ksh \ + functional/cli_root/zfs_mount/zfs_mount_test_race.ksh \ + functional/cli_root/zfs_mount/zfs_multi_mount.ksh \ + functional/cli_root/zfs_program/cleanup.ksh \ + functional/cli_root/zfs_program/setup.ksh \ + functional/cli_root/zfs_program/zfs_program_json.ksh \ + functional/cli_root/zfs_promote/cleanup.ksh \ + functional/cli_root/zfs_promote/setup.ksh \ + functional/cli_root/zfs_promote/zfs_promote_001_pos.ksh \ + functional/cli_root/zfs_promote/zfs_promote_002_pos.ksh \ + functional/cli_root/zfs_promote/zfs_promote_003_pos.ksh \ + functional/cli_root/zfs_promote/zfs_promote_004_pos.ksh \ + functional/cli_root/zfs_promote/zfs_promote_005_pos.ksh \ + functional/cli_root/zfs_promote/zfs_promote_006_neg.ksh \ + functional/cli_root/zfs_promote/zfs_promote_007_neg.ksh \ + functional/cli_root/zfs_promote/zfs_promote_008_pos.ksh \ + functional/cli_root/zfs_promote/zfs_promote_encryptionroot.ksh \ + functional/cli_root/zfs_property/cleanup.ksh \ + functional/cli_root/zfs_property/setup.ksh \ + functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh \ + functional/cli_root/zfs_receive/cleanup.ksh \ + functional/cli_root/zfs_receive/receive-o-x_props_aliases.ksh \ + functional/cli_root/zfs_receive/receive-o-x_props_override.ksh \ + functional/cli_root/zfs_receive/setup.ksh \ + functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_002_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_004_neg.ksh \ + functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh \ + functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh \ + functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_009_neg.ksh \ + functional/cli_root/zfs_receive/zfs_receive_010_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_011_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_012_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_014_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_015_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_016_pos.ksh \ + functional/cli_root/zfs_receive/zfs_receive_-e.ksh \ + functional/cli_root/zfs_receive/zfs_receive_from_encrypted.ksh \ + functional/cli_root/zfs_receive/zfs_receive_from_zstd.ksh \ + functional/cli_root/zfs_receive/zfs_receive_new_props.ksh \ + functional/cli_root/zfs_receive/zfs_receive_raw_-d.ksh \ + functional/cli_root/zfs_receive/zfs_receive_raw_incremental.ksh \ + functional/cli_root/zfs_receive/zfs_receive_raw.ksh \ + functional/cli_root/zfs_receive/zfs_receive_to_encrypted.ksh \ + functional/cli_root/zfs_receive/zfs_receive_-wR-encrypted-mix.ksh \ + functional/cli_root/zfs_rename/cleanup.ksh \ + functional/cli_root/zfs_rename/setup.ksh \ + functional/cli_root/zfs_rename/zfs_rename_001_pos.ksh \ + functional/cli_root/zfs_rename/zfs_rename_002_pos.ksh \ + functional/cli_root/zfs_rename/zfs_rename_003_pos.ksh \ + functional/cli_root/zfs_rename/zfs_rename_004_neg.ksh \ + functional/cli_root/zfs_rename/zfs_rename_005_neg.ksh \ + functional/cli_root/zfs_rename/zfs_rename_006_pos.ksh \ + functional/cli_root/zfs_rename/zfs_rename_007_pos.ksh \ + functional/cli_root/zfs_rename/zfs_rename_008_pos.ksh \ + functional/cli_root/zfs_rename/zfs_rename_009_neg.ksh \ + functional/cli_root/zfs_rename/zfs_rename_010_neg.ksh \ + functional/cli_root/zfs_rename/zfs_rename_011_pos.ksh \ + functional/cli_root/zfs_rename/zfs_rename_012_neg.ksh \ + functional/cli_root/zfs_rename/zfs_rename_013_pos.ksh \ + functional/cli_root/zfs_rename/zfs_rename_014_neg.ksh \ + functional/cli_root/zfs_rename/zfs_rename_encrypted_child.ksh \ + functional/cli_root/zfs_rename/zfs_rename_mountpoint.ksh \ + functional/cli_root/zfs_rename/zfs_rename_nounmount.ksh \ + functional/cli_root/zfs_rename/zfs_rename_to_encrypted.ksh \ + functional/cli_root/zfs_reservation/cleanup.ksh \ + functional/cli_root/zfs_reservation/setup.ksh \ + functional/cli_root/zfs_reservation/zfs_reservation_001_pos.ksh \ + functional/cli_root/zfs_reservation/zfs_reservation_002_pos.ksh \ + functional/cli_root/zfs_rollback/cleanup.ksh \ + functional/cli_root/zfs_rollback/setup.ksh \ + functional/cli_root/zfs_rollback/zfs_rollback_001_pos.ksh \ + functional/cli_root/zfs_rollback/zfs_rollback_002_pos.ksh \ + functional/cli_root/zfs_rollback/zfs_rollback_003_neg.ksh \ + functional/cli_root/zfs_rollback/zfs_rollback_004_neg.ksh \ + functional/cli_root/zfs_send/cleanup.ksh \ + functional/cli_root/zfs_send/setup.ksh \ + functional/cli_root/zfs_send/zfs_send_001_pos.ksh \ + functional/cli_root/zfs_send/zfs_send_002_pos.ksh \ + functional/cli_root/zfs_send/zfs_send_003_pos.ksh \ + functional/cli_root/zfs_send/zfs_send_004_neg.ksh \ + functional/cli_root/zfs_send/zfs_send_005_pos.ksh \ + functional/cli_root/zfs_send/zfs_send_006_pos.ksh \ + functional/cli_root/zfs_send/zfs_send_007_pos.ksh \ + functional/cli_root/zfs_send/zfs_send-b.ksh \ + functional/cli_root/zfs_send/zfs_send_encrypted.ksh \ + functional/cli_root/zfs_send/zfs_send_encrypted_unloaded.ksh \ + functional/cli_root/zfs_send/zfs_send_raw.ksh \ + functional/cli_root/zfs_send/zfs_send_skip_missing.ksh \ + functional/cli_root/zfs_send/zfs_send_sparse.ksh \ + functional/cli_root/zfs_set/cache_001_pos.ksh \ + functional/cli_root/zfs_set/cache_002_neg.ksh \ + functional/cli_root/zfs_set/canmount_001_pos.ksh \ + functional/cli_root/zfs_set/canmount_002_pos.ksh \ + functional/cli_root/zfs_set/canmount_003_pos.ksh \ + functional/cli_root/zfs_set/canmount_004_pos.ksh \ + functional/cli_root/zfs_set/checksum_001_pos.ksh \ + functional/cli_root/zfs_set/cleanup.ksh \ + functional/cli_root/zfs_set/compression_001_pos.ksh \ + functional/cli_root/zfs_set/mountpoint_001_pos.ksh \ + functional/cli_root/zfs_set/mountpoint_002_pos.ksh \ + functional/cli_root/zfs_set/mountpoint_003_pos.ksh \ + functional/cli_root/zfs_set/onoffs_001_pos.ksh \ + functional/cli_root/zfs_set/property_alias_001_pos.ksh \ + functional/cli_root/zfs_set/readonly_001_pos.ksh \ + functional/cli_root/zfs_set/reservation_001_neg.ksh \ + functional/cli_root/zfs_set/ro_props_001_pos.ksh \ + functional/cli_root/zfs_set/setup.ksh \ + functional/cli_root/zfs_set/share_mount_001_neg.ksh \ + functional/cli_root/zfs_set/snapdir_001_pos.ksh \ + functional/cli_root/zfs/setup.ksh \ + functional/cli_root/zfs_set/user_property_001_pos.ksh \ + functional/cli_root/zfs_set/user_property_002_pos.ksh \ + functional/cli_root/zfs_set/user_property_003_neg.ksh \ + functional/cli_root/zfs_set/user_property_004_pos.ksh \ + functional/cli_root/zfs_set/version_001_neg.ksh \ + functional/cli_root/zfs_set/zfs_set_001_neg.ksh \ + functional/cli_root/zfs_set/zfs_set_002_neg.ksh \ + functional/cli_root/zfs_set/zfs_set_003_neg.ksh \ + functional/cli_root/zfs_set/zfs_set_feature_activation.ksh \ + functional/cli_root/zfs_set/zfs_set_keylocation.ksh \ + functional/cli_root/zfs_share/cleanup.ksh \ + functional/cli_root/zfs_share/setup.ksh \ + functional/cli_root/zfs_share/zfs_share_001_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_002_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_003_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_004_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_005_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_006_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_007_neg.ksh \ + functional/cli_root/zfs_share/zfs_share_008_neg.ksh \ + functional/cli_root/zfs_share/zfs_share_009_neg.ksh \ + functional/cli_root/zfs_share/zfs_share_010_neg.ksh \ + functional/cli_root/zfs_share/zfs_share_011_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_012_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_013_pos.ksh \ + functional/cli_root/zfs_share/zfs_share_concurrent_shares.ksh \ + functional/cli_root/zfs_snapshot/cleanup.ksh \ + functional/cli_root/zfs_snapshot/setup.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_001_neg.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_002_neg.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_003_neg.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_004_neg.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_005_neg.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_006_pos.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_007_neg.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_008_neg.ksh \ + functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh \ + functional/cli_root/zfs_sysfs/cleanup.ksh \ + functional/cli_root/zfs_sysfs/setup.ksh \ + functional/cli_root/zfs_sysfs/zfeature_set_unsupported.ksh \ + functional/cli_root/zfs_sysfs/zfs_get_unsupported.ksh \ + functional/cli_root/zfs_sysfs/zfs_set_unsupported.ksh \ + functional/cli_root/zfs_sysfs/zfs_sysfs_live.ksh \ + functional/cli_root/zfs_sysfs/zpool_get_unsupported.ksh \ + functional/cli_root/zfs_sysfs/zpool_set_unsupported.ksh \ + functional/cli_root/zfs_unload-key/cleanup.ksh \ + functional/cli_root/zfs_unload-key/setup.ksh \ + functional/cli_root/zfs_unload-key/zfs_unload-key_all.ksh \ + functional/cli_root/zfs_unload-key/zfs_unload-key.ksh \ + functional/cli_root/zfs_unload-key/zfs_unload-key_recursive.ksh \ + functional/cli_root/zfs_unmount/cleanup.ksh \ + functional/cli_root/zfs_unmount/setup.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_001_pos.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_002_pos.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_003_pos.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_004_pos.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_005_pos.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_006_pos.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_007_neg.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_008_neg.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_009_pos.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_all_001_pos.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_nested.ksh \ + functional/cli_root/zfs_unmount/zfs_unmount_unload_keys.ksh \ + functional/cli_root/zfs_unshare/cleanup.ksh \ + functional/cli_root/zfs_unshare/setup.ksh \ + functional/cli_root/zfs_unshare/zfs_unshare_001_pos.ksh \ + functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh \ + functional/cli_root/zfs_unshare/zfs_unshare_003_pos.ksh \ + functional/cli_root/zfs_unshare/zfs_unshare_004_neg.ksh \ + functional/cli_root/zfs_unshare/zfs_unshare_005_neg.ksh \ + functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh \ + functional/cli_root/zfs_unshare/zfs_unshare_007_pos.ksh \ + functional/cli_root/zfs_upgrade/cleanup.ksh \ + functional/cli_root/zfs_upgrade/setup.ksh \ + functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh \ + functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh \ + functional/cli_root/zfs_upgrade/zfs_upgrade_003_pos.ksh \ + functional/cli_root/zfs_upgrade/zfs_upgrade_004_pos.ksh \ + functional/cli_root/zfs_upgrade/zfs_upgrade_005_pos.ksh \ + functional/cli_root/zfs_upgrade/zfs_upgrade_006_neg.ksh \ + functional/cli_root/zfs_upgrade/zfs_upgrade_007_neg.ksh \ + functional/cli_root/zfs_wait/cleanup.ksh \ + functional/cli_root/zfs_wait/setup.ksh \ + functional/cli_root/zfs_wait/zfs_wait_deleteq.ksh \ + functional/cli_root/zfs_wait/zfs_wait_getsubopt.ksh \ + functional/cli_root/zfs/zfs_001_neg.ksh \ + functional/cli_root/zfs/zfs_002_pos.ksh \ + functional/cli_root/zfs/zfs_003_neg.ksh \ + functional/cli_root/zhack/zhack_label_checksum.ksh \ + functional/cli_root/zpool_add/add_nested_replacing_spare.ksh \ + functional/cli_root/zpool_add/add-o_ashift.ksh \ + functional/cli_root/zpool_add/add_prop_ashift.ksh \ + functional/cli_root/zpool_add/cleanup.ksh \ + functional/cli_root/zpool_add/setup.ksh \ + functional/cli_root/zpool_add/zpool_add_001_pos.ksh \ + functional/cli_root/zpool_add/zpool_add_002_pos.ksh \ + functional/cli_root/zpool_add/zpool_add_003_pos.ksh \ + functional/cli_root/zpool_add/zpool_add_004_pos.ksh \ + functional/cli_root/zpool_add/zpool_add_005_pos.ksh \ + functional/cli_root/zpool_add/zpool_add_006_pos.ksh \ + functional/cli_root/zpool_add/zpool_add_007_neg.ksh \ + functional/cli_root/zpool_add/zpool_add_008_neg.ksh \ + functional/cli_root/zpool_add/zpool_add_009_neg.ksh \ + functional/cli_root/zpool_add/zpool_add_010_pos.ksh \ + functional/cli_root/zpool_add/zpool_add_dryrun_output.ksh \ + functional/cli_root/zpool_attach/attach-o_ashift.ksh \ + functional/cli_root/zpool_attach/cleanup.ksh \ + functional/cli_root/zpool_attach/setup.ksh \ + functional/cli_root/zpool_attach/zpool_attach_001_neg.ksh \ + functional/cli_root/zpool/cleanup.ksh \ + functional/cli_root/zpool_clear/cleanup.ksh \ + functional/cli_root/zpool_clear/setup.ksh \ + functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh \ + functional/cli_root/zpool_clear/zpool_clear_002_neg.ksh \ + functional/cli_root/zpool_clear/zpool_clear_003_neg.ksh \ + functional/cli_root/zpool_clear/zpool_clear_readonly.ksh \ + functional/cli_root/zpool_create/cleanup.ksh \ + functional/cli_root/zpool_create/create-o_ashift.ksh \ + functional/cli_root/zpool_create/setup.ksh \ + functional/cli_root/zpool_create/zpool_create_001_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_002_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_003_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_004_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_005_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_006_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_007_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_008_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_009_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_010_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_011_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_012_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_014_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_015_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_016_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_017_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_018_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_019_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_020_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_021_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_022_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_023_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_024_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_crypt_combos.ksh \ + functional/cli_root/zpool_create/zpool_create_draid_001_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_draid_002_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_draid_003_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_draid_004_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_dryrun_output.ksh \ + functional/cli_root/zpool_create/zpool_create_encrypted.ksh \ + functional/cli_root/zpool_create/zpool_create_features_001_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_features_002_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_features_003_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_features_004_neg.ksh \ + functional/cli_root/zpool_create/zpool_create_features_005_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_features_006_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_features_007_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_features_008_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_features_009_pos.ksh \ + functional/cli_root/zpool_create/zpool_create_tempname.ksh \ + functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh \ + functional/cli_root/zpool_destroy/zpool_destroy_002_pos.ksh \ + functional/cli_root/zpool_destroy/zpool_destroy_003_neg.ksh \ + functional/cli_root/zpool_detach/cleanup.ksh \ + functional/cli_root/zpool_detach/setup.ksh \ + functional/cli_root/zpool_detach/zpool_detach_001_neg.ksh \ + functional/cli_root/zpool_events/cleanup.ksh \ + functional/cli_root/zpool_events/setup.ksh \ + functional/cli_root/zpool_events/zpool_events_clear.ksh \ + functional/cli_root/zpool_events/zpool_events_clear_retained.ksh \ + functional/cli_root/zpool_events/zpool_events_cliargs.ksh \ + functional/cli_root/zpool_events/zpool_events_duplicates.ksh \ + functional/cli_root/zpool_events/zpool_events_errors.ksh \ + functional/cli_root/zpool_events/zpool_events_follow.ksh \ + functional/cli_root/zpool_events/zpool_events_poolname.ksh \ + functional/cli_root/zpool_expand/cleanup.ksh \ + functional/cli_root/zpool_expand/setup.ksh \ + functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh \ + functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh \ + functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh \ + functional/cli_root/zpool_expand/zpool_expand_004_pos.ksh \ + functional/cli_root/zpool_expand/zpool_expand_005_pos.ksh \ + functional/cli_root/zpool_export/cleanup.ksh \ + functional/cli_root/zpool_export/setup.ksh \ + functional/cli_root/zpool_export/zpool_export_001_pos.ksh \ + functional/cli_root/zpool_export/zpool_export_002_pos.ksh \ + functional/cli_root/zpool_export/zpool_export_003_neg.ksh \ + functional/cli_root/zpool_export/zpool_export_004_pos.ksh \ + functional/cli_root/zpool_get/cleanup.ksh \ + functional/cli_root/zpool_get/setup.ksh \ + functional/cli_root/zpool_get/zpool_get_001_pos.ksh \ + functional/cli_root/zpool_get/zpool_get_002_pos.ksh \ + functional/cli_root/zpool_get/zpool_get_003_pos.ksh \ + functional/cli_root/zpool_get/zpool_get_004_neg.ksh \ + functional/cli_root/zpool_get/zpool_get_005_pos.ksh \ + functional/cli_root/zpool_history/cleanup.ksh \ + functional/cli_root/zpool_history/setup.ksh \ + functional/cli_root/zpool_history/zpool_history_001_neg.ksh \ + functional/cli_root/zpool_history/zpool_history_002_pos.ksh \ + functional/cli_root/zpool_import/cleanup.ksh \ + functional/cli_root/zpool_import/import_cachefile_device_added.ksh \ + functional/cli_root/zpool_import/import_cachefile_device_removed.ksh \ + functional/cli_root/zpool_import/import_cachefile_device_replaced.ksh \ + functional/cli_root/zpool_import/import_cachefile_mirror_attached.ksh \ + functional/cli_root/zpool_import/import_cachefile_mirror_detached.ksh \ + functional/cli_root/zpool_import/import_cachefile_paths_changed.ksh \ + functional/cli_root/zpool_import/import_cachefile_shared_device.ksh \ + functional/cli_root/zpool_import/import_devices_missing.ksh \ + functional/cli_root/zpool_import/import_paths_changed.ksh \ + functional/cli_root/zpool_import/import_rewind_config_changed.ksh \ + functional/cli_root/zpool_import/import_rewind_device_replaced.ksh \ + functional/cli_root/zpool_import/setup.ksh \ + functional/cli_root/zpool_import/zpool_import_001_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_002_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_003_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_004_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_005_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_006_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_007_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_008_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_009_neg.ksh \ + functional/cli_root/zpool_import/zpool_import_010_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_011_neg.ksh \ + functional/cli_root/zpool_import/zpool_import_012_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_013_neg.ksh \ + functional/cli_root/zpool_import/zpool_import_014_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_015_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_016_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_017_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_encrypted.ksh \ + functional/cli_root/zpool_import/zpool_import_encrypted_load.ksh \ + functional/cli_root/zpool_import/zpool_import_errata3.ksh \ + functional/cli_root/zpool_import/zpool_import_errata4.ksh \ + functional/cli_root/zpool_import/zpool_import_features_001_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_features_002_neg.ksh \ + functional/cli_root/zpool_import/zpool_import_features_003_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_missing_002_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh \ + functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh \ + functional/cli_root/zpool_initialize/cleanup.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_attach_detach_add_remove.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_fault_export_import_online.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_import_export.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_offline_export_import_online.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_online_offline.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_split.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_start_and_cancel_neg.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_start_and_cancel_pos.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_suspend_resume.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_unsupported_vdevs.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_verify_checksums.ksh \ + functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh \ + functional/cli_root/zpool_labelclear/zpool_labelclear_active.ksh \ + functional/cli_root/zpool_labelclear/zpool_labelclear_exported.ksh \ + functional/cli_root/zpool_labelclear/zpool_labelclear_removed.ksh \ + functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh \ + functional/cli_root/zpool_offline/cleanup.ksh \ + functional/cli_root/zpool_offline/setup.ksh \ + functional/cli_root/zpool_offline/zpool_offline_001_pos.ksh \ + functional/cli_root/zpool_offline/zpool_offline_002_neg.ksh \ + functional/cli_root/zpool_offline/zpool_offline_003_pos.ksh \ + functional/cli_root/zpool_online/cleanup.ksh \ + functional/cli_root/zpool_online/setup.ksh \ + functional/cli_root/zpool_online/zpool_online_001_pos.ksh \ + functional/cli_root/zpool_online/zpool_online_002_neg.ksh \ + functional/cli_root/zpool_remove/cleanup.ksh \ + functional/cli_root/zpool_remove/setup.ksh \ + functional/cli_root/zpool_remove/zpool_remove_001_neg.ksh \ + functional/cli_root/zpool_remove/zpool_remove_002_pos.ksh \ + functional/cli_root/zpool_remove/zpool_remove_003_pos.ksh \ + functional/cli_root/zpool_reopen/cleanup.ksh \ + functional/cli_root/zpool_reopen/setup.ksh \ + functional/cli_root/zpool_reopen/zpool_reopen_001_pos.ksh \ + functional/cli_root/zpool_reopen/zpool_reopen_002_pos.ksh \ + functional/cli_root/zpool_reopen/zpool_reopen_003_pos.ksh \ + functional/cli_root/zpool_reopen/zpool_reopen_004_pos.ksh \ + functional/cli_root/zpool_reopen/zpool_reopen_005_pos.ksh \ + functional/cli_root/zpool_reopen/zpool_reopen_006_neg.ksh \ + functional/cli_root/zpool_reopen/zpool_reopen_007_pos.ksh \ + functional/cli_root/zpool_replace/cleanup.ksh \ + functional/cli_root/zpool_replace/replace-o_ashift.ksh \ + functional/cli_root/zpool_replace/replace_prop_ashift.ksh \ + functional/cli_root/zpool_replace/setup.ksh \ + functional/cli_root/zpool_replace/zpool_replace_001_neg.ksh \ + functional/cli_root/zpool_resilver/cleanup.ksh \ + functional/cli_root/zpool_resilver/setup.ksh \ + functional/cli_root/zpool_resilver/zpool_resilver_bad_args.ksh \ + functional/cli_root/zpool_resilver/zpool_resilver_restart.ksh \ + functional/cli_root/zpool_scrub/cleanup.ksh \ + functional/cli_root/zpool_scrub/setup.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_001_neg.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_002_pos.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_003_pos.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_004_pos.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_005_pos.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_encrypted_unloaded.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_multiple_copies.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_offline_device.ksh \ + functional/cli_root/zpool_scrub/zpool_scrub_print_repairing.ksh \ + functional/cli_root/zpool_set/cleanup.ksh \ + functional/cli_root/zpool_set/setup.ksh \ + functional/cli_root/zpool/setup.ksh \ + functional/cli_root/zpool_set/zpool_set_001_pos.ksh \ + functional/cli_root/zpool_set/zpool_set_002_neg.ksh \ + functional/cli_root/zpool_set/zpool_set_003_neg.ksh \ + functional/cli_root/zpool_set/zpool_set_ashift.ksh \ + functional/cli_root/zpool_set/zpool_set_features.ksh \ + functional/cli_root/zpool_split/cleanup.ksh \ + functional/cli_root/zpool_split/setup.ksh \ + functional/cli_root/zpool_split/zpool_split_cliargs.ksh \ + functional/cli_root/zpool_split/zpool_split_devices.ksh \ + functional/cli_root/zpool_split/zpool_split_dryrun_output.ksh \ + functional/cli_root/zpool_split/zpool_split_encryption.ksh \ + functional/cli_root/zpool_split/zpool_split_indirect.ksh \ + functional/cli_root/zpool_split/zpool_split_props.ksh \ + functional/cli_root/zpool_split/zpool_split_resilver.ksh \ + functional/cli_root/zpool_split/zpool_split_vdevs.ksh \ + functional/cli_root/zpool_split/zpool_split_wholedisk.ksh \ + functional/cli_root/zpool_status/cleanup.ksh \ + functional/cli_root/zpool_status/setup.ksh \ + functional/cli_root/zpool_status/zpool_status_001_pos.ksh \ + functional/cli_root/zpool_status/zpool_status_002_pos.ksh \ + functional/cli_root/zpool_status/zpool_status_003_pos.ksh \ + functional/cli_root/zpool_status/zpool_status_004_pos.ksh \ + functional/cli_root/zpool_status/zpool_status_features_001_pos.ksh \ + functional/cli_root/zpool_sync/cleanup.ksh \ + functional/cli_root/zpool_sync/setup.ksh \ + functional/cli_root/zpool_sync/zpool_sync_001_pos.ksh \ + functional/cli_root/zpool_sync/zpool_sync_002_neg.ksh \ + functional/cli_root/zpool_trim/cleanup.ksh \ + functional/cli_root/zpool_trim/setup.ksh \ + functional/cli_root/zpool_trim/zpool_trim_attach_detach_add_remove.ksh \ + functional/cli_root/zpool_trim/zpool_trim_fault_export_import_online.ksh \ + functional/cli_root/zpool_trim/zpool_trim_import_export.ksh \ + functional/cli_root/zpool_trim/zpool_trim_multiple.ksh \ + functional/cli_root/zpool_trim/zpool_trim_neg.ksh \ + functional/cli_root/zpool_trim/zpool_trim_offline_export_import_online.ksh \ + functional/cli_root/zpool_trim/zpool_trim_online_offline.ksh \ + functional/cli_root/zpool_trim/zpool_trim_partial.ksh \ + functional/cli_root/zpool_trim/zpool_trim_rate.ksh \ + functional/cli_root/zpool_trim/zpool_trim_rate_neg.ksh \ + functional/cli_root/zpool_trim/zpool_trim_secure.ksh \ + functional/cli_root/zpool_trim/zpool_trim_split.ksh \ + functional/cli_root/zpool_trim/zpool_trim_start_and_cancel_neg.ksh \ + functional/cli_root/zpool_trim/zpool_trim_start_and_cancel_pos.ksh \ + functional/cli_root/zpool_trim/zpool_trim_suspend_resume.ksh \ + functional/cli_root/zpool_trim/zpool_trim_unsupported_vdevs.ksh \ + functional/cli_root/zpool_trim/zpool_trim_verify_checksums.ksh \ + functional/cli_root/zpool_trim/zpool_trim_verify_trimmed.ksh \ + functional/cli_root/zpool_upgrade/cleanup.ksh \ + functional/cli_root/zpool_upgrade/setup.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_001_pos.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_002_pos.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_003_pos.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_004_pos.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_005_neg.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_006_neg.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_007_pos.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_008_pos.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_009_neg.ksh \ + functional/cli_root/zpool_upgrade/zpool_upgrade_features_001_pos.ksh \ + functional/cli_root/zpool_wait/cleanup.ksh \ + functional/cli_root/zpool_wait/scan/cleanup.ksh \ + functional/cli_root/zpool_wait/scan/setup.ksh \ + functional/cli_root/zpool_wait/scan/zpool_wait_rebuild.ksh \ + functional/cli_root/zpool_wait/scan/zpool_wait_replace_cancel.ksh \ + functional/cli_root/zpool_wait/scan/zpool_wait_replace.ksh \ + functional/cli_root/zpool_wait/scan/zpool_wait_resilver.ksh \ + functional/cli_root/zpool_wait/scan/zpool_wait_scrub_basic.ksh \ + functional/cli_root/zpool_wait/scan/zpool_wait_scrub_cancel.ksh \ + functional/cli_root/zpool_wait/scan/zpool_wait_scrub_flag.ksh \ + functional/cli_root/zpool_wait/setup.ksh \ + functional/cli_root/zpool_wait/zpool_wait_discard.ksh \ + functional/cli_root/zpool_wait/zpool_wait_freeing.ksh \ + functional/cli_root/zpool_wait/zpool_wait_initialize_basic.ksh \ + functional/cli_root/zpool_wait/zpool_wait_initialize_cancel.ksh \ + functional/cli_root/zpool_wait/zpool_wait_initialize_flag.ksh \ + functional/cli_root/zpool_wait/zpool_wait_multiple.ksh \ + functional/cli_root/zpool_wait/zpool_wait_no_activity.ksh \ + functional/cli_root/zpool_wait/zpool_wait_remove_cancel.ksh \ + functional/cli_root/zpool_wait/zpool_wait_remove.ksh \ + functional/cli_root/zpool_wait/zpool_wait_trim_basic.ksh \ + functional/cli_root/zpool_wait/zpool_wait_trim_cancel.ksh \ + functional/cli_root/zpool_wait/zpool_wait_trim_flag.ksh \ + functional/cli_root/zpool_wait/zpool_wait_usage.ksh \ + functional/cli_root/zpool/zpool_001_neg.ksh \ + functional/cli_root/zpool/zpool_002_pos.ksh \ + functional/cli_root/zpool/zpool_003_pos.ksh \ + functional/cli_root/zpool/zpool_colors.ksh \ + functional/cli_user/misc/arcstat_001_pos.ksh \ + functional/cli_user/misc/arc_summary_001_pos.ksh \ + functional/cli_user/misc/arc_summary_002_neg.ksh \ + functional/cli_user/misc/cleanup.ksh \ + functional/cli_user/misc/setup.ksh \ + functional/cli_user/misc/zdb_001_neg.ksh \ + functional/cli_user/misc/zfs_001_neg.ksh \ + functional/cli_user/misc/zfs_allow_001_neg.ksh \ + functional/cli_user/misc/zfs_clone_001_neg.ksh \ + functional/cli_user/misc/zfs_create_001_neg.ksh \ + functional/cli_user/misc/zfs_destroy_001_neg.ksh \ + functional/cli_user/misc/zfs_get_001_neg.ksh \ + functional/cli_user/misc/zfs_inherit_001_neg.ksh \ + functional/cli_user/misc/zfs_mount_001_neg.ksh \ + functional/cli_user/misc/zfs_promote_001_neg.ksh \ + functional/cli_user/misc/zfs_receive_001_neg.ksh \ + functional/cli_user/misc/zfs_rename_001_neg.ksh \ + functional/cli_user/misc/zfs_rollback_001_neg.ksh \ + functional/cli_user/misc/zfs_send_001_neg.ksh \ + functional/cli_user/misc/zfs_set_001_neg.ksh \ + functional/cli_user/misc/zfs_share_001_neg.ksh \ + functional/cli_user/misc/zfs_snapshot_001_neg.ksh \ + functional/cli_user/misc/zfs_unallow_001_neg.ksh \ + functional/cli_user/misc/zfs_unmount_001_neg.ksh \ + functional/cli_user/misc/zfs_unshare_001_neg.ksh \ + functional/cli_user/misc/zfs_upgrade_001_neg.ksh \ + functional/cli_user/misc/zpool_001_neg.ksh \ + functional/cli_user/misc/zpool_add_001_neg.ksh \ + functional/cli_user/misc/zpool_attach_001_neg.ksh \ + functional/cli_user/misc/zpool_clear_001_neg.ksh \ + functional/cli_user/misc/zpool_create_001_neg.ksh \ + functional/cli_user/misc/zpool_destroy_001_neg.ksh \ + functional/cli_user/misc/zpool_detach_001_neg.ksh \ + functional/cli_user/misc/zpool_export_001_neg.ksh \ + functional/cli_user/misc/zpool_get_001_neg.ksh \ + functional/cli_user/misc/zpool_history_001_neg.ksh \ + functional/cli_user/misc/zpool_import_001_neg.ksh \ + functional/cli_user/misc/zpool_import_002_neg.ksh \ + functional/cli_user/misc/zpool_offline_001_neg.ksh \ + functional/cli_user/misc/zpool_online_001_neg.ksh \ + functional/cli_user/misc/zpool_remove_001_neg.ksh \ + functional/cli_user/misc/zpool_replace_001_neg.ksh \ + functional/cli_user/misc/zpool_scrub_001_neg.ksh \ + functional/cli_user/misc/zpool_set_001_neg.ksh \ + functional/cli_user/misc/zpool_status_001_neg.ksh \ + functional/cli_user/misc/zpool_upgrade_001_neg.ksh \ + functional/cli_user/misc/zpool_wait_privilege.ksh \ + functional/cli_user/zfs_list/cleanup.ksh \ + functional/cli_user/zfs_list/setup.ksh \ + functional/cli_user/zfs_list/zfs_list_001_pos.ksh \ + functional/cli_user/zfs_list/zfs_list_002_pos.ksh \ + functional/cli_user/zfs_list/zfs_list_003_pos.ksh \ + functional/cli_user/zfs_list/zfs_list_004_neg.ksh \ + functional/cli_user/zfs_list/zfs_list_005_neg.ksh \ + functional/cli_user/zfs_list/zfs_list_007_pos.ksh \ + functional/cli_user/zfs_list/zfs_list_008_neg.ksh \ + functional/cli_user/zpool_iostat/cleanup.ksh \ + functional/cli_user/zpool_iostat/setup.ksh \ + functional/cli_user/zpool_iostat/zpool_iostat_001_neg.ksh \ + functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh \ + functional/cli_user/zpool_iostat/zpool_iostat_003_neg.ksh \ + functional/cli_user/zpool_iostat/zpool_iostat_004_pos.ksh \ + functional/cli_user/zpool_iostat/zpool_iostat_005_pos.ksh \ + functional/cli_user/zpool_iostat/zpool_iostat_-c_disable.ksh \ + functional/cli_user/zpool_iostat/zpool_iostat_-c_homedir.ksh \ + functional/cli_user/zpool_iostat/zpool_iostat_-c_searchpath.ksh \ + functional/cli_user/zpool_list/cleanup.ksh \ + functional/cli_user/zpool_list/setup.ksh \ + functional/cli_user/zpool_list/zpool_list_001_pos.ksh \ + functional/cli_user/zpool_list/zpool_list_002_neg.ksh \ + functional/cli_user/zpool_status/cleanup.ksh \ + functional/cli_user/zpool_status/setup.ksh \ + functional/cli_user/zpool_status/zpool_status_003_pos.ksh \ + functional/cli_user/zpool_status/zpool_status_-c_disable.ksh \ + functional/cli_user/zpool_status/zpool_status_-c_homedir.ksh \ + functional/cli_user/zpool_status/zpool_status_-c_searchpath.ksh \ + functional/compression/cleanup.ksh \ + functional/compression/compress_001_pos.ksh \ + functional/compression/compress_002_pos.ksh \ + functional/compression/compress_003_pos.ksh \ + functional/compression/compress_004_pos.ksh \ + functional/compression/compress_zstd_bswap.ksh \ + functional/compression/l2arc_compressed_arc_disabled.ksh \ + functional/compression/l2arc_compressed_arc.ksh \ + functional/compression/l2arc_encrypted.ksh \ + functional/compression/l2arc_encrypted_no_compressed_arc.ksh \ + functional/compression/setup.ksh \ + functional/cp_files/cleanup.ksh \ + functional/cp_files/cp_files_001_pos.ksh \ + functional/cp_files/setup.ksh \ + functional/crtime/cleanup.ksh \ + functional/crtime/crtime_001_pos.ksh \ + functional/crtime/setup.ksh \ + functional/ctime/cleanup.ksh \ + functional/ctime/ctime_001_pos.ksh \ + functional/ctime/setup.ksh \ + functional/deadman/deadman_ratelimit.ksh \ + functional/deadman/deadman_sync.ksh \ + functional/deadman/deadman_zio.ksh \ + functional/delegate/cleanup.ksh \ + functional/delegate/setup.ksh \ + functional/delegate/zfs_allow_001_pos.ksh \ + functional/delegate/zfs_allow_002_pos.ksh \ + functional/delegate/zfs_allow_003_pos.ksh \ + functional/delegate/zfs_allow_004_pos.ksh \ + functional/delegate/zfs_allow_005_pos.ksh \ + functional/delegate/zfs_allow_006_pos.ksh \ + functional/delegate/zfs_allow_007_pos.ksh \ + functional/delegate/zfs_allow_008_pos.ksh \ + functional/delegate/zfs_allow_009_neg.ksh \ + functional/delegate/zfs_allow_010_pos.ksh \ + functional/delegate/zfs_allow_011_neg.ksh \ + functional/delegate/zfs_allow_012_neg.ksh \ + functional/delegate/zfs_unallow_001_pos.ksh \ + functional/delegate/zfs_unallow_002_pos.ksh \ + functional/delegate/zfs_unallow_003_pos.ksh \ + functional/delegate/zfs_unallow_004_pos.ksh \ + functional/delegate/zfs_unallow_005_pos.ksh \ + functional/delegate/zfs_unallow_006_pos.ksh \ + functional/delegate/zfs_unallow_007_neg.ksh \ + functional/delegate/zfs_unallow_008_neg.ksh \ + functional/devices/cleanup.ksh \ + functional/devices/devices_001_pos.ksh \ + functional/devices/devices_002_neg.ksh \ + functional/devices/devices_003_pos.ksh \ + functional/devices/setup.ksh \ + functional/dos_attributes/cleanup.ksh \ + functional/dos_attributes/read_dos_attrs_001.ksh \ + functional/dos_attributes/setup.ksh \ + functional/dos_attributes/write_dos_attrs_001.ksh \ + functional/events/cleanup.ksh \ + functional/events/events_001_pos.ksh \ + functional/events/events_002_pos.ksh \ + functional/events/setup.ksh \ + functional/events/zed_fd_spill.ksh \ + functional/events/zed_rc_filter.ksh \ + functional/exec/cleanup.ksh \ + functional/exec/exec_001_pos.ksh \ + functional/exec/exec_002_neg.ksh \ + functional/exec/setup.ksh \ + functional/fallocate/cleanup.ksh \ + functional/fallocate/fallocate_prealloc.ksh \ + functional/fallocate/fallocate_punch-hole.ksh \ + functional/fallocate/fallocate_zero-range.ksh \ + functional/fallocate/setup.ksh \ + functional/fault/auto_offline_001_pos.ksh \ + functional/fault/auto_online_001_pos.ksh \ + functional/fault/auto_online_002_pos.ksh \ + functional/fault/auto_replace_001_pos.ksh \ + functional/fault/auto_spare_001_pos.ksh \ + functional/fault/auto_spare_002_pos.ksh \ + functional/fault/auto_spare_ashift.ksh \ + functional/fault/auto_spare_multiple.ksh \ + functional/fault/auto_spare_shared.ksh \ + functional/fault/cleanup.ksh \ + functional/fault/decompress_fault.ksh \ + functional/fault/decrypt_fault.ksh \ + functional/fault/scrub_after_resilver.ksh \ + functional/fault/setup.ksh \ + functional/fault/zpool_status_-s.ksh \ + functional/features/async_destroy/async_destroy_001_pos.ksh \ + functional/features/async_destroy/cleanup.ksh \ + functional/features/async_destroy/setup.ksh \ + functional/features/large_dnode/cleanup.ksh \ + functional/features/large_dnode/large_dnode_001_pos.ksh \ + functional/features/large_dnode/large_dnode_002_pos.ksh \ + functional/features/large_dnode/large_dnode_003_pos.ksh \ + functional/features/large_dnode/large_dnode_004_neg.ksh \ + functional/features/large_dnode/large_dnode_005_pos.ksh \ + functional/features/large_dnode/large_dnode_006_pos.ksh \ + functional/features/large_dnode/large_dnode_007_neg.ksh \ + functional/features/large_dnode/large_dnode_008_pos.ksh \ + functional/features/large_dnode/large_dnode_009_pos.ksh \ + functional/features/large_dnode/setup.ksh \ + functional/grow/grow_pool_001_pos.ksh \ + functional/grow/grow_replicas_001_pos.ksh \ + functional/history/cleanup.ksh \ + functional/history/history_001_pos.ksh \ + functional/history/history_002_pos.ksh \ + functional/history/history_003_pos.ksh \ + functional/history/history_004_pos.ksh \ + functional/history/history_005_neg.ksh \ + functional/history/history_006_neg.ksh \ + functional/history/history_007_pos.ksh \ + functional/history/history_008_pos.ksh \ + functional/history/history_009_pos.ksh \ + functional/history/history_010_pos.ksh \ + functional/history/setup.ksh \ + functional/inheritance/cleanup.ksh \ + functional/inheritance/inherit_001_pos.ksh \ + functional/inuse/inuse_001_pos.ksh \ + functional/inuse/inuse_003_pos.ksh \ + functional/inuse/inuse_004_pos.ksh \ + functional/inuse/inuse_005_pos.ksh \ + functional/inuse/inuse_006_pos.ksh \ + functional/inuse/inuse_007_pos.ksh \ + functional/inuse/inuse_008_pos.ksh \ + functional/inuse/inuse_009_pos.ksh \ + functional/inuse/setup.ksh \ + functional/io/cleanup.ksh \ + functional/io/io_uring.ksh \ + functional/io/libaio.ksh \ + functional/io/mmap.ksh \ + functional/io/posixaio.ksh \ + functional/io/psync.ksh \ + functional/io/setup.ksh \ + functional/io/sync.ksh \ + functional/l2arc/cleanup.ksh \ + functional/l2arc/l2arc_arcstats_pos.ksh \ + functional/l2arc/l2arc_l2miss_pos.ksh \ + functional/l2arc/l2arc_mfuonly_pos.ksh \ + functional/l2arc/persist_l2arc_001_pos.ksh \ + functional/l2arc/persist_l2arc_002_pos.ksh \ + functional/l2arc/persist_l2arc_003_neg.ksh \ + functional/l2arc/persist_l2arc_004_pos.ksh \ + functional/l2arc/persist_l2arc_005_pos.ksh \ + functional/l2arc/setup.ksh \ + functional/large_files/cleanup.ksh \ + functional/large_files/large_files_001_pos.ksh \ + functional/large_files/large_files_002_pos.ksh \ + functional/large_files/setup.ksh \ + functional/largest_pool/largest_pool_001_pos.ksh \ + functional/libzfs/cleanup.ksh \ + functional/libzfs/libzfs_input.ksh \ + functional/libzfs/setup.ksh \ + functional/limits/cleanup.ksh \ + functional/limits/filesystem_count.ksh \ + functional/limits/filesystem_limit.ksh \ + functional/limits/setup.ksh \ + functional/limits/snapshot_count.ksh \ + functional/limits/snapshot_limit.ksh \ + functional/link_count/cleanup.ksh \ + functional/link_count/link_count_001.ksh \ + functional/link_count/link_count_root_inode.ksh \ + functional/link_count/setup.ksh \ + functional/log_spacemap/log_spacemap_import_logs.ksh \ + functional/migration/cleanup.ksh \ + functional/migration/migration_001_pos.ksh \ + functional/migration/migration_002_pos.ksh \ + functional/migration/migration_003_pos.ksh \ + functional/migration/migration_004_pos.ksh \ + functional/migration/migration_005_pos.ksh \ + functional/migration/migration_006_pos.ksh \ + functional/migration/migration_007_pos.ksh \ + functional/migration/migration_008_pos.ksh \ + functional/migration/migration_009_pos.ksh \ + functional/migration/migration_010_pos.ksh \ + functional/migration/migration_011_pos.ksh \ + functional/migration/migration_012_pos.ksh \ + functional/migration/setup.ksh \ + functional/mmap/cleanup.ksh \ + functional/mmap/mmap_libaio_001_pos.ksh \ + functional/mmap/mmap_read_001_pos.ksh \ + functional/mmap/mmap_seek_001_pos.ksh \ + functional/mmap/mmap_sync_001_pos.ksh \ + functional/mmap/mmap_write_001_pos.ksh \ + functional/mmap/setup.ksh \ + functional/mmp/cleanup.ksh \ + functional/mmp/mmp_active_import.ksh \ + functional/mmp/mmp_exported_import.ksh \ + functional/mmp/mmp_hostid.ksh \ + functional/mmp/mmp_inactive_import.ksh \ + functional/mmp/mmp_interval.ksh \ + functional/mmp/mmp_on_off.ksh \ + functional/mmp/mmp_on_thread.ksh \ + functional/mmp/mmp_on_uberblocks.ksh \ + functional/mmp/mmp_on_zdb.ksh \ + functional/mmp/mmp_reset_interval.ksh \ + functional/mmp/mmp_write_distribution.ksh \ + functional/mmp/mmp_write_uberblocks.ksh \ + functional/mmp/multihost_history.ksh \ + functional/mmp/setup.ksh \ + functional/mount/cleanup.ksh \ + functional/mount/setup.ksh \ + functional/mount/umount_001.ksh \ + functional/mount/umountall_001.ksh \ + functional/mount/umount_unlinked_drain.ksh \ + functional/mv_files/cleanup.ksh \ + functional/mv_files/mv_files_001_pos.ksh \ + functional/mv_files/mv_files_002_pos.ksh \ + functional/mv_files/random_creation.ksh \ + functional/mv_files/setup.ksh \ + functional/nestedfs/cleanup.ksh \ + functional/nestedfs/nestedfs_001_pos.ksh \ + functional/nestedfs/setup.ksh \ + functional/nopwrite/cleanup.ksh \ + functional/nopwrite/nopwrite_copies.ksh \ + functional/nopwrite/nopwrite_mtime.ksh \ + functional/nopwrite/nopwrite_negative.ksh \ + functional/nopwrite/nopwrite_promoted_clone.ksh \ + functional/nopwrite/nopwrite_recsize.ksh \ + functional/nopwrite/nopwrite_sync.ksh \ + functional/nopwrite/nopwrite_varying_compression.ksh \ + functional/nopwrite/nopwrite_volume.ksh \ + functional/nopwrite/setup.ksh \ + functional/no_space/cleanup.ksh \ + functional/no_space/enospc_001_pos.ksh \ + functional/no_space/enospc_002_pos.ksh \ + functional/no_space/enospc_003_pos.ksh \ + functional/no_space/enospc_df.ksh \ + functional/no_space/enospc_rm.ksh \ + functional/no_space/setup.ksh \ + functional/online_offline/cleanup.ksh \ + functional/online_offline/online_offline_001_pos.ksh \ + functional/online_offline/online_offline_002_neg.ksh \ + functional/online_offline/online_offline_003_neg.ksh \ + functional/online_offline/setup.ksh \ + functional/pam/cleanup.ksh \ + functional/pam/pam_basic.ksh \ + functional/pam/pam_nounmount.ksh \ + functional/pam/pam_short_password.ksh \ + functional/pam/setup.ksh \ + functional/pool_checkpoint/checkpoint_after_rewind.ksh \ + functional/pool_checkpoint/checkpoint_big_rewind.ksh \ + functional/pool_checkpoint/checkpoint_capacity.ksh \ + functional/pool_checkpoint/checkpoint_conf_change.ksh \ + functional/pool_checkpoint/checkpoint_discard_busy.ksh \ + functional/pool_checkpoint/checkpoint_discard.ksh \ + functional/pool_checkpoint/checkpoint_discard_many.ksh \ + functional/pool_checkpoint/checkpoint_indirect.ksh \ + functional/pool_checkpoint/checkpoint_invalid.ksh \ + functional/pool_checkpoint/checkpoint_lun_expsz.ksh \ + functional/pool_checkpoint/checkpoint_open.ksh \ + functional/pool_checkpoint/checkpoint_removal.ksh \ + functional/pool_checkpoint/checkpoint_rewind.ksh \ + functional/pool_checkpoint/checkpoint_ro_rewind.ksh \ + functional/pool_checkpoint/checkpoint_sm_scale.ksh \ + functional/pool_checkpoint/checkpoint_twice.ksh \ + functional/pool_checkpoint/checkpoint_vdev_add.ksh \ + functional/pool_checkpoint/checkpoint_zdb.ksh \ + functional/pool_checkpoint/checkpoint_zhack_feat.ksh \ + functional/pool_checkpoint/cleanup.ksh \ + functional/pool_checkpoint/setup.ksh \ + functional/pool_names/pool_names_001_pos.ksh \ + functional/pool_names/pool_names_002_neg.ksh \ + functional/poolversion/cleanup.ksh \ + functional/poolversion/poolversion_001_pos.ksh \ + functional/poolversion/poolversion_002_pos.ksh \ + functional/poolversion/setup.ksh \ + functional/privilege/cleanup.ksh \ + functional/privilege/privilege_001_pos.ksh \ + functional/privilege/privilege_002_pos.ksh \ + functional/privilege/setup.ksh \ + functional/procfs/cleanup.ksh \ + functional/procfs/pool_state.ksh \ + functional/procfs/procfs_list_basic.ksh \ + functional/procfs/procfs_list_concurrent_readers.ksh \ + functional/procfs/procfs_list_stale_read.ksh \ + functional/procfs/setup.ksh \ + functional/projectquota/cleanup.ksh \ + functional/projectquota/projectid_001_pos.ksh \ + functional/projectquota/projectid_002_pos.ksh \ + functional/projectquota/projectid_003_pos.ksh \ + functional/projectquota/projectquota_001_pos.ksh \ + functional/projectquota/projectquota_002_pos.ksh \ + functional/projectquota/projectquota_003_pos.ksh \ + functional/projectquota/projectquota_004_neg.ksh \ + functional/projectquota/projectquota_005_pos.ksh \ + functional/projectquota/projectquota_006_pos.ksh \ + functional/projectquota/projectquota_007_pos.ksh \ + functional/projectquota/projectquota_008_pos.ksh \ + functional/projectquota/projectquota_009_pos.ksh \ + functional/projectquota/projectspace_001_pos.ksh \ + functional/projectquota/projectspace_002_pos.ksh \ + functional/projectquota/projectspace_003_pos.ksh \ + functional/projectquota/projectspace_004_pos.ksh \ + functional/projectquota/projecttree_001_pos.ksh \ + functional/projectquota/projecttree_002_pos.ksh \ + functional/projectquota/projecttree_003_neg.ksh \ + functional/projectquota/setup.ksh \ + functional/quota/cleanup.ksh \ + functional/quota/quota_001_pos.ksh \ + functional/quota/quota_002_pos.ksh \ + functional/quota/quota_003_pos.ksh \ + functional/quota/quota_004_pos.ksh \ + functional/quota/quota_005_pos.ksh \ + functional/quota/quota_006_neg.ksh \ + functional/quota/setup.ksh \ + functional/raidz/cleanup.ksh \ + functional/raidz/raidz_001_neg.ksh \ + functional/raidz/raidz_002_pos.ksh \ + functional/raidz/raidz_003_pos.ksh \ + functional/raidz/raidz_004_pos.ksh \ + functional/raidz/setup.ksh \ + functional/redacted_send/cleanup.ksh \ + functional/redacted_send/redacted_compressed.ksh \ + functional/redacted_send/redacted_contents.ksh \ + functional/redacted_send/redacted_deleted.ksh \ + functional/redacted_send/redacted_disabled_feature.ksh \ + functional/redacted_send/redacted_embedded.ksh \ + functional/redacted_send/redacted_holes.ksh \ + functional/redacted_send/redacted_incrementals.ksh \ + functional/redacted_send/redacted_largeblocks.ksh \ + functional/redacted_send/redacted_many_clones.ksh \ + functional/redacted_send/redacted_mixed_recsize.ksh \ + functional/redacted_send/redacted_mounts.ksh \ + functional/redacted_send/redacted_negative.ksh \ + functional/redacted_send/redacted_origin.ksh \ + functional/redacted_send/redacted_panic.ksh \ + functional/redacted_send/redacted_props.ksh \ + functional/redacted_send/redacted_resume.ksh \ + functional/redacted_send/redacted_size.ksh \ + functional/redacted_send/redacted_volume.ksh \ + functional/redacted_send/setup.ksh \ + functional/redundancy/cleanup.ksh \ + functional/redundancy/redundancy_draid1.ksh \ + functional/redundancy/redundancy_draid2.ksh \ + functional/redundancy/redundancy_draid3.ksh \ + functional/redundancy/redundancy_draid_damaged.ksh \ + functional/redundancy/redundancy_draid.ksh \ + functional/redundancy/redundancy_draid_spare1.ksh \ + functional/redundancy/redundancy_draid_spare2.ksh \ + functional/redundancy/redundancy_draid_spare3.ksh \ + functional/redundancy/redundancy_mirror.ksh \ + functional/redundancy/redundancy_raidz1.ksh \ + functional/redundancy/redundancy_raidz2.ksh \ + functional/redundancy/redundancy_raidz3.ksh \ + functional/redundancy/redundancy_raidz.ksh \ + functional/redundancy/redundancy_stripe.ksh \ + functional/redundancy/setup.ksh \ + functional/refquota/cleanup.ksh \ + functional/refquota/refquota_001_pos.ksh \ + functional/refquota/refquota_002_pos.ksh \ + functional/refquota/refquota_003_pos.ksh \ + functional/refquota/refquota_004_pos.ksh \ + functional/refquota/refquota_005_pos.ksh \ + functional/refquota/refquota_006_neg.ksh \ + functional/refquota/refquota_007_neg.ksh \ + functional/refquota/refquota_008_neg.ksh \ + functional/refquota/setup.ksh \ + functional/refreserv/cleanup.ksh \ + functional/refreserv/refreserv_001_pos.ksh \ + functional/refreserv/refreserv_002_pos.ksh \ + functional/refreserv/refreserv_003_pos.ksh \ + functional/refreserv/refreserv_004_pos.ksh \ + functional/refreserv/refreserv_005_pos.ksh \ + functional/refreserv/refreserv_multi_raidz.ksh \ + functional/refreserv/refreserv_raidz.ksh \ + functional/refreserv/setup.ksh \ + functional/removal/cleanup.ksh \ + functional/removal/removal_all_vdev.ksh \ + functional/removal/removal_cancel.ksh \ + functional/removal/removal_check_space.ksh \ + functional/removal/removal_condense_export.ksh \ + functional/removal/removal_multiple_indirection.ksh \ + functional/removal/removal_nopwrite.ksh \ + functional/removal/removal_remap_deadlists.ksh \ + functional/removal/removal_reservation.ksh \ + functional/removal/removal_resume_export.ksh \ + functional/removal/removal_sanity.ksh \ + functional/removal/removal_with_add.ksh \ + functional/removal/removal_with_create_fs.ksh \ + functional/removal/removal_with_dedup.ksh \ + functional/removal/removal_with_errors.ksh \ + functional/removal/removal_with_export.ksh \ + functional/removal/removal_with_faulted.ksh \ + functional/removal/removal_with_ganging.ksh \ + functional/removal/removal_with_remove.ksh \ + functional/removal/removal_with_scrub.ksh \ + functional/removal/removal_with_send.ksh \ + functional/removal/removal_with_send_recv.ksh \ + functional/removal/removal_with_snapshot.ksh \ + functional/removal/removal_with_write.ksh \ + functional/removal/removal_with_zdb.ksh \ + functional/removal/remove_attach_mirror.ksh \ + functional/removal/remove_expanded.ksh \ + functional/removal/remove_indirect.ksh \ + functional/removal/remove_mirror.ksh \ + functional/removal/remove_mirror_sanity.ksh \ + functional/removal/remove_raidz.ksh \ + functional/rename_dirs/cleanup.ksh \ + functional/rename_dirs/rename_dirs_001_pos.ksh \ + functional/rename_dirs/setup.ksh \ + functional/replacement/attach_import.ksh \ + functional/replacement/attach_multiple.ksh \ + functional/replacement/attach_rebuild.ksh \ + functional/replacement/attach_resilver.ksh \ + functional/replacement/cleanup.ksh \ + functional/replacement/detach.ksh \ + functional/replacement/rebuild_disabled_feature.ksh \ + functional/replacement/rebuild_multiple.ksh \ + functional/replacement/rebuild_raidz.ksh \ + functional/replacement/replace_import.ksh \ + functional/replacement/replace_rebuild.ksh \ + functional/replacement/replace_resilver.ksh \ + functional/replacement/resilver_restart_001.ksh \ + functional/replacement/resilver_restart_002.ksh \ + functional/replacement/scrub_cancel.ksh \ + functional/replacement/setup.ksh \ + functional/reservation/cleanup.ksh \ + functional/reservation/reservation_001_pos.ksh \ + functional/reservation/reservation_002_pos.ksh \ + functional/reservation/reservation_003_pos.ksh \ + functional/reservation/reservation_004_pos.ksh \ + functional/reservation/reservation_005_pos.ksh \ + functional/reservation/reservation_006_pos.ksh \ + functional/reservation/reservation_007_pos.ksh \ + functional/reservation/reservation_008_pos.ksh \ + functional/reservation/reservation_009_pos.ksh \ + functional/reservation/reservation_010_pos.ksh \ + functional/reservation/reservation_011_pos.ksh \ + functional/reservation/reservation_012_pos.ksh \ + functional/reservation/reservation_013_pos.ksh \ + functional/reservation/reservation_014_pos.ksh \ + functional/reservation/reservation_015_pos.ksh \ + functional/reservation/reservation_016_pos.ksh \ + functional/reservation/reservation_017_pos.ksh \ + functional/reservation/reservation_018_pos.ksh \ + functional/reservation/reservation_019_pos.ksh \ + functional/reservation/reservation_020_pos.ksh \ + functional/reservation/reservation_021_neg.ksh \ + functional/reservation/reservation_022_pos.ksh \ + functional/reservation/setup.ksh \ + functional/rootpool/cleanup.ksh \ + functional/rootpool/rootpool_002_neg.ksh \ + functional/rootpool/rootpool_003_neg.ksh \ + functional/rootpool/rootpool_007_pos.ksh \ + functional/rootpool/setup.ksh \ + functional/rsend/cleanup.ksh \ + functional/rsend/recv_dedup_encrypted_zvol.ksh \ + functional/rsend/recv_dedup.ksh \ + functional/rsend/rsend_001_pos.ksh \ + functional/rsend/rsend_002_pos.ksh \ + functional/rsend/rsend_003_pos.ksh \ + functional/rsend/rsend_004_pos.ksh \ + functional/rsend/rsend_005_pos.ksh \ + functional/rsend/rsend_006_pos.ksh \ + functional/rsend/rsend_007_pos.ksh \ + functional/rsend/rsend_008_pos.ksh \ + functional/rsend/rsend_009_pos.ksh \ + functional/rsend/rsend_010_pos.ksh \ + functional/rsend/rsend_011_pos.ksh \ + functional/rsend/rsend_012_pos.ksh \ + functional/rsend/rsend_013_pos.ksh \ + functional/rsend/rsend_014_pos.ksh \ + functional/rsend/rsend_016_neg.ksh \ + functional/rsend/rsend_019_pos.ksh \ + functional/rsend/rsend_020_pos.ksh \ + functional/rsend/rsend_021_pos.ksh \ + functional/rsend/rsend_022_pos.ksh \ + functional/rsend/rsend_024_pos.ksh \ + functional/rsend/rsend_025_pos.ksh \ + functional/rsend/rsend_026_neg.ksh \ + functional/rsend/rsend_027_pos.ksh \ + functional/rsend/rsend_028_neg.ksh \ + functional/rsend/rsend_029_neg.ksh \ + functional/rsend/send-c_embedded_blocks.ksh \ + functional/rsend/send-c_incremental.ksh \ + functional/rsend/send-c_lz4_disabled.ksh \ + functional/rsend/send-c_mixed_compression.ksh \ + functional/rsend/send-cpL_varied_recsize.ksh \ + functional/rsend/send-c_props.ksh \ + functional/rsend/send-c_recv_dedup.ksh \ + functional/rsend/send-c_recv_lz4_disabled.ksh \ + functional/rsend/send-c_resume.ksh \ + functional/rsend/send-c_stream_size_estimate.ksh \ + functional/rsend/send-c_verify_contents.ksh \ + functional/rsend/send-c_verify_ratio.ksh \ + functional/rsend/send-c_volume.ksh \ + functional/rsend/send-c_zstreamdump.ksh \ + functional/rsend/send_doall.ksh \ + functional/rsend/send_encrypted_files.ksh \ + functional/rsend/send_encrypted_hierarchy.ksh \ + functional/rsend/send_encrypted_props.ksh \ + functional/rsend/send_encrypted_truncated_files.ksh \ + functional/rsend/send_freeobjects.ksh \ + functional/rsend/send_holds.ksh \ + functional/rsend/send_hole_birth.ksh \ + functional/rsend/send_invalid.ksh \ + functional/rsend/send-L_toggle.ksh \ + functional/rsend/send_mixed_raw.ksh \ + functional/rsend/send_partial_dataset.ksh \ + functional/rsend/send_raw_ashift.ksh \ + functional/rsend/send_raw_spill_block.ksh \ + functional/rsend/send_realloc_dnode_size.ksh \ + functional/rsend/send_realloc_encrypted_files.ksh \ + functional/rsend/send_realloc_files.ksh \ + functional/rsend/send_spill_block.ksh \ + functional/rsend/send-wR_encrypted_zvol.ksh \ + functional/rsend/setup.ksh \ + functional/scrub_mirror/cleanup.ksh \ + functional/scrub_mirror/scrub_mirror_001_pos.ksh \ + functional/scrub_mirror/scrub_mirror_002_pos.ksh \ + functional/scrub_mirror/scrub_mirror_003_pos.ksh \ + functional/scrub_mirror/scrub_mirror_004_pos.ksh \ + functional/scrub_mirror/setup.ksh \ + functional/slog/cleanup.ksh \ + functional/slog/setup.ksh \ + functional/slog/slog_001_pos.ksh \ + functional/slog/slog_002_pos.ksh \ + functional/slog/slog_003_pos.ksh \ + functional/slog/slog_004_pos.ksh \ + functional/slog/slog_005_pos.ksh \ + functional/slog/slog_006_pos.ksh \ + functional/slog/slog_007_pos.ksh \ + functional/slog/slog_008_neg.ksh \ + functional/slog/slog_009_neg.ksh \ + functional/slog/slog_010_neg.ksh \ + functional/slog/slog_011_neg.ksh \ + functional/slog/slog_012_neg.ksh \ + functional/slog/slog_013_pos.ksh \ + functional/slog/slog_014_pos.ksh \ + functional/slog/slog_015_neg.ksh \ + functional/slog/slog_016_pos.ksh \ + functional/slog/slog_replay_fs_001.ksh \ + functional/slog/slog_replay_fs_002.ksh \ + functional/slog/slog_replay_volume.ksh \ + functional/snapshot/cleanup.ksh \ + functional/snapshot/clone_001_pos.ksh \ + functional/snapshot/rollback_001_pos.ksh \ + functional/snapshot/rollback_002_pos.ksh \ + functional/snapshot/rollback_003_pos.ksh \ + functional/snapshot/setup.ksh \ + functional/snapshot/snapshot_001_pos.ksh \ + functional/snapshot/snapshot_002_pos.ksh \ + functional/snapshot/snapshot_003_pos.ksh \ + functional/snapshot/snapshot_004_pos.ksh \ + functional/snapshot/snapshot_005_pos.ksh \ + functional/snapshot/snapshot_006_pos.ksh \ + functional/snapshot/snapshot_007_pos.ksh \ + functional/snapshot/snapshot_008_pos.ksh \ + functional/snapshot/snapshot_009_pos.ksh \ + functional/snapshot/snapshot_010_pos.ksh \ + functional/snapshot/snapshot_011_pos.ksh \ + functional/snapshot/snapshot_012_pos.ksh \ + functional/snapshot/snapshot_013_pos.ksh \ + functional/snapshot/snapshot_014_pos.ksh \ + functional/snapshot/snapshot_015_pos.ksh \ + functional/snapshot/snapshot_016_pos.ksh \ + functional/snapshot/snapshot_017_pos.ksh \ + functional/snapused/cleanup.ksh \ + functional/snapused/setup.ksh \ + functional/snapused/snapused_001_pos.ksh \ + functional/snapused/snapused_002_pos.ksh \ + functional/snapused/snapused_003_pos.ksh \ + functional/snapused/snapused_004_pos.ksh \ + functional/snapused/snapused_005_pos.ksh \ + functional/sparse/cleanup.ksh \ + functional/sparse/setup.ksh \ + functional/sparse/sparse_001_pos.ksh \ + functional/stat/cleanup.ksh \ + functional/stat/setup.ksh \ + functional/stat/stat_001_pos.ksh \ + functional/suid/cleanup.ksh \ + functional/suid/setup.ksh \ + functional/suid/suid_write_to_none.ksh \ + functional/suid/suid_write_to_sgid.ksh \ + functional/suid/suid_write_to_suid.ksh \ + functional/suid/suid_write_to_suid_sgid.ksh \ + functional/suid/suid_write_zil_replay.ksh \ + functional/threadsappend/cleanup.ksh \ + functional/threadsappend/setup.ksh \ + functional/threadsappend/threadsappend_001_pos.ksh \ + functional/trim/autotrim_config.ksh \ + functional/trim/autotrim_integrity.ksh \ + functional/trim/autotrim_trim_integrity.ksh \ + functional/trim/cleanup.ksh \ + functional/trim/setup.ksh \ + functional/trim/trim_config.ksh \ + functional/trim/trim_integrity.ksh \ + functional/trim/trim_l2arc.ksh \ + functional/truncate/cleanup.ksh \ + functional/truncate/setup.ksh \ + functional/truncate/truncate_001_pos.ksh \ + functional/truncate/truncate_002_pos.ksh \ + functional/truncate/truncate_timestamps.ksh \ + functional/upgrade/cleanup.ksh \ + functional/upgrade/setup.ksh \ + functional/upgrade/upgrade_projectquota_001_pos.ksh \ + functional/upgrade/upgrade_readonly_pool.ksh \ + functional/upgrade/upgrade_userobj_001_pos.ksh \ + functional/user_namespace/cleanup.ksh \ + functional/user_namespace/setup.ksh \ + functional/user_namespace/user_namespace_001.ksh \ + functional/userquota/cleanup.ksh \ + functional/userquota/groupspace_001_pos.ksh \ + functional/userquota/groupspace_002_pos.ksh \ + functional/userquota/groupspace_003_pos.ksh \ + functional/userquota/setup.ksh \ + functional/userquota/userquota_001_pos.ksh \ + functional/userquota/userquota_002_pos.ksh \ + functional/userquota/userquota_003_pos.ksh \ + functional/userquota/userquota_004_pos.ksh \ + functional/userquota/userquota_005_neg.ksh \ + functional/userquota/userquota_006_pos.ksh \ + functional/userquota/userquota_007_pos.ksh \ + functional/userquota/userquota_008_pos.ksh \ + functional/userquota/userquota_009_pos.ksh \ + functional/userquota/userquota_010_pos.ksh \ + functional/userquota/userquota_011_pos.ksh \ + functional/userquota/userquota_012_neg.ksh \ + functional/userquota/userquota_013_pos.ksh \ + functional/userquota/userspace_001_pos.ksh \ + functional/userquota/userspace_002_pos.ksh \ + functional/userquota/userspace_003_pos.ksh \ + functional/userquota/userspace_encrypted.ksh \ + functional/userquota/userspace_send_encrypted.ksh \ + functional/vdev_zaps/cleanup.ksh \ + functional/vdev_zaps/setup.ksh \ + functional/vdev_zaps/vdev_zaps_001_pos.ksh \ + functional/vdev_zaps/vdev_zaps_002_pos.ksh \ + functional/vdev_zaps/vdev_zaps_003_pos.ksh \ + functional/vdev_zaps/vdev_zaps_004_pos.ksh \ + functional/vdev_zaps/vdev_zaps_005_pos.ksh \ + functional/vdev_zaps/vdev_zaps_006_pos.ksh \ + functional/vdev_zaps/vdev_zaps_007_pos.ksh \ + functional/write_dirs/cleanup.ksh \ + functional/write_dirs/setup.ksh \ + functional/write_dirs/write_dirs_001_pos.ksh \ + functional/write_dirs/write_dirs_002_pos.ksh \ + functional/xattr/cleanup.ksh \ + functional/xattr/setup.ksh \ + functional/xattr/xattr_001_pos.ksh \ + functional/xattr/xattr_002_neg.ksh \ + functional/xattr/xattr_003_neg.ksh \ + functional/xattr/xattr_004_pos.ksh \ + functional/xattr/xattr_005_pos.ksh \ + functional/xattr/xattr_006_pos.ksh \ + functional/xattr/xattr_007_neg.ksh \ + functional/xattr/xattr_008_pos.ksh \ + functional/xattr/xattr_009_neg.ksh \ + functional/xattr/xattr_010_neg.ksh \ + functional/xattr/xattr_011_pos.ksh \ + functional/xattr/xattr_012_pos.ksh \ + functional/xattr/xattr_013_pos.ksh \ + functional/xattr/xattr_compat.ksh \ + functional/zpool_influxdb/cleanup.ksh \ + functional/zpool_influxdb/setup.ksh \ + functional/zpool_influxdb/zpool_influxdb.ksh \ + functional/zvol/zvol_cli/cleanup.ksh \ + functional/zvol/zvol_cli/setup.ksh \ + functional/zvol/zvol_cli/zvol_cli_001_pos.ksh \ + functional/zvol/zvol_cli/zvol_cli_002_pos.ksh \ + functional/zvol/zvol_cli/zvol_cli_003_neg.ksh \ + functional/zvol/zvol_ENOSPC/cleanup.ksh \ + functional/zvol/zvol_ENOSPC/setup.ksh \ + functional/zvol/zvol_ENOSPC/zvol_ENOSPC_001_pos.ksh \ + functional/zvol/zvol_misc/cleanup.ksh \ + functional/zvol/zvol_misc/setup.ksh \ + functional/zvol/zvol_misc/zvol_misc_001_neg.ksh \ + functional/zvol/zvol_misc/zvol_misc_002_pos.ksh \ + functional/zvol/zvol_misc/zvol_misc_003_neg.ksh \ + functional/zvol/zvol_misc/zvol_misc_004_pos.ksh \ + functional/zvol/zvol_misc/zvol_misc_005_neg.ksh \ + functional/zvol/zvol_misc/zvol_misc_006_pos.ksh \ + functional/zvol/zvol_misc/zvol_misc_hierarchy.ksh \ + functional/zvol/zvol_misc/zvol_misc_rename_inuse.ksh \ + functional/zvol/zvol_misc/zvol_misc_snapdev.ksh \ + functional/zvol/zvol_misc/zvol_misc_volmode.ksh \ + functional/zvol/zvol_misc/zvol_misc_zil.ksh \ + functional/zvol/zvol_swap/cleanup.ksh \ + functional/zvol/zvol_swap/setup.ksh \ + functional/zvol/zvol_swap/zvol_swap_001_pos.ksh \ + functional/zvol/zvol_swap/zvol_swap_002_pos.ksh \ + functional/zvol/zvol_swap/zvol_swap_003_pos.ksh \ + functional/zvol/zvol_swap/zvol_swap_004_pos.ksh \ + functional/zvol/zvol_swap/zvol_swap_005_pos.ksh \ + functional/zvol/zvol_swap/zvol_swap_006_pos.ksh diff --git a/tests/zfs-tests/tests/functional/Makefile.am b/tests/zfs-tests/tests/functional/Makefile.am deleted file mode 100644 index 785958816657..000000000000 --- a/tests/zfs-tests/tests/functional/Makefile.am +++ /dev/null @@ -1,94 +0,0 @@ -SUBDIRS = \ - acl \ - alloc_class \ - arc \ - atime \ - bootfs \ - btree \ - cache \ - cachefile \ - casenorm \ - channel_program \ - chattr \ - checksum \ - clean_mirror \ - cli_root \ - cli_user \ - compression \ - cp_files \ - crtime \ - ctime \ - deadman \ - delegate \ - devices \ - dos_attributes \ - events \ - exec \ - fallocate \ - fault \ - features \ - grow \ - history \ - inheritance \ - inuse \ - io \ - l2arc \ - large_files \ - largest_pool \ - libzfs \ - limits \ - link_count \ - log_spacemap \ - migration \ - mmap \ - mmp \ - mount \ - mv_files \ - nestedfs \ - no_space \ - nopwrite \ - online_offline \ - pam \ - pool_checkpoint \ - pool_names \ - poolversion \ - privilege \ - procfs \ - projectquota \ - pyzfs \ - quota \ - raidz \ - redacted_send \ - redundancy \ - refquota \ - refreserv \ - removal \ - rename_dirs \ - replacement \ - reservation \ - rootpool \ - rsend \ - scrub_mirror \ - slog \ - snapshot \ - snapused \ - sparse \ - stat \ - suid \ - threadsappend \ - trim \ - truncate \ - upgrade \ - user_namespace \ - userquota \ - vdev_zaps \ - write_dirs \ - xattr \ - zpool_influxdb \ - zvol - -if BUILD_LINUX -SUBDIRS += \ - simd \ - tmpfile -endif diff --git a/tests/zfs-tests/tests/functional/acl/Makefile.am b/tests/zfs-tests/tests/functional/acl/Makefile.am deleted file mode 100644 index d752f63744cb..000000000000 --- a/tests/zfs-tests/tests/functional/acl/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl -dist_pkgdata_DATA = \ - acl.cfg \ - acl_common.kshlib - -SUBDIRS = off posix posix-sa diff --git a/tests/zfs-tests/tests/functional/acl/off/Makefile.am b/tests/zfs-tests/tests/functional/acl/off/Makefile.am deleted file mode 100644 index e315acc65ff8..000000000000 --- a/tests/zfs-tests/tests/functional/acl/off/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/off - -dist_pkgdata_SCRIPTS = \ - dosmode.ksh \ - posixmode.ksh \ - cleanup.ksh \ - setup.ksh diff --git a/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am b/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am deleted file mode 100644 index 31d1237ce265..000000000000 --- a/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/posix-sa -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - posix_001_pos.ksh \ - posix_002_pos.ksh \ - posix_003_pos.ksh \ - posix_004_pos.ksh diff --git a/tests/zfs-tests/tests/functional/acl/posix/Makefile.am b/tests/zfs-tests/tests/functional/acl/posix/Makefile.am deleted file mode 100644 index e63f63185afe..000000000000 --- a/tests/zfs-tests/tests/functional/acl/posix/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/posix -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - posix_001_pos.ksh \ - posix_002_pos.ksh \ - posix_003_pos.ksh \ - posix_004_pos.ksh diff --git a/tests/zfs-tests/tests/functional/alloc_class/Makefile.am b/tests/zfs-tests/tests/functional/alloc_class/Makefile.am deleted file mode 100644 index 7cffb2eac450..000000000000 --- a/tests/zfs-tests/tests/functional/alloc_class/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/alloc_class -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - alloc_class_001_pos.ksh \ - alloc_class_002_neg.ksh \ - alloc_class_003_pos.ksh \ - alloc_class_004_pos.ksh \ - alloc_class_005_pos.ksh \ - alloc_class_006_pos.ksh \ - alloc_class_007_pos.ksh \ - alloc_class_008_pos.ksh \ - alloc_class_009_pos.ksh \ - alloc_class_010_pos.ksh \ - alloc_class_011_neg.ksh \ - alloc_class_012_pos.ksh \ - alloc_class_013_pos.ksh - -dist_pkgdata_DATA = \ - alloc_class.cfg \ - alloc_class.kshlib diff --git a/tests/zfs-tests/tests/functional/arc/Makefile.am b/tests/zfs-tests/tests/functional/arc/Makefile.am deleted file mode 100644 index 809d0346f872..000000000000 --- a/tests/zfs-tests/tests/functional/arc/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/arc -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - arcstats_runtime_tuning.ksh \ - dbufstats_001_pos.ksh \ - dbufstats_002_pos.ksh \ - dbufstats_003_pos.ksh diff --git a/tests/zfs-tests/tests/functional/atime/Makefile.am b/tests/zfs-tests/tests/functional/atime/Makefile.am deleted file mode 100644 index 63d510b99e75..000000000000 --- a/tests/zfs-tests/tests/functional/atime/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/atime -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - atime_001_pos.ksh \ - atime_002_neg.ksh \ - atime_003_pos.ksh \ - root_atime_off.ksh \ - root_atime_on.ksh \ - root_relatime_on.ksh - -dist_pkgdata_DATA = \ - atime.cfg \ - atime_common.kshlib diff --git a/tests/zfs-tests/tests/functional/bootfs/Makefile.am b/tests/zfs-tests/tests/functional/bootfs/Makefile.am deleted file mode 100644 index 15a6e202c311..000000000000 --- a/tests/zfs-tests/tests/functional/bootfs/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/bootfs -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - bootfs_001_pos.ksh \ - bootfs_002_neg.ksh \ - bootfs_003_pos.ksh \ - bootfs_004_neg.ksh \ - bootfs_005_neg.ksh \ - bootfs_006_pos.ksh \ - bootfs_007_pos.ksh \ - bootfs_008_pos.ksh diff --git a/tests/zfs-tests/tests/functional/btree/Makefile.am b/tests/zfs-tests/tests/functional/btree/Makefile.am deleted file mode 100644 index 333209d98f2b..000000000000 --- a/tests/zfs-tests/tests/functional/btree/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -# -# 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 (c) 2019 by Delphix. All rights reserved. -# - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/btree - -dist_pkgdata_SCRIPTS = \ - btree_positive.ksh \ - btree_negative.ksh diff --git a/tests/zfs-tests/tests/functional/cache/Makefile.am b/tests/zfs-tests/tests/functional/cache/Makefile.am deleted file mode 100644 index f28130ee9e4d..000000000000 --- a/tests/zfs-tests/tests/functional/cache/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cache -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - cache_001_pos.ksh \ - cache_002_pos.ksh \ - cache_003_pos.ksh \ - cache_004_neg.ksh \ - cache_005_neg.ksh \ - cache_006_pos.ksh \ - cache_007_neg.ksh \ - cache_008_neg.ksh \ - cache_009_pos.ksh \ - cache_010_pos.ksh \ - cache_011_pos.ksh \ - cache_012_pos.ksh - -dist_pkgdata_DATA = \ - cache.cfg \ - cache.kshlib diff --git a/tests/zfs-tests/tests/functional/cachefile/Makefile.am b/tests/zfs-tests/tests/functional/cachefile/Makefile.am deleted file mode 100644 index 53d8c8c6c9d5..000000000000 --- a/tests/zfs-tests/tests/functional/cachefile/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cachefile -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - cachefile_001_pos.ksh \ - cachefile_002_pos.ksh \ - cachefile_003_pos.ksh \ - cachefile_004_pos.ksh - -dist_pkgdata_DATA = \ - cachefile.cfg \ - cachefile.kshlib diff --git a/tests/zfs-tests/tests/functional/casenorm/Makefile.am b/tests/zfs-tests/tests/functional/casenorm/Makefile.am deleted file mode 100644 index b284a2560b27..000000000000 --- a/tests/zfs-tests/tests/functional/casenorm/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/casenorm -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - case_all_values.ksh \ - insensitive_formd_delete.ksh \ - insensitive_formd_lookup.ksh \ - insensitive_none_delete.ksh \ - insensitive_none_lookup.ksh \ - mixed_create_failure.ksh \ - mixed_formd_delete.ksh \ - mixed_formd_lookup_ci.ksh \ - mixed_formd_lookup.ksh \ - mixed_none_delete.ksh \ - mixed_none_lookup_ci.ksh \ - mixed_none_lookup.ksh \ - norm_all_values.ksh \ - sensitive_formd_delete.ksh \ - sensitive_formd_lookup.ksh \ - sensitive_none_delete.ksh \ - sensitive_none_lookup.ksh - -dist_pkgdata_DATA = \ - casenorm.cfg \ - casenorm.kshlib diff --git a/tests/zfs-tests/tests/functional/channel_program/Makefile.am b/tests/zfs-tests/tests/functional/channel_program/Makefile.am deleted file mode 100644 index 3886863d1dfb..000000000000 --- a/tests/zfs-tests/tests/functional/channel_program/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -SUBDIRS = \ - lua_core \ - synctask_core - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/channel_program -dist_pkgdata_DATA = channel_common.kshlib diff --git a/tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile.am b/tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile.am deleted file mode 100644 index fb352081190c..000000000000 --- a/tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/channel_program/lua_core -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - tst.args_to_lua.ksh \ - tst.divide_by_zero.ksh \ - tst.exists.ksh \ - tst.integer_illegal.ksh \ - tst.integer_overflow.ksh \ - tst.language_functions_neg.ksh \ - tst.language_functions_pos.ksh \ - tst.large_prog.ksh \ - tst.libraries.ksh \ - tst.memory_limit.ksh \ - tst.nested_neg.ksh \ - tst.nested_pos.ksh \ - tst.nvlist_to_lua.ksh \ - tst.recursive_neg.ksh \ - tst.recursive_pos.ksh \ - tst.return_large.ksh \ - tst.return_nvlist_neg.ksh \ - tst.return_nvlist_pos.ksh \ - tst.return_recursive_table.ksh \ - tst.stack_gsub.ksh \ - tst.timeout.ksh - -dist_pkgdata_DATA = \ - tst.args_to_lua.out \ - tst.args_to_lua.zcp \ - tst.divide_by_zero.err \ - tst.divide_by_zero.zcp \ - tst.exists.zcp \ - tst.large_prog.out \ - tst.large_prog.zcp \ - tst.lib_base.lua \ - tst.lib_coroutine.lua \ - tst.lib_strings.lua \ - tst.lib_table.lua \ - tst.nested_neg.zcp \ - tst.nested_pos.zcp \ - tst.recursive.zcp \ - tst.return_large.zcp \ - tst.return_recursive_table.zcp \ - tst.stack_gsub.err \ - tst.stack_gsub.zcp \ - tst.timeout.zcp diff --git a/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am b/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am deleted file mode 100644 index 4d9aa9cebbfc..000000000000 --- a/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/channel_program/synctask_core -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - tst.destroy_fs.ksh \ - tst.destroy_snap.ksh \ - tst.get_count_and_limit.ksh \ - tst.get_index_props.ksh \ - tst.get_mountpoint.ksh \ - tst.get_neg.ksh \ - tst.get_number_props.ksh \ - tst.get_string_props.ksh \ - tst.get_type.ksh \ - tst.get_userquota.ksh \ - tst.get_written.ksh \ - tst.inherit.ksh \ - tst.list_bookmarks.ksh \ - tst.list_children.ksh \ - tst.list_clones.ksh \ - tst.list_holds.ksh \ - tst.list_snapshots.ksh \ - tst.list_system_props.ksh \ - tst.list_user_props.ksh \ - tst.parse_args_neg.ksh \ - tst.promote_conflict.ksh \ - tst.promote_multiple.ksh \ - tst.promote_simple.ksh \ - tst.rollback_mult.ksh \ - tst.rollback_one.ksh \ - tst.set_props.ksh \ - tst.snapshot_destroy.ksh \ - tst.snapshot_neg.ksh \ - tst.snapshot_recursive.ksh \ - tst.bookmark.create.ksh \ - tst.bookmark.copy.ksh \ - tst.snapshot_simple.ksh \ - tst.terminate_by_signal.ksh - -dist_pkgdata_DATA = \ - tst.get_index_props.out \ - tst.get_index_props.zcp \ - tst.get_number_props.out \ - tst.get_number_props.zcp \ - tst.get_string_props.out \ - tst.get_string_props.zcp \ - tst.promote_conflict.zcp \ - tst.set_props.zcp \ - tst.snapshot_destroy.zcp \ - tst.snapshot_neg.zcp \ - tst.snapshot_recursive.zcp \ - tst.snapshot_simple.zcp \ - tst.bookmark.create.zcp \ - tst.bookmark.copy.zcp diff --git a/tests/zfs-tests/tests/functional/chattr/Makefile.am b/tests/zfs-tests/tests/functional/chattr/Makefile.am deleted file mode 100644 index 431208e587ec..000000000000 --- a/tests/zfs-tests/tests/functional/chattr/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/chattr -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - chattr_001_pos.ksh \ - chattr_002_neg.ksh diff --git a/tests/zfs-tests/tests/functional/checksum/Makefile.am b/tests/zfs-tests/tests/functional/checksum/Makefile.am deleted file mode 100644 index 2eed764befd2..000000000000 --- a/tests/zfs-tests/tests/functional/checksum/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum - -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - run_edonr_test.ksh \ - run_sha2_test.ksh \ - run_skein_test.ksh \ - filetest_001_pos.ksh \ - filetest_002_pos.ksh - -dist_pkgdata_DATA = \ - default.cfg diff --git a/tests/zfs-tests/tests/functional/clean_mirror/Makefile.am b/tests/zfs-tests/tests/functional/clean_mirror/Makefile.am deleted file mode 100644 index 2bc67709fffb..000000000000 --- a/tests/zfs-tests/tests/functional/clean_mirror/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/clean_mirror -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - clean_mirror_001_pos.ksh \ - clean_mirror_002_pos.ksh \ - clean_mirror_003_pos.ksh \ - clean_mirror_004_pos.ksh - -dist_pkgdata_DATA = \ - clean_mirror_common.kshlib \ - default.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/Makefile.am deleted file mode 100644 index 9951f96f31ef..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/Makefile.am +++ /dev/null @@ -1,67 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root -dist_pkgdata_DATA = \ - cli_common.kshlib - -SUBDIRS = \ - zdb \ - zfs \ - zfs_bookmark \ - zfs_change-key \ - zfs_clone \ - zfs_copies \ - zfs_create \ - zfs_destroy \ - zfs_diff \ - zfs_get \ - zfs_ids_to_path \ - zfs_inherit \ - zfs_jail \ - zfs_load-key \ - zfs_mount \ - zfs_program \ - zfs_promote \ - zfs_property \ - zfs_receive \ - zfs_rename \ - zfs_reservation \ - zfs_rollback \ - zfs_send \ - zfs_set \ - zfs_share \ - zfs_snapshot \ - zfs_sysfs \ - zfs_unload-key \ - zfs_unmount \ - zfs_unshare \ - zfs_upgrade \ - zfs_wait \ - zhack \ - zpool \ - zpool_add \ - zpool_attach \ - zpool_clear \ - zpool_create \ - zpool_destroy \ - zpool_detach \ - zpool_events \ - zpool_expand \ - zpool_export \ - zpool_get \ - zpool_history \ - zpool_import \ - zpool_initialize \ - zpool_labelclear \ - zpool_offline \ - zpool_online \ - zpool_remove \ - zpool_reopen \ - zpool_replace \ - zpool_resilver \ - zpool_scrub \ - zpool_set \ - zpool_split \ - zpool_status \ - zpool_sync \ - zpool_trim \ - zpool_upgrade \ - zpool_wait diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am deleted file mode 100644 index c1d4bf5a47ba..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zdb -dist_pkgdata_SCRIPTS = \ - zdb_002_pos.ksh \ - zdb_003_pos.ksh \ - zdb_004_pos.ksh \ - zdb_005_pos.ksh \ - zdb_006_pos.ksh \ - zdb_args_neg.ksh \ - zdb_args_pos.ksh \ - zdb_block_size_histogram.ksh \ - zdb_checksum.ksh \ - zdb_decompress.ksh \ - zdb_decompress_zstd.ksh \ - zdb_object_range_neg.ksh \ - zdb_object_range_pos.ksh \ - zdb_display_block.ksh \ - zdb_label_checksum.ksh \ - zdb_objset_id.ksh \ - zdb_recover.ksh \ - zdb_recover_2.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs/Makefile.am deleted file mode 100644 index 8b0ee276a3b0..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_001_neg.ksh \ - zfs_002_pos.ksh \ - zfs_003_neg.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile.am deleted file mode 100644 index e71fbc85ca84..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_bookmark -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_bookmark_cliargs.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile.am deleted file mode 100644 index 72d6e4700e17..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_change-key -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_change-key.ksh \ - zfs_change-key_child.ksh \ - zfs_change-key_clones.ksh \ - zfs_change-key_inherit.ksh \ - zfs_change-key_format.ksh \ - zfs_change-key_load.ksh \ - zfs_change-key_location.ksh \ - zfs_change-key_pbkdf2iters.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile.am deleted file mode 100644 index 06099c0c2b79..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_clone -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_clone_001_neg.ksh \ - zfs_clone_002_pos.ksh \ - zfs_clone_003_pos.ksh \ - zfs_clone_004_pos.ksh \ - zfs_clone_005_pos.ksh \ - zfs_clone_006_pos.ksh \ - zfs_clone_007_pos.ksh \ - zfs_clone_008_neg.ksh \ - zfs_clone_009_neg.ksh \ - zfs_clone_010_pos.ksh \ - zfs_clone_encrypted.ksh \ - zfs_clone_deeply_nested.ksh \ - zfs_clone_rm_nested.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile.am deleted file mode 100644 index 4ac103a8ec6a..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_copies -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_copies_001_pos.ksh \ - zfs_copies_002_pos.ksh \ - zfs_copies_003_pos.ksh \ - zfs_copies_004_neg.ksh \ - zfs_copies_005_neg.ksh \ - zfs_copies_006_pos.ksh - -dist_pkgdata_DATA = \ - zfs_copies.cfg \ - zfs_copies.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile.am deleted file mode 100644 index 7515753c1bc2..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_create -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_create_001_pos.ksh \ - zfs_create_002_pos.ksh \ - zfs_create_003_pos.ksh \ - zfs_create_004_pos.ksh \ - zfs_create_005_pos.ksh \ - zfs_create_006_pos.ksh \ - zfs_create_007_pos.ksh \ - zfs_create_008_neg.ksh \ - zfs_create_009_neg.ksh \ - zfs_create_010_neg.ksh \ - zfs_create_011_pos.ksh \ - zfs_create_012_pos.ksh \ - zfs_create_013_pos.ksh \ - zfs_create_014_pos.ksh \ - zfs_create_encrypted.ksh \ - zfs_create_crypt_combos.ksh \ - zfs_create_dryrun.ksh \ - zfs_create_nomount.ksh \ - zfs_create_verbose.ksh - -dist_pkgdata_DATA = \ - properties.kshlib \ - zfs_create_common.kshlib \ - zfs_create.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am deleted file mode 100644 index 664f3d81aea6..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_destroy -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_clone_livelist_condense_and_disable.ksh \ - zfs_clone_livelist_condense_races.ksh \ - zfs_clone_livelist_dedup.ksh \ - zfs_destroy_001_pos.ksh \ - zfs_destroy_002_pos.ksh \ - zfs_destroy_003_pos.ksh \ - zfs_destroy_004_pos.ksh \ - zfs_destroy_005_neg.ksh \ - zfs_destroy_006_neg.ksh \ - zfs_destroy_007_neg.ksh \ - zfs_destroy_008_pos.ksh \ - zfs_destroy_009_pos.ksh \ - zfs_destroy_010_pos.ksh \ - zfs_destroy_011_pos.ksh \ - zfs_destroy_012_pos.ksh \ - zfs_destroy_013_neg.ksh \ - zfs_destroy_014_pos.ksh \ - zfs_destroy_015_pos.ksh \ - zfs_destroy_016_pos.ksh \ - zfs_destroy_clone_livelist.ksh \ - zfs_destroy_dev_removal.ksh \ - zfs_destroy_dev_removal_condense.ksh - -dist_pkgdata_DATA = \ - zfs_destroy_common.kshlib \ - zfs_destroy.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am deleted file mode 100644 index 136cfe186d6c..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_diff - -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zfs_diff_changes.ksh \ - zfs_diff_cliargs.ksh \ - zfs_diff_encrypted.ksh \ - zfs_diff_mangle.ksh \ - zfs_diff_timestamp.ksh \ - zfs_diff_types.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile.am deleted file mode 100644 index 22e95907675d..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_get -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_get_001_pos.ksh \ - zfs_get_002_pos.ksh \ - zfs_get_003_pos.ksh \ - zfs_get_004_pos.ksh \ - zfs_get_005_neg.ksh \ - zfs_get_006_neg.ksh \ - zfs_get_007_neg.ksh \ - zfs_get_008_pos.ksh \ - zfs_get_009_pos.ksh \ - zfs_get_010_neg.ksh - -dist_pkgdata_DATA = \ - zfs_get_common.kshlib \ - zfs_get_list_d.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile.am deleted file mode 100644 index 5f5e3858787e..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_ids_to_path -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_ids_to_path_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile.am deleted file mode 100644 index 95a51ec757ea..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_inherit -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zfs_inherit_001_neg.ksh \ - zfs_inherit_002_neg.ksh \ - zfs_inherit_003_pos.ksh \ - zfs_inherit_mountpoint.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile.am deleted file mode 100644 index b6dd7721e63e..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_jail -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - jail.conf \ - zfs_jail_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile.am deleted file mode 100644 index 7dfec435ce7f..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_load-key -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_load-key.ksh \ - zfs_load-key_all.ksh \ - zfs_load-key_file.ksh \ - zfs_load-key_https.ksh \ - zfs_load-key_location.ksh \ - zfs_load-key_noop.ksh \ - zfs_load-key_recursive.ksh - -dist_pkgdata_DATA = \ - zfs_load-key.cfg \ - zfs_load-key_common.kshlib \ - PASSPHRASE \ - HEXKEY \ - RAWKEY diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile.am deleted file mode 100644 index 8c90b2e75e5a..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_mount -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_mount_001_pos.ksh \ - zfs_mount_002_pos.ksh \ - zfs_mount_003_pos.ksh \ - zfs_mount_004_pos.ksh \ - zfs_mount_005_pos.ksh \ - zfs_mount_006_pos.ksh \ - zfs_mount_007_pos.ksh \ - zfs_mount_008_pos.ksh \ - zfs_mount_009_neg.ksh \ - zfs_mount_010_neg.ksh \ - zfs_mount_011_neg.ksh \ - zfs_mount_012_pos.ksh \ - zfs_mount_013_pos.ksh \ - zfs_mount_014_neg.ksh \ - zfs_mount_all_001_pos.ksh \ - zfs_mount_all_fail.ksh \ - zfs_mount_all_mountpoints.ksh \ - zfs_mount_encrypted.ksh \ - zfs_mount_remount.ksh \ - zfs_mount_test_race.ksh \ - zfs_multi_mount.ksh - -dist_pkgdata_DATA = \ - zfs_mount.cfg \ - zfs_mount.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am deleted file mode 100644 index d797a636b347..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_program -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_program_json.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile.am deleted file mode 100644 index 8a8c56a093d2..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_promote -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_promote_001_pos.ksh \ - zfs_promote_002_pos.ksh \ - zfs_promote_003_pos.ksh \ - zfs_promote_004_pos.ksh \ - zfs_promote_005_pos.ksh \ - zfs_promote_006_neg.ksh \ - zfs_promote_007_neg.ksh \ - zfs_promote_008_pos.ksh \ - zfs_promote_encryptionroot.ksh - -dist_pkgdata_DATA = \ - zfs_promote.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile.am deleted file mode 100644 index d8a5687b1ea2..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_property -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_written_property_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am deleted file mode 100644 index cf9490de4e81..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_receive -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_receive_001_pos.ksh \ - zfs_receive_002_pos.ksh \ - zfs_receive_003_pos.ksh \ - zfs_receive_004_neg.ksh \ - zfs_receive_005_neg.ksh \ - zfs_receive_006_pos.ksh \ - zfs_receive_007_neg.ksh \ - zfs_receive_008_pos.ksh \ - zfs_receive_009_neg.ksh \ - zfs_receive_010_pos.ksh \ - zfs_receive_011_pos.ksh \ - zfs_receive_012_pos.ksh \ - zfs_receive_013_pos.ksh \ - zfs_receive_014_pos.ksh \ - zfs_receive_015_pos.ksh \ - zfs_receive_016_pos.ksh \ - receive-o-x_props_override.ksh \ - receive-o-x_props_aliases.ksh \ - zfs_receive_from_encrypted.ksh \ - zfs_receive_from_zstd.ksh \ - zfs_receive_new_props.ksh \ - zfs_receive_to_encrypted.ksh \ - zfs_receive_raw.ksh \ - zfs_receive_raw_incremental.ksh \ - zfs_receive_raw_-d.ksh \ - zfs_receive_-e.ksh \ - zfs_receive_-wR-encrypted-mix.ksh - -dist_pkgdata_DATA = \ - zstd_test_data.txt diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am deleted file mode 100644 index f8273d72c569..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_rename -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_rename_001_pos.ksh \ - zfs_rename_002_pos.ksh \ - zfs_rename_003_pos.ksh \ - zfs_rename_004_neg.ksh \ - zfs_rename_005_neg.ksh \ - zfs_rename_006_pos.ksh \ - zfs_rename_007_pos.ksh \ - zfs_rename_008_pos.ksh \ - zfs_rename_009_neg.ksh \ - zfs_rename_010_neg.ksh \ - zfs_rename_011_pos.ksh \ - zfs_rename_012_neg.ksh \ - zfs_rename_013_pos.ksh \ - zfs_rename_014_neg.ksh \ - zfs_rename_encrypted_child.ksh \ - zfs_rename_to_encrypted.ksh \ - zfs_rename_mountpoint.ksh \ - zfs_rename_nounmount.ksh - -dist_pkgdata_DATA = \ - zfs_rename.cfg \ - zfs_rename.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile.am deleted file mode 100644 index 5b7b758a056a..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_reservation -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_reservation_001_pos.ksh \ - zfs_reservation_002_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile.am deleted file mode 100644 index 4d278f724527..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_rollback -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_rollback_001_pos.ksh \ - zfs_rollback_002_pos.ksh \ - zfs_rollback_003_neg.ksh \ - zfs_rollback_004_neg.ksh - -dist_pkgdata_DATA = \ - zfs_rollback.cfg \ - zfs_rollback_common.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile.am deleted file mode 100644 index 25c7065670f2..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_send -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_send_001_pos.ksh \ - zfs_send_002_pos.ksh \ - zfs_send_003_pos.ksh \ - zfs_send_004_neg.ksh \ - zfs_send_005_pos.ksh \ - zfs_send_006_pos.ksh \ - zfs_send_007_pos.ksh \ - zfs_send_encrypted.ksh \ - zfs_send_encrypted_unloaded.ksh \ - zfs_send_raw.ksh \ - zfs_send_sparse.ksh \ - zfs_send-b.ksh \ - zfs_send_skip_missing.ksh - -dist_pkgdata_DATA = \ - zfs_send.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile.am deleted file mode 100644 index f7362ff2556f..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_set -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - cache_001_pos.ksh \ - cache_002_neg.ksh \ - canmount_001_pos.ksh \ - canmount_002_pos.ksh \ - canmount_003_pos.ksh \ - canmount_004_pos.ksh \ - checksum_001_pos.ksh \ - compression_001_pos.ksh \ - mountpoint_001_pos.ksh \ - mountpoint_002_pos.ksh \ - mountpoint_003_pos.ksh \ - onoffs_001_pos.ksh \ - property_alias_001_pos.ksh \ - readonly_001_pos.ksh \ - reservation_001_neg.ksh \ - ro_props_001_pos.ksh \ - share_mount_001_neg.ksh \ - snapdir_001_pos.ksh \ - user_property_001_pos.ksh \ - user_property_002_pos.ksh \ - user_property_003_neg.ksh \ - user_property_004_pos.ksh \ - version_001_neg.ksh \ - zfs_set_001_neg.ksh \ - zfs_set_002_neg.ksh \ - zfs_set_003_neg.ksh \ - zfs_set_keylocation.ksh \ - zfs_set_feature_activation.ksh - -dist_pkgdata_DATA = \ - zfs_set_common.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile.am deleted file mode 100644 index 35332f822e6c..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_share -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_share_001_pos.ksh \ - zfs_share_002_pos.ksh \ - zfs_share_003_pos.ksh \ - zfs_share_004_pos.ksh \ - zfs_share_005_pos.ksh \ - zfs_share_006_pos.ksh \ - zfs_share_007_neg.ksh \ - zfs_share_008_neg.ksh \ - zfs_share_009_neg.ksh \ - zfs_share_010_neg.ksh \ - zfs_share_011_pos.ksh \ - zfs_share_012_pos.ksh \ - zfs_share_013_pos.ksh \ - zfs_share_concurrent_shares.ksh - -dist_pkgdata_DATA = \ - zfs_share.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile.am deleted file mode 100644 index bc5b801259c8..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_snapshot -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_snapshot_001_neg.ksh \ - zfs_snapshot_002_neg.ksh \ - zfs_snapshot_003_neg.ksh \ - zfs_snapshot_004_neg.ksh \ - zfs_snapshot_005_neg.ksh \ - zfs_snapshot_006_pos.ksh \ - zfs_snapshot_007_neg.ksh \ - zfs_snapshot_008_neg.ksh \ - zfs_snapshot_009_pos.ksh - -dist_pkgdata_DATA = \ - zfs_snapshot.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile.am deleted file mode 100644 index 6a83edf2a443..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_sysfs -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfeature_set_unsupported.ksh \ - zfs_get_unsupported.ksh \ - zfs_set_unsupported.ksh \ - zfs_sysfs_live.ksh \ - zpool_get_unsupported.ksh \ - zpool_set_unsupported.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile.am deleted file mode 100644 index 74cdf5c2b558..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_unload-key -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_unload-key.ksh \ - zfs_unload-key_all.ksh \ - zfs_unload-key_recursive.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile.am deleted file mode 100644 index 6507b094df47..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_unmount -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_unmount_001_pos.ksh \ - zfs_unmount_002_pos.ksh \ - zfs_unmount_003_pos.ksh \ - zfs_unmount_004_pos.ksh \ - zfs_unmount_005_pos.ksh \ - zfs_unmount_006_pos.ksh \ - zfs_unmount_007_neg.ksh \ - zfs_unmount_008_neg.ksh \ - zfs_unmount_009_pos.ksh \ - zfs_unmount_all_001_pos.ksh \ - zfs_unmount_nested.ksh \ - zfs_unmount_unload_keys.ksh - -dist_pkgdata_DATA = \ - zfs_unmount.cfg \ - zfs_unmount.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile.am deleted file mode 100644 index 0845f1e2f9f6..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_unshare -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_unshare_001_pos.ksh \ - zfs_unshare_002_pos.ksh \ - zfs_unshare_003_pos.ksh \ - zfs_unshare_004_neg.ksh \ - zfs_unshare_005_neg.ksh \ - zfs_unshare_006_pos.ksh \ - zfs_unshare_007_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile.am deleted file mode 100644 index 7a71bae4bb42..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_upgrade -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_upgrade_001_pos.ksh \ - zfs_upgrade_002_pos.ksh \ - zfs_upgrade_003_pos.ksh \ - zfs_upgrade_004_pos.ksh \ - zfs_upgrade_005_pos.ksh \ - zfs_upgrade_006_neg.ksh \ - zfs_upgrade_007_neg.ksh - -dist_pkgdata_DATA = \ - zfs_upgrade.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am deleted file mode 100644 index 5d385d915720..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_wait -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_wait_deleteq.ksh \ - zfs_wait_getsubopt.ksh - -dist_pkgdata_DATA = \ - zfs_wait.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zhack/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zhack/Makefile.am deleted file mode 100644 index 931dacde6beb..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zhack/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zhack -dist_pkgdata_SCRIPTS = \ - zhack_label_checksum.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool/Makefile.am deleted file mode 100644 index 327f23621158..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_001_neg.ksh \ - zpool_002_pos.ksh \ - zpool_003_pos.ksh \ - zpool_colors.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile.am deleted file mode 100644 index 8d54d13f7207..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_add -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_add_001_pos.ksh \ - zpool_add_002_pos.ksh \ - zpool_add_003_pos.ksh \ - zpool_add_004_pos.ksh \ - zpool_add_005_pos.ksh \ - zpool_add_006_pos.ksh \ - zpool_add_007_neg.ksh \ - zpool_add_008_neg.ksh \ - zpool_add_009_neg.ksh \ - zpool_add_010_pos.ksh \ - add-o_ashift.ksh \ - add_prop_ashift.ksh \ - add_nested_replacing_spare.ksh \ - zpool_add_dryrun_output.ksh - -dist_pkgdata_DATA = \ - zpool_add.cfg \ - zpool_add.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile.am deleted file mode 100644 index cc742f33d2aa..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_attach -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_attach_001_neg.ksh \ - attach-o_ashift.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile.am deleted file mode 100644 index 6986d38efc9d..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_clear -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_clear_001_pos.ksh \ - zpool_clear_002_neg.ksh \ - zpool_clear_003_neg.ksh \ - zpool_clear_readonly.ksh - -dist_pkgdata_DATA = \ - zpool_clear.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am deleted file mode 100644 index 5ffaae5b152c..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_create -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_create_001_pos.ksh \ - zpool_create_002_pos.ksh \ - zpool_create_003_pos.ksh \ - zpool_create_004_pos.ksh \ - zpool_create_005_pos.ksh \ - zpool_create_006_pos.ksh \ - zpool_create_007_neg.ksh \ - zpool_create_008_pos.ksh \ - zpool_create_009_neg.ksh \ - zpool_create_010_neg.ksh \ - zpool_create_011_neg.ksh \ - zpool_create_012_neg.ksh \ - zpool_create_014_neg.ksh \ - zpool_create_015_neg.ksh \ - zpool_create_016_pos.ksh \ - zpool_create_017_neg.ksh \ - zpool_create_018_pos.ksh \ - zpool_create_019_pos.ksh \ - zpool_create_020_pos.ksh \ - zpool_create_021_pos.ksh \ - zpool_create_022_pos.ksh \ - zpool_create_023_neg.ksh \ - zpool_create_024_pos.ksh \ - zpool_create_encrypted.ksh \ - zpool_create_crypt_combos.ksh \ - zpool_create_draid_001_pos.ksh \ - zpool_create_draid_002_pos.ksh \ - zpool_create_draid_003_pos.ksh \ - zpool_create_draid_004_pos.ksh \ - zpool_create_features_001_pos.ksh \ - zpool_create_features_002_pos.ksh \ - zpool_create_features_003_pos.ksh \ - zpool_create_features_004_neg.ksh \ - zpool_create_features_005_pos.ksh \ - zpool_create_features_006_pos.ksh \ - zpool_create_features_007_pos.ksh \ - zpool_create_features_008_pos.ksh \ - zpool_create_features_009_pos.ksh \ - create-o_ashift.ksh \ - zpool_create_tempname.ksh \ - zpool_create_dryrun_output.ksh - -dist_pkgdata_DATA = \ - draidcfg.gz \ - zpool_create.cfg \ - zpool_create.shlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am deleted file mode 100644 index 7f9e00d5826f..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_destroy -dist_pkgdata_SCRIPTS = \ - zpool_destroy_001_pos.ksh \ - zpool_destroy_002_pos.ksh \ - zpool_destroy_003_neg.ksh - -dist_pkgdata_DATA = \ - zpool_destroy.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile.am deleted file mode 100644 index b22018c1d550..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_detach -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_detach_001_neg.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am deleted file mode 100644 index e1a9fd404b62..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_events - -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_events_clear.ksh \ - zpool_events_cliargs.ksh \ - zpool_events_follow.ksh \ - zpool_events_poolname.ksh \ - zpool_events_errors.ksh \ - zpool_events_duplicates.ksh \ - zpool_events_clear_retained.ksh - -dist_pkgdata_DATA = \ - zpool_events.cfg \ - zpool_events.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile.am deleted file mode 100644 index beaa411e37cb..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_expand -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_expand_001_pos.ksh \ - zpool_expand_002_pos.ksh \ - zpool_expand_003_neg.ksh \ - zpool_expand_004_pos.ksh \ - zpool_expand_005_pos.ksh - -dist_pkgdata_DATA = \ - zpool_expand.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am deleted file mode 100644 index 1c06d5b59e9b..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_export -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_export_001_pos.ksh \ - zpool_export_002_pos.ksh \ - zpool_export_003_neg.ksh \ - zpool_export_004_pos.ksh - -dist_pkgdata_DATA = \ - zpool_export.cfg \ - zpool_export.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile.am deleted file mode 100644 index 0c87c9b37763..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_get -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_get_001_pos.ksh \ - zpool_get_002_pos.ksh \ - zpool_get_003_pos.ksh \ - zpool_get_004_neg.ksh \ - zpool_get_005_pos.ksh - -dist_pkgdata_DATA = \ - zpool_get.cfg zpool_get_parsable.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile.am deleted file mode 100644 index 8755f8f6c8a9..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_history -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_history_001_neg.ksh \ - zpool_history_002_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am deleted file mode 100644 index a8c9a31dcfdc..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -SUBDIRS = blockfiles - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_import -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - import_cachefile_device_added.ksh \ - import_cachefile_device_removed.ksh \ - import_cachefile_device_replaced.ksh \ - import_cachefile_mirror_attached.ksh \ - import_cachefile_mirror_detached.ksh \ - import_cachefile_paths_changed.ksh \ - import_cachefile_shared_device.ksh \ - import_devices_missing.ksh \ - import_paths_changed.ksh \ - import_rewind_config_changed.ksh \ - import_rewind_device_replaced.ksh \ - zpool_import_001_pos.ksh \ - zpool_import_002_pos.ksh \ - zpool_import_003_pos.ksh \ - zpool_import_004_pos.ksh \ - zpool_import_005_pos.ksh \ - zpool_import_006_pos.ksh \ - zpool_import_007_pos.ksh \ - zpool_import_008_pos.ksh \ - zpool_import_009_neg.ksh \ - zpool_import_010_pos.ksh \ - zpool_import_011_neg.ksh \ - zpool_import_012_pos.ksh \ - zpool_import_013_neg.ksh \ - zpool_import_014_pos.ksh \ - zpool_import_015_pos.ksh \ - zpool_import_016_pos.ksh \ - zpool_import_017_pos.ksh \ - zpool_import_all_001_pos.ksh \ - zpool_import_features_001_pos.ksh \ - zpool_import_features_002_neg.ksh \ - zpool_import_features_003_pos.ksh \ - zpool_import_missing_001_pos.ksh \ - zpool_import_missing_002_pos.ksh \ - zpool_import_missing_003_pos.ksh \ - zpool_import_rename_001_pos.ksh \ - zpool_import_encrypted.ksh \ - zpool_import_encrypted_load.ksh \ - zpool_import_errata3.ksh \ - zpool_import_errata4.ksh - -dist_pkgdata_DATA = \ - zpool_import.cfg \ - zpool_import.kshlib - diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am deleted file mode 100644 index dc3685e4b9cc..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles -dist_pkgdata_DATA = \ - unclean_export.dat.bz2 \ - cryptv0.dat.bz2 \ - missing_ivset.dat.bz2 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am deleted file mode 100644 index 3968902ec36d..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_initialize -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - zpool_initialize_attach_detach_add_remove.ksh \ - zpool_initialize_fault_export_import_online.ksh \ - zpool_initialize_import_export.ksh \ - zpool_initialize_offline_export_import_online.ksh \ - zpool_initialize_online_offline.ksh \ - zpool_initialize_split.ksh \ - zpool_initialize_start_and_cancel_neg.ksh \ - zpool_initialize_start_and_cancel_pos.ksh \ - zpool_initialize_suspend_resume.ksh \ - zpool_initialize_unsupported_vdevs.ksh \ - zpool_initialize_verify_checksums.ksh \ - zpool_initialize_verify_initialized.ksh - -dist_pkgdata_DATA = \ - zpool_initialize.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile.am deleted file mode 100644 index c258f0c929d4..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_labelclear -dist_pkgdata_SCRIPTS = \ - zpool_labelclear_active.ksh \ - zpool_labelclear_exported.ksh \ - zpool_labelclear_removed.ksh \ - zpool_labelclear_valid.ksh - -dist_pkgdata_DATA = \ - labelclear.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile.am deleted file mode 100644 index 33fbb18d66f3..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_offline -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_offline_001_pos.ksh \ - zpool_offline_002_neg.ksh \ - zpool_offline_003_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile.am deleted file mode 100644 index 12681e3c4141..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_online -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_online_001_pos.ksh \ - zpool_online_002_neg.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile.am deleted file mode 100644 index e30e3f60c2d6..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_remove -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_remove_001_neg.ksh \ - zpool_remove_002_pos.ksh \ - zpool_remove_003_pos.ksh - -dist_pkgdata_DATA = \ - zpool_remove.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile.am deleted file mode 100644 index 01ad68c817f2..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_reopen -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_reopen_001_pos.ksh \ - zpool_reopen_002_pos.ksh \ - zpool_reopen_003_pos.ksh \ - zpool_reopen_004_pos.ksh \ - zpool_reopen_005_pos.ksh \ - zpool_reopen_006_neg.ksh \ - zpool_reopen_007_pos.ksh - -dist_pkgdata_DATA = \ - zpool_reopen.cfg \ - zpool_reopen.shlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile.am deleted file mode 100644 index 2e3ea69f2ca9..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_replace -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_replace_001_neg.ksh \ - replace-o_ashift.ksh \ - replace_prop_ashift.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile.am deleted file mode 100644 index 2cec5335fbae..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_resilver -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_resilver_bad_args.ksh \ - zpool_resilver_restart.ksh - -dist_pkgdata_DATA = \ - zpool_resilver.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile.am deleted file mode 100644 index e2dfd9d64c40..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_scrub -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_scrub_001_neg.ksh \ - zpool_scrub_002_pos.ksh \ - zpool_scrub_003_pos.ksh \ - zpool_scrub_004_pos.ksh \ - zpool_scrub_005_pos.ksh \ - zpool_scrub_encrypted_unloaded.ksh \ - zpool_scrub_offline_device.ksh \ - zpool_scrub_print_repairing.ksh \ - zpool_scrub_multiple_copies.ksh - -dist_pkgdata_DATA = \ - zpool_scrub.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile.am deleted file mode 100644 index 916e8bb8d20e..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_set -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_set_001_pos.ksh \ - zpool_set_002_neg.ksh \ - zpool_set_003_neg.ksh \ - zpool_set_ashift.ksh \ - zpool_set_features.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile.am deleted file mode 100644 index aac5e0d6e7b1..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_split - -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zpool_split_cliargs.ksh \ - zpool_split_devices.ksh \ - zpool_split_encryption.ksh \ - zpool_split_props.ksh \ - zpool_split_vdevs.ksh \ - zpool_split_resilver.ksh \ - zpool_split_wholedisk.ksh \ - zpool_split_indirect.ksh \ - zpool_split_dryrun_output.ksh - -dist_pkgdata_DATA = \ - zpool_split.cfg diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am deleted file mode 100644 index 538c5d6c163c..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_status -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_status_001_pos.ksh \ - zpool_status_002_pos.ksh \ - zpool_status_003_pos.ksh \ - zpool_status_004_pos.ksh \ - zpool_status_features_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile.am deleted file mode 100644 index 7f5f67d1f343..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_sync -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zpool_sync_001_pos.ksh \ - zpool_sync_002_neg.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am deleted file mode 100644 index 0411ab4e0070..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_trim -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_trim_attach_detach_add_remove.ksh \ - zpool_trim_fault_export_import_online.ksh \ - zpool_trim_import_export.ksh \ - zpool_trim_multiple.ksh \ - zpool_trim_neg.ksh \ - zpool_trim_offline_export_import_online.ksh \ - zpool_trim_online_offline.ksh \ - zpool_trim_partial.ksh \ - zpool_trim_rate.ksh \ - zpool_trim_rate_neg.ksh \ - zpool_trim_secure.ksh \ - zpool_trim_split.ksh \ - zpool_trim_start_and_cancel_neg.ksh \ - zpool_trim_start_and_cancel_pos.ksh \ - zpool_trim_suspend_resume.ksh \ - zpool_trim_unsupported_vdevs.ksh \ - zpool_trim_verify_checksums.ksh \ - zpool_trim_verify_trimmed.ksh - -dist_pkgdata_DATA = \ - zpool_trim.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile.am deleted file mode 100644 index c7f321a2f61d..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -SUBDIRS = blockfiles - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_upgrade -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_upgrade_001_pos.ksh \ - zpool_upgrade_002_pos.ksh \ - zpool_upgrade_003_pos.ksh \ - zpool_upgrade_004_pos.ksh \ - zpool_upgrade_005_neg.ksh \ - zpool_upgrade_006_neg.ksh \ - zpool_upgrade_007_pos.ksh \ - zpool_upgrade_008_pos.ksh \ - zpool_upgrade_009_neg.ksh \ - zpool_upgrade_features_001_pos.ksh - -dist_pkgdata_DATA = \ - zpool_upgrade.cfg \ - zpool_upgrade.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile.am deleted file mode 100644 index ce8da278e9f0..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles -dist_pkgdata_DATA = \ - zfs-broken-mirror1.dat.bz2 \ - zfs-broken-mirror2.dat.bz2 \ - zfs-pool-v1.dat.bz2 \ - zfs-pool-v10.dat.bz2 \ - zfs-pool-v11.dat.bz2 \ - zfs-pool-v12.dat.bz2 \ - zfs-pool-v13.dat.bz2 \ - zfs-pool-v14.dat.bz2 \ - zfs-pool-v15.dat.bz2 \ - zfs-pool-v1mirror1.dat.bz2 \ - zfs-pool-v1mirror2.dat.bz2 \ - zfs-pool-v1mirror3.dat.bz2 \ - zfs-pool-v1raidz1.dat.bz2 \ - zfs-pool-v1raidz2.dat.bz2 \ - zfs-pool-v1raidz3.dat.bz2 \ - zfs-pool-v1stripe1.dat.bz2 \ - zfs-pool-v1stripe2.dat.bz2 \ - zfs-pool-v1stripe3.dat.bz2 \ - zfs-pool-v2.dat.bz2 \ - zfs-pool-v2mirror1.dat.bz2 \ - zfs-pool-v2mirror2.dat.bz2 \ - zfs-pool-v2mirror3.dat.bz2 \ - zfs-pool-v2raidz1.dat.bz2 \ - zfs-pool-v2raidz2.dat.bz2 \ - zfs-pool-v2raidz3.dat.bz2 \ - zfs-pool-v2stripe1.dat.bz2 \ - zfs-pool-v2stripe2.dat.bz2 \ - zfs-pool-v2stripe3.dat.bz2 \ - zfs-pool-v3.dat.bz2 \ - zfs-pool-v3hotspare1.dat.bz2 \ - zfs-pool-v3hotspare2.dat.bz2 \ - zfs-pool-v3hotspare3.dat.bz2 \ - zfs-pool-v3mirror1.dat.bz2 \ - zfs-pool-v3mirror2.dat.bz2 \ - zfs-pool-v3mirror3.dat.bz2 \ - zfs-pool-v3raidz1.dat.bz2 \ - zfs-pool-v3raidz2.dat.bz2 \ - zfs-pool-v3raidz21.dat.bz2 \ - zfs-pool-v3raidz22.dat.bz2 \ - zfs-pool-v3raidz23.dat.bz2 \ - zfs-pool-v3raidz3.dat.bz2 \ - zfs-pool-v3stripe1.dat.bz2 \ - zfs-pool-v3stripe2.dat.bz2 \ - zfs-pool-v3stripe3.dat.bz2 \ - zfs-pool-v4.dat.bz2 \ - zfs-pool-v5.dat.bz2 \ - zfs-pool-v6.dat.bz2 \ - zfs-pool-v7.dat.bz2 \ - zfs-pool-v8.dat.bz2 \ - zfs-pool-v9.dat.bz2 \ - zfs-pool-v999.dat.bz2 \ - zfs-pool-vBROKEN.dat.bz2 diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile.am deleted file mode 100644 index 45ab8e3d4f18..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_wait -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_wait_discard.ksh \ - zpool_wait_freeing.ksh \ - zpool_wait_initialize_basic.ksh \ - zpool_wait_initialize_cancel.ksh \ - zpool_wait_initialize_flag.ksh \ - zpool_wait_multiple.ksh \ - zpool_wait_no_activity.ksh \ - zpool_wait_remove.ksh \ - zpool_wait_remove_cancel.ksh \ - zpool_wait_trim_basic.ksh \ - zpool_wait_trim_cancel.ksh \ - zpool_wait_trim_flag.ksh \ - zpool_wait_usage.ksh - -dist_pkgdata_DATA = \ - zpool_wait.kshlib - -SUBDIRS = scan diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile.am deleted file mode 100644 index 451d83a79aa6..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_wait/scan -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_wait_replace.ksh \ - zpool_wait_replace_cancel.ksh \ - zpool_wait_rebuild.ksh \ - zpool_wait_resilver.ksh \ - zpool_wait_scrub_basic.ksh \ - zpool_wait_scrub_cancel.ksh \ - zpool_wait_scrub_flag.ksh diff --git a/tests/zfs-tests/tests/functional/cli_user/Makefile.am b/tests/zfs-tests/tests/functional/cli_user/Makefile.am deleted file mode 100644 index 119f8ee187f6..000000000000 --- a/tests/zfs-tests/tests/functional/cli_user/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -SUBDIRS = \ - misc \ - zfs_list \ - zpool_iostat \ - zpool_list \ - zpool_status diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am b/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am deleted file mode 100644 index 2d38e65777f7..000000000000 --- a/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/misc -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zdb_001_neg.ksh \ - zfs_001_neg.ksh \ - zfs_allow_001_neg.ksh \ - zfs_clone_001_neg.ksh \ - zfs_create_001_neg.ksh \ - zfs_destroy_001_neg.ksh \ - zfs_get_001_neg.ksh \ - zfs_inherit_001_neg.ksh \ - zfs_mount_001_neg.ksh \ - zfs_promote_001_neg.ksh \ - zfs_receive_001_neg.ksh \ - zfs_rename_001_neg.ksh \ - zfs_rollback_001_neg.ksh \ - zfs_send_001_neg.ksh \ - zfs_set_001_neg.ksh \ - zfs_share_001_neg.ksh \ - zfs_snapshot_001_neg.ksh \ - zfs_unallow_001_neg.ksh \ - zfs_unmount_001_neg.ksh \ - zfs_unshare_001_neg.ksh \ - zfs_upgrade_001_neg.ksh \ - zpool_001_neg.ksh \ - zpool_add_001_neg.ksh \ - zpool_attach_001_neg.ksh \ - zpool_clear_001_neg.ksh \ - zpool_create_001_neg.ksh \ - zpool_destroy_001_neg.ksh \ - zpool_detach_001_neg.ksh \ - zpool_export_001_neg.ksh \ - zpool_get_001_neg.ksh \ - zpool_history_001_neg.ksh \ - zpool_import_001_neg.ksh \ - zpool_import_002_neg.ksh \ - zpool_offline_001_neg.ksh \ - zpool_online_001_neg.ksh \ - zpool_remove_001_neg.ksh \ - zpool_replace_001_neg.ksh \ - zpool_scrub_001_neg.ksh \ - zpool_set_001_neg.ksh \ - zpool_status_001_neg.ksh \ - zpool_upgrade_001_neg.ksh \ - arcstat_001_pos.ksh \ - arc_summary_001_pos.ksh \ - arc_summary_002_neg.ksh \ - zpool_wait_privilege.ksh - -dist_pkgdata_DATA = \ - misc.cfg diff --git a/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am b/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am deleted file mode 100644 index 81754f401595..000000000000 --- a/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/zfs_list -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zfs_list_001_pos.ksh \ - zfs_list_002_pos.ksh \ - zfs_list_003_pos.ksh \ - zfs_list_004_neg.ksh \ - zfs_list_005_neg.ksh \ - zfs_list_007_pos.ksh \ - zfs_list_008_neg.ksh - -dist_pkgdata_DATA = \ - zfs_list.cfg \ - zfs_list.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile.am b/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile.am deleted file mode 100644 index 5ee30eafc358..000000000000 --- a/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/zpool_iostat -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_iostat_001_neg.ksh \ - zpool_iostat_002_pos.ksh \ - zpool_iostat_003_neg.ksh \ - zpool_iostat_004_pos.ksh \ - zpool_iostat_005_pos.ksh \ - zpool_iostat_-c_disable.ksh \ - zpool_iostat_-c_searchpath.ksh \ - zpool_iostat_-c_homedir.ksh diff --git a/tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile.am b/tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile.am deleted file mode 100644 index de8cb366924d..000000000000 --- a/tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/zpool_list -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_list_001_pos.ksh \ - zpool_list_002_neg.ksh diff --git a/tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile.am b/tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile.am deleted file mode 100644 index e1b339657749..000000000000 --- a/tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/zpool_status -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_status_003_pos.ksh \ - zpool_status_-c_disable.ksh \ - zpool_status_-c_homedir.ksh \ - zpool_status_-c_searchpath.ksh diff --git a/tests/zfs-tests/tests/functional/compression/Makefile.am b/tests/zfs-tests/tests/functional/compression/Makefile.am deleted file mode 100644 index 817bd41e8075..000000000000 --- a/tests/zfs-tests/tests/functional/compression/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/compression -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - compress_001_pos.ksh \ - compress_002_pos.ksh \ - compress_003_pos.ksh \ - compress_004_pos.ksh \ - compress_zstd_bswap.ksh \ - l2arc_compressed_arc.ksh \ - l2arc_compressed_arc_disabled.ksh \ - l2arc_encrypted.ksh \ - l2arc_encrypted_no_compressed_arc.ksh - -dist_pkgdata_DATA = \ - compress.cfg \ - testpool_zstd.tar.gz diff --git a/tests/zfs-tests/tests/functional/cp_files/Makefile.am b/tests/zfs-tests/tests/functional/cp_files/Makefile.am deleted file mode 100644 index 92e258f0d26d..000000000000 --- a/tests/zfs-tests/tests/functional/cp_files/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cp_files - -dist_pkgdata_SCRIPTS = \ - cp_files_001_pos.ksh \ - cleanup.ksh \ - setup.ksh diff --git a/tests/zfs-tests/tests/functional/crtime/Makefile.am b/tests/zfs-tests/tests/functional/crtime/Makefile.am deleted file mode 100644 index 13e1c2dde31b..000000000000 --- a/tests/zfs-tests/tests/functional/crtime/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/crtime -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - crtime_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/ctime/Makefile.am b/tests/zfs-tests/tests/functional/ctime/Makefile.am deleted file mode 100644 index 724e5b99eee4..000000000000 --- a/tests/zfs-tests/tests/functional/ctime/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/ctime - -dist_pkgdata_SCRIPTS = \ - ctime_001_pos.ksh \ - cleanup.ksh \ - setup.ksh diff --git a/tests/zfs-tests/tests/functional/deadman/Makefile.am b/tests/zfs-tests/tests/functional/deadman/Makefile.am deleted file mode 100644 index 097f23e88404..000000000000 --- a/tests/zfs-tests/tests/functional/deadman/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/deadman -dist_pkgdata_SCRIPTS = \ - deadman_ratelimit.ksh \ - deadman_sync.ksh \ - deadman_zio.ksh - -dist_pkgdata_DATA = \ - deadman.cfg diff --git a/tests/zfs-tests/tests/functional/delegate/Makefile.am b/tests/zfs-tests/tests/functional/delegate/Makefile.am deleted file mode 100644 index c33da3374d88..000000000000 --- a/tests/zfs-tests/tests/functional/delegate/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/delegate -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zfs_allow_001_pos.ksh \ - zfs_allow_002_pos.ksh \ - zfs_allow_003_pos.ksh \ - zfs_allow_004_pos.ksh \ - zfs_allow_005_pos.ksh \ - zfs_allow_006_pos.ksh \ - zfs_allow_007_pos.ksh \ - zfs_allow_008_pos.ksh \ - zfs_allow_009_neg.ksh \ - zfs_allow_010_pos.ksh \ - zfs_allow_011_neg.ksh \ - zfs_allow_012_neg.ksh \ - zfs_unallow_001_pos.ksh \ - zfs_unallow_002_pos.ksh \ - zfs_unallow_003_pos.ksh \ - zfs_unallow_004_pos.ksh \ - zfs_unallow_005_pos.ksh \ - zfs_unallow_006_pos.ksh \ - zfs_unallow_007_neg.ksh \ - zfs_unallow_008_neg.ksh - -dist_pkgdata_DATA = \ - delegate.cfg \ - delegate_common.kshlib diff --git a/tests/zfs-tests/tests/functional/devices/Makefile.am b/tests/zfs-tests/tests/functional/devices/Makefile.am deleted file mode 100644 index 42f59428d4ca..000000000000 --- a/tests/zfs-tests/tests/functional/devices/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/devices -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - devices_001_pos.ksh \ - devices_002_neg.ksh \ - devices_003_pos.ksh - -dist_pkgdata_DATA = \ - devices.cfg \ - devices_common.kshlib diff --git a/tests/zfs-tests/tests/functional/dos_attributes/Makefile.am b/tests/zfs-tests/tests/functional/dos_attributes/Makefile.am deleted file mode 100644 index 436bcdb1f31e..000000000000 --- a/tests/zfs-tests/tests/functional/dos_attributes/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/dos_attributes -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - read_dos_attrs_001.ksh \ - write_dos_attrs_001.ksh \ - setup.ksh diff --git a/tests/zfs-tests/tests/functional/events/Makefile.am b/tests/zfs-tests/tests/functional/events/Makefile.am deleted file mode 100644 index 7d8ae6167637..000000000000 --- a/tests/zfs-tests/tests/functional/events/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/events -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - events_001_pos.ksh \ - events_002_pos.ksh \ - zed_rc_filter.ksh \ - zed_fd_spill.ksh - -dist_pkgdata_DATA = \ - events.cfg \ - events_common.kshlib diff --git a/tests/zfs-tests/tests/functional/exec/Makefile.am b/tests/zfs-tests/tests/functional/exec/Makefile.am deleted file mode 100644 index 524bf2734f73..000000000000 --- a/tests/zfs-tests/tests/functional/exec/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/exec - -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - exec_001_pos.ksh \ - exec_002_neg.ksh diff --git a/tests/zfs-tests/tests/functional/fallocate/Makefile.am b/tests/zfs-tests/tests/functional/fallocate/Makefile.am deleted file mode 100644 index 86364d7895dd..000000000000 --- a/tests/zfs-tests/tests/functional/fallocate/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/fallocate -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - fallocate_prealloc.ksh \ - fallocate_punch-hole.ksh \ - fallocate_zero-range.ksh diff --git a/tests/zfs-tests/tests/functional/fault/Makefile.am b/tests/zfs-tests/tests/functional/fault/Makefile.am deleted file mode 100644 index ba0d7d6992c6..000000000000 --- a/tests/zfs-tests/tests/functional/fault/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/fault -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - auto_offline_001_pos.ksh \ - auto_online_001_pos.ksh \ - auto_online_002_pos.ksh \ - auto_replace_001_pos.ksh \ - auto_spare_001_pos.ksh \ - auto_spare_002_pos.ksh \ - auto_spare_ashift.ksh \ - auto_spare_multiple.ksh \ - auto_spare_shared.ksh \ - decrypt_fault.ksh \ - decompress_fault.ksh \ - scrub_after_resilver.ksh \ - zpool_status_-s.ksh - -dist_pkgdata_DATA = \ - fault.cfg diff --git a/tests/zfs-tests/tests/functional/features/Makefile.am b/tests/zfs-tests/tests/functional/features/Makefile.am deleted file mode 100644 index 3657461e6604..000000000000 --- a/tests/zfs-tests/tests/functional/features/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -SUBDIRS = \ - async_destroy \ - large_dnode diff --git a/tests/zfs-tests/tests/functional/features/async_destroy/Makefile.am b/tests/zfs-tests/tests/functional/features/async_destroy/Makefile.am deleted file mode 100644 index 4c777878d689..000000000000 --- a/tests/zfs-tests/tests/functional/features/async_destroy/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/features/async_destroy -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - async_destroy_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am b/tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am deleted file mode 100644 index 13ba3ab33d9e..000000000000 --- a/tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/features/large_dnode -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - large_dnode_001_pos.ksh \ - large_dnode_002_pos.ksh \ - large_dnode_003_pos.ksh \ - large_dnode_004_neg.ksh \ - large_dnode_005_pos.ksh \ - large_dnode_006_pos.ksh \ - large_dnode_007_neg.ksh \ - large_dnode_008_pos.ksh \ - large_dnode_009_pos.ksh diff --git a/tests/zfs-tests/tests/functional/grow/Makefile.am b/tests/zfs-tests/tests/functional/grow/Makefile.am deleted file mode 100644 index 807610a067d8..000000000000 --- a/tests/zfs-tests/tests/functional/grow/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/grow -dist_pkgdata_SCRIPTS = \ - grow_pool_001_pos.ksh \ - grow_replicas_001_pos.ksh - -dist_pkgdata_DATA = \ - grow.cfg diff --git a/tests/zfs-tests/tests/functional/history/Makefile.am b/tests/zfs-tests/tests/functional/history/Makefile.am deleted file mode 100644 index b865a319a430..000000000000 --- a/tests/zfs-tests/tests/functional/history/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/history -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - history_001_pos.ksh \ - history_002_pos.ksh \ - history_003_pos.ksh \ - history_004_pos.ksh \ - history_005_neg.ksh \ - history_006_neg.ksh \ - history_007_pos.ksh \ - history_008_pos.ksh \ - history_009_pos.ksh \ - history_010_pos.ksh - -dist_pkgdata_DATA = \ - history.cfg \ - history_common.kshlib \ - i386.migratedpool.DAT.Z \ - i386.orig_history.txt \ - sparc.migratedpool.DAT.Z \ - sparc.orig_history.txt \ - zfs-pool-v4.dat.Z diff --git a/tests/zfs-tests/tests/functional/inheritance/Makefile.am b/tests/zfs-tests/tests/functional/inheritance/Makefile.am deleted file mode 100644 index 3c624621f28a..000000000000 --- a/tests/zfs-tests/tests/functional/inheritance/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/inheritance -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - inherit_001_pos.ksh - -dist_pkgdata_DATA = \ - README.config \ - README.state \ - inherit.kshlib \ - config001.cfg \ - config002.cfg \ - config003.cfg \ - config004.cfg \ - config005.cfg \ - config006.cfg \ - config007.cfg \ - config008.cfg \ - config009.cfg \ - config010.cfg \ - config011.cfg \ - config012.cfg \ - config013.cfg \ - config014.cfg \ - config015.cfg \ - config016.cfg \ - config017.cfg \ - config018.cfg \ - config019.cfg \ - config020.cfg \ - config021.cfg \ - config022.cfg \ - config023.cfg \ - config024.cfg \ - state001.cfg \ - state002.cfg \ - state003.cfg \ - state004.cfg \ - state005.cfg \ - state006.cfg \ - state007.cfg \ - state008.cfg \ - state009.cfg \ - state010.cfg \ - state011.cfg \ - state012.cfg \ - state013.cfg \ - state014.cfg \ - state015.cfg \ - state016.cfg \ - state017.cfg \ - state018.cfg \ - state019.cfg \ - state020.cfg \ - state021.cfg \ - state022.cfg \ - state023.cfg \ - state024.cfg diff --git a/tests/zfs-tests/tests/functional/inuse/Makefile.am b/tests/zfs-tests/tests/functional/inuse/Makefile.am deleted file mode 100644 index c541e57eaa31..000000000000 --- a/tests/zfs-tests/tests/functional/inuse/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/inuse -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - inuse_001_pos.ksh \ - inuse_003_pos.ksh \ - inuse_004_pos.ksh \ - inuse_005_pos.ksh \ - inuse_006_pos.ksh \ - inuse_007_pos.ksh \ - inuse_008_pos.ksh \ - inuse_009_pos.ksh - -dist_pkgdata_DATA = \ - inuse.cfg diff --git a/tests/zfs-tests/tests/functional/io/Makefile.am b/tests/zfs-tests/tests/functional/io/Makefile.am deleted file mode 100644 index 44c0d02d6efe..000000000000 --- a/tests/zfs-tests/tests/functional/io/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/io -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - sync.ksh \ - psync.ksh \ - libaio.ksh \ - io_uring.ksh \ - posixaio.ksh \ - mmap.ksh - -dist_pkgdata_DATA = \ - io.cfg diff --git a/tests/zfs-tests/tests/functional/l2arc/Makefile.am b/tests/zfs-tests/tests/functional/l2arc/Makefile.am deleted file mode 100644 index 09f4c1d0d74f..000000000000 --- a/tests/zfs-tests/tests/functional/l2arc/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/l2arc -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - l2arc_arcstats_pos.ksh \ - l2arc_l2miss_pos.ksh \ - l2arc_mfuonly_pos.ksh \ - persist_l2arc_001_pos.ksh \ - persist_l2arc_002_pos.ksh \ - persist_l2arc_003_neg.ksh \ - persist_l2arc_004_pos.ksh \ - persist_l2arc_005_pos.ksh - -dist_pkgdata_DATA = \ - l2arc.cfg diff --git a/tests/zfs-tests/tests/functional/large_files/Makefile.am b/tests/zfs-tests/tests/functional/large_files/Makefile.am deleted file mode 100644 index 0e471533090c..000000000000 --- a/tests/zfs-tests/tests/functional/large_files/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/large_files -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - large_files_001_pos.ksh \ - large_files_002_pos.ksh diff --git a/tests/zfs-tests/tests/functional/largest_pool/Makefile.am b/tests/zfs-tests/tests/functional/largest_pool/Makefile.am deleted file mode 100644 index 5f1473dede70..000000000000 --- a/tests/zfs-tests/tests/functional/largest_pool/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/largest_pool -dist_pkgdata_SCRIPTS = \ - largest_pool_001_pos.ksh - -dist_pkgdata_DATA = \ - largest_pool.cfg diff --git a/tests/zfs-tests/tests/functional/libzfs/Makefile.am b/tests/zfs-tests/tests/functional/libzfs/Makefile.am deleted file mode 100644 index fb1374255a6a..000000000000 --- a/tests/zfs-tests/tests/functional/libzfs/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/libzfs - -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - libzfs_input.ksh diff --git a/tests/zfs-tests/tests/functional/limits/Makefile.am b/tests/zfs-tests/tests/functional/limits/Makefile.am deleted file mode 100644 index 72455922485d..000000000000 --- a/tests/zfs-tests/tests/functional/limits/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/limits -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - filesystem_count.ksh \ - filesystem_limit.ksh \ - snapshot_count.ksh \ - snapshot_limit.ksh - diff --git a/tests/zfs-tests/tests/functional/link_count/Makefile.am b/tests/zfs-tests/tests/functional/link_count/Makefile.am deleted file mode 100644 index bfb7154a6518..000000000000 --- a/tests/zfs-tests/tests/functional/link_count/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/link_count -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - link_count_001.ksh \ - link_count_root_inode.ksh diff --git a/tests/zfs-tests/tests/functional/log_spacemap/Makefile.am b/tests/zfs-tests/tests/functional/log_spacemap/Makefile.am deleted file mode 100644 index a1e523426c6a..000000000000 --- a/tests/zfs-tests/tests/functional/log_spacemap/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/log_spacemap -dist_pkgdata_SCRIPTS = log_spacemap_import_logs.ksh diff --git a/tests/zfs-tests/tests/functional/migration/Makefile.am b/tests/zfs-tests/tests/functional/migration/Makefile.am deleted file mode 100644 index 9c4f244156ce..000000000000 --- a/tests/zfs-tests/tests/functional/migration/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/migration -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - migration_001_pos.ksh \ - migration_002_pos.ksh \ - migration_003_pos.ksh \ - migration_004_pos.ksh \ - migration_005_pos.ksh \ - migration_006_pos.ksh \ - migration_007_pos.ksh \ - migration_008_pos.ksh \ - migration_009_pos.ksh \ - migration_010_pos.ksh \ - migration_011_pos.ksh \ - migration_012_pos.ksh - -dist_pkgdata_DATA = \ - migration.cfg \ - migration.kshlib diff --git a/tests/zfs-tests/tests/functional/mmap/Makefile.am b/tests/zfs-tests/tests/functional/mmap/Makefile.am deleted file mode 100644 index 574df479f00b..000000000000 --- a/tests/zfs-tests/tests/functional/mmap/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mmap -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - mmap_read_001_pos.ksh \ - mmap_write_001_pos.ksh \ - mmap_libaio_001_pos.ksh \ - mmap_seek_001_pos.ksh \ - mmap_sync_001_pos.ksh - -dist_pkgdata_DATA = \ - mmap.cfg diff --git a/tests/zfs-tests/tests/functional/mmp/Makefile.am b/tests/zfs-tests/tests/functional/mmp/Makefile.am deleted file mode 100644 index 2848fd4ce692..000000000000 --- a/tests/zfs-tests/tests/functional/mmp/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mmp -dist_pkgdata_SCRIPTS = \ - multihost_history.ksh \ - mmp_on_thread.ksh \ - mmp_on_uberblocks.ksh \ - mmp_on_off.ksh \ - mmp_interval.ksh \ - mmp_active_import.ksh \ - mmp_inactive_import.ksh \ - mmp_exported_import.ksh \ - mmp_write_uberblocks.ksh \ - mmp_reset_interval.ksh \ - mmp_on_zdb.ksh \ - mmp_write_distribution.ksh \ - mmp_hostid.ksh \ - setup.ksh \ - cleanup.ksh - -dist_pkgdata_DATA = \ - mmp.kshlib \ - mmp.cfg diff --git a/tests/zfs-tests/tests/functional/mount/Makefile.am b/tests/zfs-tests/tests/functional/mount/Makefile.am deleted file mode 100644 index bdafa69badd8..000000000000 --- a/tests/zfs-tests/tests/functional/mount/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mount -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - umount_001.ksh \ - umount_unlinked_drain.ksh \ - umountall_001.ksh diff --git a/tests/zfs-tests/tests/functional/mv_files/Makefile.am b/tests/zfs-tests/tests/functional/mv_files/Makefile.am deleted file mode 100644 index cec02140e307..000000000000 --- a/tests/zfs-tests/tests/functional/mv_files/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mv_files -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - mv_files_001_pos.ksh \ - mv_files_002_pos.ksh \ - random_creation.ksh - -dist_pkgdata_DATA = \ - mv_files.cfg \ - mv_files_common.kshlib diff --git a/tests/zfs-tests/tests/functional/nestedfs/Makefile.am b/tests/zfs-tests/tests/functional/nestedfs/Makefile.am deleted file mode 100644 index 6a5ecf2d9a7f..000000000000 --- a/tests/zfs-tests/tests/functional/nestedfs/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/nestedfs -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - nestedfs_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/no_space/Makefile.am b/tests/zfs-tests/tests/functional/no_space/Makefile.am deleted file mode 100644 index 31584fb17583..000000000000 --- a/tests/zfs-tests/tests/functional/no_space/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/no_space -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - enospc_001_pos.ksh \ - enospc_002_pos.ksh \ - enospc_003_pos.ksh \ - enospc_df.ksh \ - enospc_rm.ksh - -dist_pkgdata_DATA = \ - enospc.cfg diff --git a/tests/zfs-tests/tests/functional/nopwrite/Makefile.am b/tests/zfs-tests/tests/functional/nopwrite/Makefile.am deleted file mode 100644 index 3f893c6382e6..000000000000 --- a/tests/zfs-tests/tests/functional/nopwrite/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/nopwrite -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - nopwrite_copies.ksh \ - nopwrite_mtime.ksh \ - nopwrite_negative.ksh \ - nopwrite_promoted_clone.ksh \ - nopwrite_recsize.ksh \ - nopwrite_sync.ksh \ - nopwrite_varying_compression.ksh \ - nopwrite_volume.ksh - -dist_pkgdata_DATA = \ - nopwrite.shlib diff --git a/tests/zfs-tests/tests/functional/online_offline/Makefile.am b/tests/zfs-tests/tests/functional/online_offline/Makefile.am deleted file mode 100644 index bd23f89e538a..000000000000 --- a/tests/zfs-tests/tests/functional/online_offline/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/online_offline -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - online_offline_001_pos.ksh \ - online_offline_002_neg.ksh \ - online_offline_003_neg.ksh - -dist_pkgdata_DATA = \ - online_offline.cfg diff --git a/tests/zfs-tests/tests/functional/pam/Makefile.am b/tests/zfs-tests/tests/functional/pam/Makefile.am deleted file mode 100644 index 2ae5f8ff0fa3..000000000000 --- a/tests/zfs-tests/tests/functional/pam/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pam -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - pam_basic.ksh \ - pam_nounmount.ksh \ - pam_short_password.ksh \ - utilities.kshlib - -% : %.in - sed 's|@pammoduledir[@]|@pammoduledir@|g' $< > $@ diff --git a/tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am b/tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am deleted file mode 100644 index cc1c1183db79..000000000000 --- a/tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pool_checkpoint -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - checkpoint_after_rewind.ksh \ - checkpoint_big_rewind.ksh \ - checkpoint_capacity.ksh \ - checkpoint_conf_change.ksh \ - checkpoint_discard_busy.ksh \ - checkpoint_discard.ksh \ - checkpoint_discard_many.ksh \ - checkpoint_indirect.ksh \ - checkpoint_invalid.ksh \ - checkpoint_lun_expsz.ksh \ - checkpoint_open.ksh \ - checkpoint_removal.ksh \ - checkpoint_rewind.ksh \ - checkpoint_ro_rewind.ksh \ - checkpoint_sm_scale.ksh \ - checkpoint_twice.ksh \ - checkpoint_vdev_add.ksh \ - checkpoint_zdb.ksh \ - checkpoint_zhack_feat.ksh - -dist_pkgdata_DATA = \ - pool_checkpoint.kshlib diff --git a/tests/zfs-tests/tests/functional/pool_names/Makefile.am b/tests/zfs-tests/tests/functional/pool_names/Makefile.am deleted file mode 100644 index cd874861f0ac..000000000000 --- a/tests/zfs-tests/tests/functional/pool_names/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pool_names -dist_pkgdata_SCRIPTS = \ - pool_names_001_pos.ksh \ - pool_names_002_neg.ksh diff --git a/tests/zfs-tests/tests/functional/poolversion/Makefile.am b/tests/zfs-tests/tests/functional/poolversion/Makefile.am deleted file mode 100644 index 51c2046457df..000000000000 --- a/tests/zfs-tests/tests/functional/poolversion/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/poolversion -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - poolversion_001_pos.ksh \ - poolversion_002_pos.ksh diff --git a/tests/zfs-tests/tests/functional/privilege/Makefile.am b/tests/zfs-tests/tests/functional/privilege/Makefile.am deleted file mode 100644 index ef26a750bb00..000000000000 --- a/tests/zfs-tests/tests/functional/privilege/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/privilege -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - privilege_001_pos.ksh \ - privilege_002_pos.ksh diff --git a/tests/zfs-tests/tests/functional/procfs/Makefile.am b/tests/zfs-tests/tests/functional/procfs/Makefile.am deleted file mode 100644 index a7f022d9f210..000000000000 --- a/tests/zfs-tests/tests/functional/procfs/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/procfs -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - procfs_list_basic.ksh \ - procfs_list_concurrent_readers.ksh \ - procfs_list_stale_read.ksh \ - pool_state.ksh diff --git a/tests/zfs-tests/tests/functional/projectquota/Makefile.am b/tests/zfs-tests/tests/functional/projectquota/Makefile.am deleted file mode 100644 index e98c8672802e..000000000000 --- a/tests/zfs-tests/tests/functional/projectquota/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/projectquota -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - projectid_001_pos.ksh \ - projectid_002_pos.ksh \ - projectid_003_pos.ksh \ - projectquota_001_pos.ksh \ - projectquota_002_pos.ksh \ - projectquota_003_pos.ksh \ - projectquota_004_neg.ksh \ - projectquota_005_pos.ksh \ - projectquota_006_pos.ksh \ - projectquota_007_pos.ksh \ - projectquota_008_pos.ksh \ - projectquota_009_pos.ksh \ - projectspace_001_pos.ksh \ - projectspace_002_pos.ksh \ - projectspace_003_pos.ksh \ - projectspace_004_pos.ksh \ - projecttree_001_pos.ksh \ - projecttree_002_pos.ksh \ - projecttree_003_neg.ksh - -dist_pkgdata_DATA = \ - projectquota.cfg \ - projectquota_common.kshlib diff --git a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am deleted file mode 100644 index 0817896378e1..000000000000 --- a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am - -pkgpyzfsdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pyzfs -pkgpyzfs_SCRIPTS = \ - pyzfs_unittest.ksh - -SUBSTFILES += $(pkgpyzfs_SCRIPTS) diff --git a/tests/zfs-tests/tests/functional/quota/Makefile.am b/tests/zfs-tests/tests/functional/quota/Makefile.am deleted file mode 100644 index ba18bff7ecb7..000000000000 --- a/tests/zfs-tests/tests/functional/quota/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/quota -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - quota_001_pos.ksh \ - quota_002_pos.ksh \ - quota_003_pos.ksh \ - quota_004_pos.ksh \ - quota_005_pos.ksh \ - quota_006_neg.ksh - -dist_pkgdata_DATA = \ - quota.cfg \ - quota.kshlib diff --git a/tests/zfs-tests/tests/functional/raidz/Makefile.am b/tests/zfs-tests/tests/functional/raidz/Makefile.am deleted file mode 100644 index d93eb73cf832..000000000000 --- a/tests/zfs-tests/tests/functional/raidz/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/raidz -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - raidz_001_neg.ksh \ - raidz_002_pos.ksh \ - raidz_003_pos.ksh \ - raidz_004_pos.ksh diff --git a/tests/zfs-tests/tests/functional/redacted_send/Makefile.am b/tests/zfs-tests/tests/functional/redacted_send/Makefile.am deleted file mode 100644 index 61d0ea21356e..000000000000 --- a/tests/zfs-tests/tests/functional/redacted_send/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/redacted_send -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - redacted_compressed.ksh \ - redacted_contents.ksh \ - redacted_deleted.ksh \ - redacted_disabled_feature.ksh \ - redacted_embedded.ksh \ - redacted_holes.ksh \ - redacted_incrementals.ksh \ - redacted_largeblocks.ksh \ - redacted_many_clones.ksh \ - redacted_mixed_recsize.ksh \ - redacted_mounts.ksh \ - redacted_negative.ksh \ - redacted_origin.ksh \ - redacted_panic.ksh \ - redacted_props.ksh \ - redacted_resume.ksh \ - redacted_size.ksh \ - redacted_volume.ksh - -dist_pkgdata_DATA = \ - redacted.cfg \ - redacted.kshlib diff --git a/tests/zfs-tests/tests/functional/redundancy/Makefile.am b/tests/zfs-tests/tests/functional/redundancy/Makefile.am deleted file mode 100644 index 42c11c4aa957..000000000000 --- a/tests/zfs-tests/tests/functional/redundancy/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/redundancy -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - redundancy_draid.ksh \ - redundancy_draid1.ksh \ - redundancy_draid2.ksh \ - redundancy_draid3.ksh \ - redundancy_draid_damaged.ksh \ - redundancy_draid_spare1.ksh \ - redundancy_draid_spare2.ksh \ - redundancy_draid_spare3.ksh \ - redundancy_mirror.ksh \ - redundancy_raidz.ksh \ - redundancy_raidz1.ksh \ - redundancy_raidz2.ksh \ - redundancy_raidz3.ksh \ - redundancy_stripe.ksh - -dist_pkgdata_DATA = \ - redundancy.cfg \ - redundancy.kshlib diff --git a/tests/zfs-tests/tests/functional/refquota/Makefile.am b/tests/zfs-tests/tests/functional/refquota/Makefile.am deleted file mode 100644 index 1d8418fbbec5..000000000000 --- a/tests/zfs-tests/tests/functional/refquota/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/refquota -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - refquota_001_pos.ksh \ - refquota_002_pos.ksh \ - refquota_003_pos.ksh \ - refquota_004_pos.ksh \ - refquota_005_pos.ksh \ - refquota_006_neg.ksh \ - refquota_007_neg.ksh \ - refquota_008_neg.ksh diff --git a/tests/zfs-tests/tests/functional/refreserv/Makefile.am b/tests/zfs-tests/tests/functional/refreserv/Makefile.am deleted file mode 100644 index bd760a1f0697..000000000000 --- a/tests/zfs-tests/tests/functional/refreserv/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/refreserv -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - refreserv_001_pos.ksh \ - refreserv_002_pos.ksh \ - refreserv_003_pos.ksh \ - refreserv_004_pos.ksh \ - refreserv_005_pos.ksh \ - refreserv_multi_raidz.ksh \ - refreserv_raidz.ksh - -dist_pkgdata_DATA = \ - refreserv.cfg diff --git a/tests/zfs-tests/tests/functional/removal/Makefile.am b/tests/zfs-tests/tests/functional/removal/Makefile.am deleted file mode 100644 index 878935b96d3c..000000000000 --- a/tests/zfs-tests/tests/functional/removal/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# -# 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 (c) 2014, 2019 by Delphix. All rights reserved. -# - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/removal - -dist_pkgdata_SCRIPTS = \ - cleanup.ksh removal_all_vdev.ksh removal_cancel.ksh \ - removal_check_space.ksh removal_condense_export.ksh \ - removal_multiple_indirection.ksh \ - removal_nopwrite.ksh removal_remap_deadlists.ksh \ - removal_reservation.ksh removal_resume_export.ksh \ - removal_sanity.ksh removal_with_add.ksh removal_with_create_fs.ksh \ - removal_with_dedup.ksh removal_with_errors.ksh \ - removal_with_export.ksh removal_with_faulted.ksh \ - removal_with_ganging.ksh \ - removal_with_remove.ksh removal_with_scrub.ksh \ - removal_with_send.ksh removal_with_send_recv.ksh \ - removal_with_snapshot.ksh removal_with_write.ksh \ - removal_with_zdb.ksh remove_mirror.ksh remove_mirror_sanity.ksh \ - remove_raidz.ksh remove_expanded.ksh remove_indirect.ksh \ - remove_attach_mirror.ksh - -dist_pkgdata_DATA = \ - removal.kshlib - -pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/removal diff --git a/tests/zfs-tests/tests/functional/rename_dirs/Makefile.am b/tests/zfs-tests/tests/functional/rename_dirs/Makefile.am deleted file mode 100644 index 029daf1f564b..000000000000 --- a/tests/zfs-tests/tests/functional/rename_dirs/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/rename_dirs -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - rename_dirs_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/replacement/Makefile.am b/tests/zfs-tests/tests/functional/replacement/Makefile.am deleted file mode 100644 index fe6e4912198d..000000000000 --- a/tests/zfs-tests/tests/functional/replacement/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/replacement -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - attach_import.ksh \ - attach_multiple.ksh \ - attach_rebuild.ksh \ - attach_resilver.ksh \ - detach.ksh \ - rebuild_disabled_feature.ksh \ - rebuild_multiple.ksh \ - rebuild_raidz.ksh \ - replace_import.ksh \ - replace_rebuild.ksh \ - replace_resilver.ksh \ - resilver_restart_001.ksh \ - resilver_restart_002.ksh \ - scrub_cancel.ksh - -dist_pkgdata_DATA = \ - replacement.cfg diff --git a/tests/zfs-tests/tests/functional/reservation/Makefile.am b/tests/zfs-tests/tests/functional/reservation/Makefile.am deleted file mode 100644 index 8eaf09861551..000000000000 --- a/tests/zfs-tests/tests/functional/reservation/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/reservation -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - reservation_001_pos.ksh \ - reservation_002_pos.ksh \ - reservation_003_pos.ksh \ - reservation_004_pos.ksh \ - reservation_005_pos.ksh \ - reservation_006_pos.ksh \ - reservation_007_pos.ksh \ - reservation_008_pos.ksh \ - reservation_009_pos.ksh \ - reservation_010_pos.ksh \ - reservation_011_pos.ksh \ - reservation_012_pos.ksh \ - reservation_013_pos.ksh \ - reservation_014_pos.ksh \ - reservation_015_pos.ksh \ - reservation_016_pos.ksh \ - reservation_017_pos.ksh \ - reservation_018_pos.ksh \ - reservation_019_pos.ksh \ - reservation_020_pos.ksh \ - reservation_021_neg.ksh \ - reservation_022_pos.ksh - -dist_pkgdata_DATA = \ - reservation.cfg \ - reservation.shlib diff --git a/tests/zfs-tests/tests/functional/rootpool/Makefile.am b/tests/zfs-tests/tests/functional/rootpool/Makefile.am deleted file mode 100644 index ca5ad14fdbb1..000000000000 --- a/tests/zfs-tests/tests/functional/rootpool/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/rootpool -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - rootpool_002_neg.ksh \ - rootpool_003_neg.ksh \ - rootpool_007_pos.ksh diff --git a/tests/zfs-tests/tests/functional/rsend/Makefile.am b/tests/zfs-tests/tests/functional/rsend/Makefile.am deleted file mode 100644 index 305fc0d517d2..000000000000 --- a/tests/zfs-tests/tests/functional/rsend/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/rsend -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - recv_dedup.ksh \ - recv_dedup_encrypted_zvol.ksh \ - rsend_001_pos.ksh \ - rsend_002_pos.ksh \ - rsend_003_pos.ksh \ - rsend_004_pos.ksh \ - rsend_005_pos.ksh \ - rsend_006_pos.ksh \ - rsend_007_pos.ksh \ - rsend_008_pos.ksh \ - rsend_009_pos.ksh \ - rsend_010_pos.ksh \ - rsend_011_pos.ksh \ - rsend_012_pos.ksh \ - rsend_013_pos.ksh \ - rsend_014_pos.ksh \ - rsend_016_neg.ksh \ - rsend_019_pos.ksh \ - rsend_020_pos.ksh \ - rsend_021_pos.ksh \ - rsend_022_pos.ksh \ - rsend_024_pos.ksh \ - rsend_025_pos.ksh \ - rsend_026_neg.ksh \ - rsend_027_pos.ksh \ - rsend_028_neg.ksh \ - rsend_029_neg.ksh \ - send_encrypted_files.ksh \ - send_encrypted_hierarchy.ksh \ - send_encrypted_props.ksh \ - send_encrypted_truncated_files.ksh \ - send-c_embedded_blocks.ksh \ - send-c_incremental.ksh \ - send-c_lz4_disabled.ksh \ - send-c_mixed_compression.ksh \ - send-c_props.ksh \ - send-c_recv_dedup.ksh \ - send-c_recv_lz4_disabled.ksh \ - send-c_resume.ksh \ - send-c_stream_size_estimate.ksh \ - send-c_verify_contents.ksh \ - send-c_verify_ratio.ksh \ - send-c_volume.ksh \ - send-c_zstreamdump.ksh \ - send-cpL_varied_recsize.ksh \ - send-L_toggle.ksh \ - send_freeobjects.ksh \ - send_partial_dataset.ksh \ - send_realloc_dnode_size.ksh \ - send_realloc_files.ksh \ - send_realloc_encrypted_files.ksh \ - send_spill_block.ksh \ - send_raw_spill_block.ksh \ - send_raw_ashift.ksh \ - send_holds.ksh \ - send_hole_birth.ksh \ - send_invalid.ksh \ - send_mixed_raw.ksh \ - send-wR_encrypted_zvol.ksh \ - send_doall.ksh - -dist_pkgdata_DATA = \ - dedup.zsend.bz2 \ - dedup_encrypted_zvol.bz2 \ - dedup_encrypted_zvol.zsend.bz2 \ - fs.tar.gz \ - rsend.cfg \ - rsend.kshlib - diff --git a/tests/zfs-tests/tests/functional/scrub_mirror/Makefile.am b/tests/zfs-tests/tests/functional/scrub_mirror/Makefile.am deleted file mode 100644 index bc657fbf2ad9..000000000000 --- a/tests/zfs-tests/tests/functional/scrub_mirror/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/scrub_mirror -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - scrub_mirror_001_pos.ksh \ - scrub_mirror_002_pos.ksh \ - scrub_mirror_003_pos.ksh \ - scrub_mirror_004_pos.ksh - -dist_pkgdata_DATA = \ - default.cfg \ - scrub_mirror_common.kshlib diff --git a/tests/zfs-tests/tests/functional/simd/Makefile.am b/tests/zfs-tests/tests/functional/simd/Makefile.am deleted file mode 100644 index bfc28868024a..000000000000 --- a/tests/zfs-tests/tests/functional/simd/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/simd -dist_pkgdata_SCRIPTS = simd_supported.ksh diff --git a/tests/zfs-tests/tests/functional/slog/Makefile.am b/tests/zfs-tests/tests/functional/slog/Makefile.am deleted file mode 100644 index 92c3fd6c8e75..000000000000 --- a/tests/zfs-tests/tests/functional/slog/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/slog -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - slog_001_pos.ksh \ - slog_002_pos.ksh \ - slog_003_pos.ksh \ - slog_004_pos.ksh \ - slog_005_pos.ksh \ - slog_006_pos.ksh \ - slog_007_pos.ksh \ - slog_008_neg.ksh \ - slog_009_neg.ksh \ - slog_010_neg.ksh \ - slog_011_neg.ksh \ - slog_012_neg.ksh \ - slog_013_pos.ksh \ - slog_014_pos.ksh \ - slog_015_neg.ksh \ - slog_replay_fs_001.ksh \ - slog_replay_fs_002.ksh \ - slog_replay_volume.ksh \ - slog_016_pos.ksh - -dist_pkgdata_DATA = \ - slog.cfg \ - slog.kshlib diff --git a/tests/zfs-tests/tests/functional/snapshot/Makefile.am b/tests/zfs-tests/tests/functional/snapshot/Makefile.am deleted file mode 100644 index 783133a643a1..000000000000 --- a/tests/zfs-tests/tests/functional/snapshot/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/snapshot -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - clone_001_pos.ksh \ - rollback_001_pos.ksh \ - rollback_002_pos.ksh \ - rollback_003_pos.ksh \ - snapshot_001_pos.ksh \ - snapshot_002_pos.ksh \ - snapshot_003_pos.ksh \ - snapshot_004_pos.ksh \ - snapshot_005_pos.ksh \ - snapshot_006_pos.ksh \ - snapshot_007_pos.ksh \ - snapshot_008_pos.ksh \ - snapshot_009_pos.ksh \ - snapshot_010_pos.ksh \ - snapshot_011_pos.ksh \ - snapshot_012_pos.ksh \ - snapshot_013_pos.ksh \ - snapshot_014_pos.ksh \ - snapshot_015_pos.ksh \ - snapshot_016_pos.ksh \ - snapshot_017_pos.ksh - -dist_pkgdata_DATA = \ - snapshot.cfg diff --git a/tests/zfs-tests/tests/functional/snapused/Makefile.am b/tests/zfs-tests/tests/functional/snapused/Makefile.am deleted file mode 100644 index d6551b7c41b1..000000000000 --- a/tests/zfs-tests/tests/functional/snapused/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/snapused -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - snapused_001_pos.ksh \ - snapused_002_pos.ksh \ - snapused_003_pos.ksh \ - snapused_004_pos.ksh \ - snapused_005_pos.ksh - -dist_pkgdata_DATA = \ - snapused.kshlib diff --git a/tests/zfs-tests/tests/functional/sparse/Makefile.am b/tests/zfs-tests/tests/functional/sparse/Makefile.am deleted file mode 100644 index f1b9e04dcefe..000000000000 --- a/tests/zfs-tests/tests/functional/sparse/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/sparse -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - sparse_001_pos.ksh - -dist_pkgdata_DATA = \ - sparse.cfg diff --git a/tests/zfs-tests/tests/functional/stat/Makefile.am b/tests/zfs-tests/tests/functional/stat/Makefile.am deleted file mode 100644 index 1a861a655cb1..000000000000 --- a/tests/zfs-tests/tests/functional/stat/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/stat - -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - stat_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/suid/Makefile.am b/tests/zfs-tests/tests/functional/suid/Makefile.am deleted file mode 100644 index 439b41adc7d1..000000000000 --- a/tests/zfs-tests/tests/functional/suid/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/suid - -dist_pkgdata_SCRIPTS = \ - suid_write_to_suid.ksh \ - suid_write_to_sgid.ksh \ - suid_write_to_suid_sgid.ksh \ - suid_write_to_none.ksh \ - suid_write_zil_replay.ksh \ - cleanup.ksh \ - setup.ksh diff --git a/tests/zfs-tests/tests/functional/threadsappend/Makefile.am b/tests/zfs-tests/tests/functional/threadsappend/Makefile.am deleted file mode 100644 index 80f7788c8d86..000000000000 --- a/tests/zfs-tests/tests/functional/threadsappend/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/threadsappend - -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - threadsappend_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/tmpfile/Makefile.am b/tests/zfs-tests/tests/functional/tmpfile/Makefile.am deleted file mode 100644 index 65b0d64bc53f..000000000000 --- a/tests/zfs-tests/tests/functional/tmpfile/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/tmpfile - -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh diff --git a/tests/zfs-tests/tests/functional/trim/Makefile.am b/tests/zfs-tests/tests/functional/trim/Makefile.am deleted file mode 100644 index 8917ed726e90..000000000000 --- a/tests/zfs-tests/tests/functional/trim/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/trim -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - trim.kshlib \ - trim.cfg \ - autotrim_integrity.ksh \ - autotrim_config.ksh \ - autotrim_trim_integrity.ksh \ - trim_integrity.ksh \ - trim_config.ksh \ - trim_l2arc.ksh diff --git a/tests/zfs-tests/tests/functional/truncate/Makefile.am b/tests/zfs-tests/tests/functional/truncate/Makefile.am deleted file mode 100644 index 14a2b301f1d1..000000000000 --- a/tests/zfs-tests/tests/functional/truncate/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/truncate - -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - truncate_001_pos.ksh \ - truncate_002_pos.ksh \ - truncate_timestamps.ksh - -dist_pkgdata_DATA = \ - truncate.cfg diff --git a/tests/zfs-tests/tests/functional/upgrade/Makefile.am b/tests/zfs-tests/tests/functional/upgrade/Makefile.am deleted file mode 100644 index 743baa484522..000000000000 --- a/tests/zfs-tests/tests/functional/upgrade/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/upgrade -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - upgrade_userobj_001_pos.ksh \ - upgrade_projectquota_001_pos.ksh \ - upgrade_readonly_pool.ksh - -dist_pkgdata_DATA = \ - upgrade_common.kshlib diff --git a/tests/zfs-tests/tests/functional/user_namespace/Makefile.am b/tests/zfs-tests/tests/functional/user_namespace/Makefile.am deleted file mode 100644 index 5f95dbf8d967..000000000000 --- a/tests/zfs-tests/tests/functional/user_namespace/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/user_namespace -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - user_namespace_001.ksh - -dist_pkgdata_DATA = \ - user_namespace_common.kshlib \ - user_namespace.cfg diff --git a/tests/zfs-tests/tests/functional/userquota/Makefile.am b/tests/zfs-tests/tests/functional/userquota/Makefile.am deleted file mode 100644 index 2c94d3e1521c..000000000000 --- a/tests/zfs-tests/tests/functional/userquota/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/userquota -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - groupspace_001_pos.ksh \ - groupspace_002_pos.ksh \ - groupspace_003_pos.ksh \ - userquota_001_pos.ksh \ - userquota_002_pos.ksh \ - userquota_003_pos.ksh \ - userquota_004_pos.ksh \ - userquota_005_neg.ksh \ - userquota_006_pos.ksh \ - userquota_007_pos.ksh \ - userquota_008_pos.ksh \ - userquota_009_pos.ksh \ - userquota_010_pos.ksh \ - userquota_011_pos.ksh \ - userquota_012_neg.ksh \ - userquota_013_pos.ksh \ - userspace_001_pos.ksh \ - userspace_002_pos.ksh \ - userspace_003_pos.ksh \ - userspace_encrypted.ksh \ - userspace_send_encrypted.ksh - -dist_pkgdata_DATA = \ - userquota.cfg \ - userquota_common.kshlib diff --git a/tests/zfs-tests/tests/functional/vdev_zaps/Makefile.am b/tests/zfs-tests/tests/functional/vdev_zaps/Makefile.am deleted file mode 100644 index 4efb1bcf233a..000000000000 --- a/tests/zfs-tests/tests/functional/vdev_zaps/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/vdev_zaps -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - vdev_zaps_001_pos.ksh \ - vdev_zaps_002_pos.ksh \ - vdev_zaps_003_pos.ksh \ - vdev_zaps_004_pos.ksh \ - vdev_zaps_005_pos.ksh \ - vdev_zaps_006_pos.ksh \ - vdev_zaps_007_pos.ksh - -dist_pkgdata_DATA = \ - vdev_zaps.kshlib diff --git a/tests/zfs-tests/tests/functional/write_dirs/Makefile.am b/tests/zfs-tests/tests/functional/write_dirs/Makefile.am deleted file mode 100644 index 9bdc46b902e0..000000000000 --- a/tests/zfs-tests/tests/functional/write_dirs/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/write_dirs -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - write_dirs_001_pos.ksh \ - write_dirs_002_pos.ksh diff --git a/tests/zfs-tests/tests/functional/xattr/Makefile.am b/tests/zfs-tests/tests/functional/xattr/Makefile.am deleted file mode 100644 index 0cbd799aac85..000000000000 --- a/tests/zfs-tests/tests/functional/xattr/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/xattr -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - xattr_001_pos.ksh \ - xattr_002_neg.ksh \ - xattr_003_neg.ksh \ - xattr_004_pos.ksh \ - xattr_005_pos.ksh \ - xattr_006_pos.ksh \ - xattr_007_neg.ksh \ - xattr_008_pos.ksh \ - xattr_009_neg.ksh \ - xattr_010_neg.ksh \ - xattr_011_pos.ksh \ - xattr_012_pos.ksh \ - xattr_013_pos.ksh \ - xattr_compat.ksh - -dist_pkgdata_DATA = \ - xattr_common.kshlib \ - xattr.cfg diff --git a/tests/zfs-tests/tests/functional/zpool_influxdb/Makefile.am b/tests/zfs-tests/tests/functional/zpool_influxdb/Makefile.am deleted file mode 100644 index 36d08a41a91c..000000000000 --- a/tests/zfs-tests/tests/functional/zpool_influxdb/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zpool_influxdb -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - zpool_influxdb.ksh diff --git a/tests/zfs-tests/tests/functional/zvol/Makefile.am b/tests/zfs-tests/tests/functional/zvol/Makefile.am deleted file mode 100644 index e4910754bb81..000000000000 --- a/tests/zfs-tests/tests/functional/zvol/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol -dist_pkgdata_DATA = \ - zvol.cfg \ - zvol_common.shlib - -SUBDIRS = \ - zvol_ENOSPC \ - zvol_cli \ - zvol_misc \ - zvol_swap diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am deleted file mode 100644 index 9cd9b4149eaf..000000000000 --- a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_ENOSPC -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zvol_ENOSPC_001_pos.ksh - -dist_pkgdata_DATA = \ - zvol_ENOSPC.cfg diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am b/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am deleted file mode 100644 index c6b15684f45e..000000000000 --- a/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_cli -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zvol_cli_001_pos.ksh \ - zvol_cli_002_pos.ksh \ - zvol_cli_003_neg.ksh - -dist_pkgdata_DATA = \ - zvol_cli.cfg diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am b/tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am deleted file mode 100644 index 024007a41826..000000000000 --- a/tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_misc -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zvol_misc_001_neg.ksh \ - zvol_misc_002_pos.ksh \ - zvol_misc_003_neg.ksh \ - zvol_misc_004_pos.ksh \ - zvol_misc_005_neg.ksh \ - zvol_misc_006_pos.ksh \ - zvol_misc_hierarchy.ksh \ - zvol_misc_rename_inuse.ksh \ - zvol_misc_snapdev.ksh \ - zvol_misc_volmode.ksh \ - zvol_misc_zil.ksh - -dist_pkgdata_DATA = \ - zvol_misc_common.kshlib - diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile.am b/tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile.am deleted file mode 100644 index 480c0048cfd8..000000000000 --- a/tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_swap -dist_pkgdata_SCRIPTS = \ - cleanup.ksh \ - setup.ksh \ - zvol_swap_001_pos.ksh \ - zvol_swap_002_pos.ksh \ - zvol_swap_003_pos.ksh \ - zvol_swap_004_pos.ksh \ - zvol_swap_005_pos.ksh \ - zvol_swap_006_pos.ksh - -dist_pkgdata_DATA = \ - zvol_swap.cfg diff --git a/tests/zfs-tests/tests/perf/Makefile.am b/tests/zfs-tests/tests/perf/Makefile.am deleted file mode 100644 index 294b136b3854..000000000000 --- a/tests/zfs-tests/tests/perf/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/perf -dist_pkgdata_DATA = \ - nfs-sample.cfg \ - perf.shlib - -SUBDIRS = \ - fio \ - regression \ - scripts diff --git a/tests/zfs-tests/tests/perf/fio/Makefile.am b/tests/zfs-tests/tests/perf/fio/Makefile.am deleted file mode 100644 index e9f854d9edff..000000000000 --- a/tests/zfs-tests/tests/perf/fio/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/perf/fio -dist_pkgdata_DATA = \ - mkfiles.fio \ - random_reads.fio \ - random_readwrite.fio \ - random_readwrite_fixed.fio \ - random_writes.fio \ - sequential_reads.fio \ - sequential_writes.fio \ - sequential_readwrite.fio diff --git a/tests/zfs-tests/tests/perf/regression/Makefile.am b/tests/zfs-tests/tests/perf/regression/Makefile.am deleted file mode 100644 index 124e0936aa99..000000000000 --- a/tests/zfs-tests/tests/perf/regression/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/perf/regression -dist_pkgdata_SCRIPTS = \ - random_reads.ksh \ - random_readwrite.ksh \ - random_readwrite_fixed.ksh \ - random_writes.ksh \ - random_writes_zil.ksh \ - sequential_reads_arc_cached_clone.ksh \ - sequential_reads_arc_cached.ksh \ - sequential_reads_dbuf_cached.ksh \ - sequential_reads.ksh \ - sequential_writes.ksh \ - setup.ksh diff --git a/tests/zfs-tests/tests/perf/scripts/Makefile.am b/tests/zfs-tests/tests/perf/scripts/Makefile.am deleted file mode 100644 index f0d45e1fbdcc..000000000000 --- a/tests/zfs-tests/tests/perf/scripts/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/perf/scripts -dist_pkgdata_SCRIPTS = prefetch_io.sh From eaf94bda6cc31eb11822be5c782b8b43279212ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 19:00:47 +0200 Subject: [PATCH 022/119] Replace config/config.awk with simple sed invocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 1 - config/config.awk | 15 --------------- configure.ac | 6 +++--- 3 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 config/config.awk diff --git a/Makefile.am b/Makefile.am index c474f905c50a..688707ebd24d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,7 +37,6 @@ extra_HEADERS = zfs.release.in zfs_config.h.in endif EXTRA_DIST += autogen.sh copy-builtin -EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am EXTRA_DIST += AUTHORS CODE_OF_CONDUCT.md COPYRIGHT LICENSE META NEWS NOTICE EXTRA_DIST += README.md RELEASES.md EXTRA_DIST += module/lua/README.zfs module/os/linux/spl/README.md diff --git a/config/config.awk b/config/config.awk deleted file mode 100644 index cc4b7cc265cd..000000000000 --- a/config/config.awk +++ /dev/null @@ -1,15 +0,0 @@ -# Remove default preprocessor define's from config.h -# PACKAGE -# PACKAGE_BUGREPORT -# PACKAGE_NAME -# PACKAGE_STRING -# PACKAGE_TARNAME -# PACKAGE_VERSION -# STDC_HEADERS -# VERSION - -BEGIN { RS = "" ; FS = "\n" } \ - !/.#define PACKAGE./ && \ - !/.#define VERSION./ && \ - !/.#define STDC_HEADERS./ \ - { print $0"\n" } diff --git a/configure.ac b/configure.ac index 3e2ff3e8fb7c..7e356cbd20b2 100644 --- a/configure.ac +++ b/configure.ac @@ -40,10 +40,10 @@ AC_CANONICAL_TARGET AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AM_INIT_AUTOMAKE([subdir-objects foreign]) +# Remove default macros from config.h: +# PACKAGE, PACKAGE_{BUGREPORT,NAME,STRING,TARNAME,VERSION}, STDC_HEADERS, VERSION AC_CONFIG_HEADERS([zfs_config.h], [ - (mv zfs_config.h zfs_config.h.tmp && - awk -f ${ac_srcdir}/config/config.awk zfs_config.h.tmp >zfs_config.h && - rm zfs_config.h.tmp) || exit 1]) + sed -nEi~ -e '/^$/be' -e 'N;N;/#define (PACKAGE|VERSION|STDC_HEADERS)/d' -e ':e' -e 'p' zfs_config.h && rm zfs_config.h~ || exit]) LT_INIT AC_PROG_INSTALL From 0a9aaa7f0cc16f1771f492cce665bc5c5eb8e735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 22:47:56 +0200 Subject: [PATCH 023/119] cmd: move single-file binaries up, extract udev programs to udev/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- cmd/Makefile.am | 106 +++++++++++++++--- cmd/{arc_summary/arc_summary3 => arc_summary} | 0 cmd/arc_summary/Makefile.am | 8 -- cmd/{arcstat => }/arcstat.in | 0 cmd/arcstat/Makefile.am | 4 - cmd/{dbufstat => }/dbufstat.in | 0 cmd/dbufstat/Makefile.am | 4 - cmd/{fsck_zfs => }/fsck.zfs.in | 0 cmd/fsck_zfs/Makefile.am | 5 - cmd/{mount_zfs => }/mount_zfs.c | 0 cmd/mount_zfs/Makefile.am | 20 ---- cmd/vdev_id/Makefile.am | 2 - cmd/{zfs_ids_to_path => }/zfs_ids_to_path.c | 0 cmd/zfs_ids_to_path/Makefile.am | 8 -- cmd/{zgenhostid => }/zgenhostid.c | 0 cmd/zgenhostid/Makefile.am | 5 - cmd/{zhack => }/zhack.c | 0 cmd/zhack/Makefile.am | 12 -- cmd/{ztest => }/ztest.c | 0 cmd/ztest/Makefile.am | 18 --- cmd/zvol_id/Makefile.am | 5 - cmd/{zvol_wait => }/zvol_wait | 0 cmd/zvol_wait/Makefile.am | 2 - scripts/Makefile.am | 2 + scripts/zfs-helpers.sh | 2 +- udev/.gitignore | 1 + udev/Makefile.am | 12 ++ {cmd/vdev_id => udev}/vdev_id | 0 cmd/zvol_id/zvol_id_main.c => udev/zvol_id.c | 0 29 files changed, 107 insertions(+), 109 deletions(-) rename cmd/{arc_summary/arc_summary3 => arc_summary} (100%) delete mode 100644 cmd/arc_summary/Makefile.am rename cmd/{arcstat => }/arcstat.in (100%) delete mode 100644 cmd/arcstat/Makefile.am rename cmd/{dbufstat => }/dbufstat.in (100%) delete mode 100644 cmd/dbufstat/Makefile.am rename cmd/{fsck_zfs => }/fsck.zfs.in (100%) delete mode 100644 cmd/fsck_zfs/Makefile.am rename cmd/{mount_zfs => }/mount_zfs.c (100%) delete mode 100644 cmd/mount_zfs/Makefile.am delete mode 100644 cmd/vdev_id/Makefile.am rename cmd/{zfs_ids_to_path => }/zfs_ids_to_path.c (100%) delete mode 100644 cmd/zfs_ids_to_path/Makefile.am rename cmd/{zgenhostid => }/zgenhostid.c (100%) delete mode 100644 cmd/zgenhostid/Makefile.am rename cmd/{zhack => }/zhack.c (100%) delete mode 100644 cmd/zhack/Makefile.am rename cmd/{ztest => }/ztest.c (100%) delete mode 100644 cmd/ztest/Makefile.am delete mode 100644 cmd/zvol_id/Makefile.am rename cmd/{zvol_wait => }/zvol_wait (100%) delete mode 100644 cmd/zvol_wait/Makefile.am create mode 100644 udev/.gitignore rename {cmd/vdev_id => udev}/vdev_id (100%) rename cmd/zvol_id/zvol_id_main.c => udev/zvol_id.c (100%) diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 2fa281cad2ed..9959760b523e 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -2,38 +2,114 @@ bin_SCRIPTS = bin_PROGRAMS = sbin_SCRIPTS = sbin_PROGRAMS = -udev_PROGRAMS = dist_bin_SCRIPTS = zfsexec_PROGRAMS = -dist_udev_SCRIPTS = mounthelper_PROGRAMS = -include $(srcdir)/%D%/fsck_zfs/Makefile.am + +sbin_SCRIPTS += fsck.zfs +SHELLCHECKSCRIPTS += fsck.zfs +CLEANFILES += fsck.zfs +EXTRA_DIST += %D%/fsck.zfs.in +$(call SUBST,fsck.zfs,%D%/) + + +sbin_PROGRAMS += zfs_ids_to_path +CPPCHECKTARGETS += zfs_ids_to_path + +zfs_ids_to_path_SOURCES = \ + %D%/zfs_ids_to_path.c + +zfs_ids_to_path_LDADD = \ + libzfs.la + + +zhack_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) + +sbin_PROGRAMS += zhack +CPPCHECKTARGETS += zhack + +zhack_SOURCES = \ + %D%/zhack.c + +zhack_LDADD = \ + libzpool.la \ + libzfs_core.la \ + libnvpair.la + + +ztest_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) +# Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 +ztest_CFLAGS += $(NO_FORMAT_TRUNCATION) +ztest_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) + +sbin_PROGRAMS += ztest +CPPCHECKTARGETS += ztest + +ztest_SOURCES = \ + %D%/ztest.c + +ztest_LDADD = \ + libzpool.la \ + libzfs_core.la \ + libnvpair.la + +ztest_LDADD += -lm +ztest_LDFLAGS = -pthread + + include $(srcdir)/%D%/raidz_test/Makefile.am -include $(srcdir)/%D%/vdev_id/Makefile.am include $(srcdir)/%D%/zdb/Makefile.am include $(srcdir)/%D%/zfs/Makefile.am -include $(srcdir)/%D%/zfs_ids_to_path/Makefile.am -include $(srcdir)/%D%/zhack/Makefile.am include $(srcdir)/%D%/zinject/Makefile.am include $(srcdir)/%D%/zpool/Makefile.am include $(srcdir)/%D%/zpool_influxdb/Makefile.am include $(srcdir)/%D%/zstream/Makefile.am -include $(srcdir)/%D%/ztest/Makefile.am + if BUILD_LINUX -include $(srcdir)/%D%/mount_zfs/Makefile.am +mounthelper_PROGRAMS += mount.zfs +CPPCHECKTARGETS += mount.zfs + +mount_zfs_SOURCES = \ + %D%/mount_zfs.c + +mount_zfs_LDADD = \ + libzfs.la \ + libzfs_core.la \ + libnvpair.la + +mount_zfs_LDADD += $(LTLIBINTL) + +CPPCHECKTARGETS += raidz_test + + +sbin_PROGRAMS += zgenhostid +CPPCHECKTARGETS += zgenhostid + +zgenhostid_SOURCES = \ + %D%/zgenhostid.c + + +dist_bin_SCRIPTS += %D%/zvol_wait +SHELLCHECKSCRIPTS += %D%/zvol_wait + + include $(srcdir)/%D%/zed/Makefile.am -include $(srcdir)/%D%/zgenhostid/Makefile.am -include $(srcdir)/%D%/zvol_id/Makefile.am -include $(srcdir)/%D%/zvol_wait/Makefile.am endif + if USING_PYTHON -include $(srcdir)/%D%/arc_summary/Makefile.am -include $(srcdir)/%D%/arcstat/Makefile.am -include $(srcdir)/%D%/dbufstat/Makefile.am +bin_SCRIPTS += arc_summary arcstat dbufstat +CLEANFILES += arc_summary arcstat dbufstat +EXTRA_DIST += %D%/arc_summary %D%/arcstat.in %D%/dbufstat.in + +$(call SUBST,arcstat,%D%/) +$(call SUBST,dbufstat,%D%/) +arc_summary: %D%/arc_summary + $(AM_V_at)cp $< $@ endif + PHONY += cmd -cmd: $(bin_SCRIPTS) $(bin_PROGRAMS) $(sbin_SCRIPTS) $(sbin_PROGRAMS) $(udev_PROGRAMS) $(dist_bin_SCRIPTS) $(zfsexec_PROGRAMS) $(dist_udev_SCRIPTS) $(mounthelper_PROGRAMS) +cmd: $(bin_SCRIPTS) $(bin_PROGRAMS) $(sbin_SCRIPTS) $(sbin_PROGRAMS) $(dist_bin_SCRIPTS) $(zfsexec_PROGRAMS) $(mounthelper_PROGRAMS) diff --git a/cmd/arc_summary/arc_summary3 b/cmd/arc_summary similarity index 100% rename from cmd/arc_summary/arc_summary3 rename to cmd/arc_summary diff --git a/cmd/arc_summary/Makefile.am b/cmd/arc_summary/Makefile.am deleted file mode 100644 index 90dd981d9698..000000000000 --- a/cmd/arc_summary/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_SCRIPTS += arc_summary -CLEANFILES += arc_summary - -EXTRA_DIST += %D%/arc_summary3 -ARC_SUMMARY = %D%/arc_summary3 - -arc_summary: $(ARC_SUMMARY) - $(AM_V_at)cp $< $@ diff --git a/cmd/arcstat/arcstat.in b/cmd/arcstat.in similarity index 100% rename from cmd/arcstat/arcstat.in rename to cmd/arcstat.in diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am deleted file mode 100644 index d7fd81074cc5..000000000000 --- a/cmd/arcstat/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_SCRIPTS += arcstat -CLEANFILES += arcstat -EXTRA_DIST += %D%/arcstat.in -$(call SUBST,arcstat,%D%/) diff --git a/cmd/dbufstat/dbufstat.in b/cmd/dbufstat.in similarity index 100% rename from cmd/dbufstat/dbufstat.in rename to cmd/dbufstat.in diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am deleted file mode 100644 index 107f35573dcb..000000000000 --- a/cmd/dbufstat/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_SCRIPTS += dbufstat -CLEANFILES += dbufstat -EXTRA_DIST += %D%/dbufstat.in -$(call SUBST,dbufstat,%D%/) diff --git a/cmd/fsck_zfs/fsck.zfs.in b/cmd/fsck.zfs.in similarity index 100% rename from cmd/fsck_zfs/fsck.zfs.in rename to cmd/fsck.zfs.in diff --git a/cmd/fsck_zfs/Makefile.am b/cmd/fsck_zfs/Makefile.am deleted file mode 100644 index a252e3d0cb40..000000000000 --- a/cmd/fsck_zfs/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -sbin_SCRIPTS += fsck.zfs -SHELLCHECKSCRIPTS += fsck.zfs -CLEANFILES += fsck.zfs -EXTRA_DIST += %D%/fsck.zfs.in -$(call SUBST,fsck.zfs,%D%/) diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs.c similarity index 100% rename from cmd/mount_zfs/mount_zfs.c rename to cmd/mount_zfs.c diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am deleted file mode 100644 index 0ba61abe5728..000000000000 --- a/cmd/mount_zfs/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -# -# Ignore the prefix for the mount helper. It must be installed in /sbin/ -# because this path is hardcoded in the mount(8) for security reasons. -# However, if needed, the configure option --with-mounthelperdir= can be used -# to override the default install location. -# -mounthelper_PROGRAMS += mount.zfs -CPPCHECKTARGETS += mount.zfs - -mount_zfs_SOURCES = \ - %D%/mount_zfs.c - -mount_zfs_LDADD = \ - libzfs.la \ - libzfs_core.la \ - libnvpair.la - -mount_zfs_LDADD += $(LTLIBINTL) - -CPPCHECKTARGETS += raidz_test diff --git a/cmd/vdev_id/Makefile.am b/cmd/vdev_id/Makefile.am deleted file mode 100644 index ca57a9107c62..000000000000 --- a/cmd/vdev_id/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -dist_udev_SCRIPTS += %D%/vdev_id -# TODO: #12084: SHELLCHECKSCRIPTS += %D%/vdev_id diff --git a/cmd/zfs_ids_to_path/zfs_ids_to_path.c b/cmd/zfs_ids_to_path.c similarity index 100% rename from cmd/zfs_ids_to_path/zfs_ids_to_path.c rename to cmd/zfs_ids_to_path.c diff --git a/cmd/zfs_ids_to_path/Makefile.am b/cmd/zfs_ids_to_path/Makefile.am deleted file mode 100644 index 09ddd811616a..000000000000 --- a/cmd/zfs_ids_to_path/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -sbin_PROGRAMS += zfs_ids_to_path -CPPCHECKTARGETS += zfs_ids_to_path - -zfs_ids_to_path_SOURCES = \ - %D%/zfs_ids_to_path.c - -zfs_ids_to_path_LDADD = \ - libzfs.la diff --git a/cmd/zgenhostid/zgenhostid.c b/cmd/zgenhostid.c similarity index 100% rename from cmd/zgenhostid/zgenhostid.c rename to cmd/zgenhostid.c diff --git a/cmd/zgenhostid/Makefile.am b/cmd/zgenhostid/Makefile.am deleted file mode 100644 index 722950eb777b..000000000000 --- a/cmd/zgenhostid/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -sbin_PROGRAMS += zgenhostid -CPPCHECKTARGETS += zgenhostid - -zgenhostid_SOURCES = \ - %D%/zgenhostid.c diff --git a/cmd/zhack/zhack.c b/cmd/zhack.c similarity index 100% rename from cmd/zhack/zhack.c rename to cmd/zhack.c diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am deleted file mode 100644 index 94fa76d142ec..000000000000 --- a/cmd/zhack/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -zhack_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS += zhack -CPPCHECKTARGETS += zhack - -zhack_SOURCES = \ - %D%/zhack.c - -zhack_LDADD = \ - libzpool.la \ - libzfs_core.la \ - libnvpair.la diff --git a/cmd/ztest/ztest.c b/cmd/ztest.c similarity index 100% rename from cmd/ztest/ztest.c rename to cmd/ztest.c diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am deleted file mode 100644 index e27643a4462f..000000000000 --- a/cmd/ztest/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -ztest_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) -# Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 -ztest_CFLAGS += $(NO_FORMAT_TRUNCATION) -ztest_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS += ztest -CPPCHECKTARGETS += ztest - -ztest_SOURCES = \ - %D%/ztest.c - -ztest_LDADD = \ - libzpool.la \ - libzfs_core.la \ - libnvpair.la - -ztest_LDADD += -lm -ztest_LDFLAGS = -pthread diff --git a/cmd/zvol_id/Makefile.am b/cmd/zvol_id/Makefile.am deleted file mode 100644 index 7ba13205bc94..000000000000 --- a/cmd/zvol_id/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -udev_PROGRAMS += zvol_id -CPPCHECKTARGETS += zvol_id - -zvol_id_SOURCES = \ - %D%/zvol_id_main.c diff --git a/cmd/zvol_wait/zvol_wait b/cmd/zvol_wait similarity index 100% rename from cmd/zvol_wait/zvol_wait rename to cmd/zvol_wait diff --git a/cmd/zvol_wait/Makefile.am b/cmd/zvol_wait/Makefile.am deleted file mode 100644 index 2d3736f756ab..000000000000 --- a/cmd/zvol_wait/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -dist_bin_SCRIPTS += %D%/zvol_wait -SHELLCHECKSCRIPTS += %D%/zvol_wait diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 586ead05b113..5a409484fed5 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -35,6 +35,8 @@ export GDB="libtool --mode=execute gdb" export LDMOD=/sbin/insmod export CMD_DIR=$(abs_top_builddir) +export UDEV_SCRIPT_DIR=$(abs_top_srcdir)/udev +export UDEV_CMD_DIR=$(abs_top_builddir)/udev export UDEV_RULE_DIR=$(abs_top_builddir)/udev/rules.d export ZEDLET_ETC_DIR=$$CMD_DIR/cmd/zed/zed.d export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/cmd/zed/zed.d diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh index 5fa932dcced0..8dcb0630126a 100755 --- a/scripts/zfs-helpers.sh +++ b/scripts/zfs-helpers.sh @@ -156,7 +156,7 @@ if [ "${INSTALL}" = "yes" ]; then for cmd in "mount.zfs" "fsck.zfs"; do install "$CMD_DIR/$cmd" "$INSTALL_MOUNT_HELPER_DIR/$cmd" done - for udev in "$CMD_DIR/zvol_id" "$UDEV_SCRIPT_DIR/vdev_id"; do + for udev in "$UDEV_CMD_DIR/zvol_id" "$UDEV_SCRIPT_DIR/vdev_id"; do install "$udev" "$INSTALL_UDEV_DIR/${udev##*/}" done for rule in "60-zvol.rules" "69-vdev.rules" "90-zfs.rules"; do diff --git a/udev/.gitignore b/udev/.gitignore new file mode 100644 index 000000000000..4f5af11ae002 --- /dev/null +++ b/udev/.gitignore @@ -0,0 +1 @@ +/zvol_id diff --git a/udev/Makefile.am b/udev/Makefile.am index 27d45a36a42f..6fd645b5c22f 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -4,3 +4,15 @@ udevrule_DATA = \ %D%/rules.d/90-zfs.rules SUBSTFILES += $(udevrule_DATA) + + +dist_udev_SCRIPTS = %D%/vdev_id +# TODO: #12084: SHELLCHECKSCRIPTS += %D%/vdev_id + + +udev_PROGRAMS = %D%/zvol_id +CPPCHECKTARGETS += %D%/zvol_id + + +PHONY += udev +udev: $(dist_udev_SCRIPTS) $(udev_PROGRAMS) diff --git a/cmd/vdev_id/vdev_id b/udev/vdev_id similarity index 100% rename from cmd/vdev_id/vdev_id rename to udev/vdev_id diff --git a/cmd/zvol_id/zvol_id_main.c b/udev/zvol_id.c similarity index 100% rename from cmd/zvol_id/zvol_id_main.c rename to udev/zvol_id.c From 612b8dff5bc3d827efb864a199a62bda1a419254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 23:10:02 +0200 Subject: [PATCH 024/119] contrib: bash_completion.d: install, fix dist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dist diff: -zfs-2.1.99/contrib/bash_completion.d/zfs install diff: +destdir/usr/local/etc/bash_completion.d +destdir/usr/local/etc/bash_completion.d/zfs Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- contrib/bash_completion.d/Makefile.am | 11 ++++++----- rpm/generic/zfs.spec.in | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/contrib/bash_completion.d/Makefile.am b/contrib/bash_completion.d/Makefile.am index 4f451fb1d82b..dc4b610c42b8 100644 --- a/contrib/bash_completion.d/Makefile.am +++ b/contrib/bash_completion.d/Makefile.am @@ -1,6 +1,7 @@ -noinst_DATA = %D%/zfs -EXTRA_DIST += $(noinst_DATA) -SUBSTFILES += $(noinst_DATA) +bashcompletiondir = $(sysconfdir)/bash_completion.d -SHELLCHECKSCRIPTS += $(noinst_DATA) -$(call SHELLCHECK_OPTS,$(noinst_DATA)): SHELLCHECK_SHELL = bash +nodist_bashcompletion_DATA = %D%/zfs +SUBSTFILES += $(nodist_bashcompletion_DATA) + +SHELLCHECKSCRIPTS += $(nodist_bashcompletion_DATA) +$(call SHELLCHECK_OPTS,$(nodist_bashcompletion_DATA)): SHELLCHECK_SHELL = bash diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index 4b78a93085ac..0a29601639c3 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -518,6 +518,8 @@ systemctl --system daemon-reload >/dev/null || true %config(noreplace) %{_sysconfdir}/%{name}/vdev_id.conf.*.example %attr(440, root, root) %config(noreplace) %{_sysconfdir}/sudoers.d/* +%config(noreplace) %{_sysconfdir}/bash_completion.d/zfs + %files -n libzpool5 %{_libdir}/libzpool.so.* From 779ac93e9600fb50d7901bbddc6e5c6ed970845e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 11 Apr 2022 23:41:14 +0200 Subject: [PATCH 025/119] autogen.sh: paper over automake <1.14's lack of %reldir% support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- autogen.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index f56cd68be3ac..c817090183f1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,2 +1,62 @@ #!/bin/sh -autoreconf -fiv "$(dirname "$0")" && rm -rf "$(dirname "$0")"/autom4te.cache +[ "${0%/*}" = "$0" ] || cd "${0%/*}" || exit + +# %reldir%/%canon_reldir% (%D%/%C%) only appeared in automake 1.14, but RHEL/CentOS 7 has 1.13.4 +# This is an (overly) simplistic preprocessor that papers around this for the duration of the generation step, +# and can be removed once support for CentOS 7 is dropped +automake --version | awk '{print $NF; exit}' | ( + IFS=. read -r AM_MAJ AM_MIN _ + [ "$AM_MAJ" -gt 1 ] || [ "$AM_MIN" -ge 14 ] +) || { + process_root() { + root="$1"; shift + + grep -q '%[CD]%' "$root/Makefile.am" || return + find "$root" -name Makefile.am "$@" | while read -r dir; do + dir="${dir%/Makefile.am}" + grep -q '%[CD]%' "$dir/Makefile.am" || continue + + reldir="${dir#$root}" + reldir="${reldir#/}" + + canon_reldir="$(printf '%s' "$reldir" | tr -C 'a-zA-Z0-9@_' '_')" + + reldir_slash="$reldir/" + canon_reldir_slash="${canon_reldir}_" + [ -z "$reldir" ] && reldir_slash= + [ -z "$reldir" ] && canon_reldir_slash= + + echo "$dir/Makefile.am" >&3 + sed -i~ -e "s:%D%/:$reldir_slash:g" -e "s:%D%:$reldir:g" \ + -e "s:%C%_:$canon_reldir_slash:g" -e "s:%C%:$canon_reldir:g" "$dir/Makefile.am" + done 3>>"$substituted_files" + } + + rollback() { + while read -r f; do + mv "$f~" "$f" + done < "$substituted_files" + rm -f "$substituted_files" + } + + + echo "Automake <1.14; papering over missing %reldir%/%canon_reldir% support" >&2 + + substituted_files="$(mktemp)" + trap rollback EXIT + + roots="$(sed '/Makefile$/!d;/module/d;s:^\s*:./:;s:/Makefile::;/^\.$/d' configure.ac)" + + IFS=" +" + for root in $roots; do + root="${root#./}" + process_root "$root" + done + + set -f + # shellcheck disable=SC2086,SC2046 + process_root . $(printf '!\n-path\n%s/*\n' $roots) +} + +autoreconf -fiv && rm -rf autom4te.cache From c1851bf08176d2b387ba8257c2dd2b58516ec249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 12 Apr 2022 00:56:32 +0200 Subject: [PATCH 026/119] Makefile: respect V=1 for checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 688707ebd24d..bafc0ab2eae4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -104,7 +104,7 @@ checkstyle: codecheck commitcheck PHONY += commitcheck commitcheck: - @if git rev-parse --git-dir > /dev/null 2>&1; then \ + $(AM_V_at)if git rev-parse --git-dir > /dev/null 2>&1; then \ ${top_srcdir}/scripts/commitcheck.sh; \ fi @@ -115,7 +115,7 @@ cstyle_line = -exec ${top_srcdir}/scripts/cstyle.pl -cpP {} + endif CHECKS += cstyle cstyle: - @find ${top_srcdir} -name build -prune \ + $(AM_V_at)find $(top_srcdir) -name build -prune \ -o -type f -name '*.[hc]' \ ! -name 'zfs_config.*' ! -name '*.mod.c' \ ! -name 'opt_global.h' ! -name '*_if*.h' \ @@ -129,7 +129,7 @@ cstyle: filter_executable = -exec test -x '{}' \; -print CHECKS += testscheck testscheck: - @[ $$(find $(top_srcdir)/tests/zfs-tests -type f \ + $(AM_V_at)[ $$(find $(top_srcdir)/tests/zfs-tests -type f \ \( -name '*.ksh' -not $(filter_executable) \) -o \ \( -name '*.kshlib' $(filter_executable) \) -o \ \( -name '*.shlib' $(filter_executable) \) -o \ @@ -138,7 +138,7 @@ testscheck: CHECKS += vcscheck vcscheck: - @if git rev-parse --git-dir > /dev/null 2>&1; then \ + $(AM_V_at)if git rev-parse --git-dir > /dev/null 2>&1; then \ git ls-files . --exclude-standard --others | \ awk '{c++; print} END {if(c>0) exit 1}' ; \ fi @@ -152,16 +152,16 @@ lint: cppcheck paxcheck PHONY += paxcheck paxcheck: - @if type scanelf > /dev/null 2>&1; then \ - ${top_srcdir}/scripts/paxcheck.sh ${top_builddir}; \ + $(AM_V_at)if type scanelf > /dev/null 2>&1; then \ + $(top_srcdir)/scripts/paxcheck.sh $(top_builddir); \ else \ echo "skipping paxcheck because scanelf is not installed"; \ fi CHECKS += flake8 flake8: - @if type flake8 > /dev/null 2>&1; then \ - flake8 ${top_srcdir}; \ + $(AM_V_at)if type flake8 > /dev/null 2>&1; then \ + flake8 $(top_srcdir); \ else \ echo "skipping flake8 because flake8 is not installed"; \ fi From c982359460268cca466ce5fae3e6ef6a6c3e7c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 25 Apr 2022 23:27:03 +0200 Subject: [PATCH 027/119] cppcheck: explicitly exclude kernel code from userspace checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thus extracting the final shred of utility Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- config/CppCheck.am | 6 +++--- lib/libavl/Makefile.am | 1 - lib/libicp/Makefile.am | 1 - lib/libunicode/Makefile.am | 1 - lib/libzstd/Makefile.am | 1 - 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/config/CppCheck.am b/config/CppCheck.am index 0c2502f3ddde..89a067d814ff 100644 --- a/config/CppCheck.am +++ b/config/CppCheck.am @@ -1,5 +1,5 @@ # -# Default rules for running cppcheck against the user space components. +# cppcheck for userspace – nodist_*_SOURCES are kernel code and cppcheck goes crazy on them. # PHONY += cppcheck @@ -15,7 +15,7 @@ cppcheck-recursive-%: _CTGT = $(subst cppcheck-for-,,$@) cppcheck-for-%: - @[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)$(nodist_$(_CTGT)_SOURCES)" ] - $(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES) $(nodist_$(_CTGT)_SOURCES) + @[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)" ] + $(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES) cppcheck: $(addprefix cppcheck-for-,$(subst -,_,$(subst .,_,$(subst /,_,$(CPPCHECKTARGETS))))) $(addprefix cppcheck-recursive-,$(CPPCHECKDIRS)) diff --git a/lib/libavl/Makefile.am b/lib/libavl/Makefile.am index 5eaf4c08728d..3b302ee9deae 100644 --- a/lib/libavl/Makefile.am +++ b/lib/libavl/Makefile.am @@ -2,7 +2,6 @@ libavl_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) libavl_la_CFLAGS += -fvisibility=hidden noinst_LTLIBRARIES += libavl.la -CPPCHECKTARGETS += libavl.la nodist_libavl_la_SOURCES = \ module/avl/avl.c diff --git a/lib/libicp/Makefile.am b/lib/libicp/Makefile.am index 00bfc5c36ae9..304f49e39005 100644 --- a/lib/libicp/Makefile.am +++ b/lib/libicp/Makefile.am @@ -2,7 +2,6 @@ libicp_la_CCASFLAGS = $(AM_CCASFLAGS) libicp_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) noinst_LTLIBRARIES += libicp.la -CPPCHECKTARGETS += libicp.la nodist_libicp_la_SOURCES = \ module/icp/spi/kcf_spi.c \ diff --git a/lib/libunicode/Makefile.am b/lib/libunicode/Makefile.am index 82fee0101346..906759471163 100644 --- a/lib/libunicode/Makefile.am +++ b/lib/libunicode/Makefile.am @@ -1,7 +1,6 @@ libunicode_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) noinst_LTLIBRARIES += libunicode.la -CPPCHECKTARGETS += libunicode.la nodist_libunicode_la_SOURCES = \ module/unicode/u8_textprep.c \ diff --git a/lib/libzstd/Makefile.am b/lib/libzstd/Makefile.am index 729856862644..49bfb328a6f7 100644 --- a/lib/libzstd/Makefile.am +++ b/lib/libzstd/Makefile.am @@ -4,7 +4,6 @@ libzstd_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) libzstd_la_CFLAGS += -fno-tree-vectorize noinst_LTLIBRARIES += libzstd.la -CPPCHECKTARGETS += libzstd.la nodist_libzstd_la_SOURCES = \ module/zstd/lib/common/entropy_common.c \ From 1a58941275c50b5f2a51c82f41cb522f0b47852a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 30 Apr 2022 01:21:16 +0200 Subject: [PATCH 028/119] scripts: zpool.sh: cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- scripts/zloop.sh | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/scripts/zloop.sh b/scripts/zloop.sh index 8d5c0271f10a..ade2c84c55b7 100755 --- a/scripts/zloop.sh +++ b/scripts/zloop.sh @@ -21,7 +21,7 @@ # Copyright (c) 2017, Intel Corporation. # -BASE_DIR=$(dirname "$0") +BASE_DIR=${0%/*} SCRIPT_COMMON=common.sh if [ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]; then . "${BASE_DIR}/${SCRIPT_COMMON}" @@ -66,8 +66,7 @@ EOF function or_die { - # shellcheck disable=SC2068 - if ! $@; then + if ! "$@"; then echo "Command failed: $*" exit 1 fi @@ -128,7 +127,6 @@ function store_core echo "$zdbdebug" >>ztest.zdb dest=$coredir/$coreid - or_die mkdir -p "$dest" or_die mkdir -p "$dest/vdev" if [[ $symlink -ne 0 ]]; then @@ -137,10 +135,8 @@ function store_core echo "*** ztest crash found - moving logs to $dest" - or_die mv ztest.history "$dest/" - or_die mv ztest.zdb "$dest/" - or_die mv ztest.out "$dest/" - or_die mv "$workdir/ztest*" "$dest/vdev/" + or_die mv ztest.history ztest.zdb ztest.out "$dest/" + or_die mv "$workdir/"ztest* "$dest/vdev/" if [[ -e "$workdir/zpool.cache" ]]; then or_die mv "$workdir/zpool.cache" "$dest/vdev/" @@ -235,9 +231,7 @@ if [[ ! -w $coredir ]]; then exit 1 fi -or_die rm -f ztest.history -or_die rm -f ztest.zdb -or_die rm -f ztest.cores +or_die rm -f ztest.history ztest.zdb ztest.cores ztrc=0 # ztest return value foundcrashes=0 # number of crashes found so far @@ -312,9 +306,7 @@ while (( timeout == 0 )) || (( curtime <= (starttime + timeout) )); do zopt="$zopt -f $workdir" cmd="$ZTEST $zopt $*" - desc="$(date '+%m/%d %T') $cmd" - echo "$desc" | tee -a ztest.history - echo "$desc" >>ztest.out + echo "$(date '+%m/%d %T') $cmd" | tee -a ztest.history ztest.out $cmd >>ztest.out 2>&1 ztrc=$? grep -E '===|WARNING' ztest.out >>ztest.history From c6a5d7d9970a26f10e0404bebeeda5e1acc30b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 12:15:46 +0200 Subject: [PATCH 029/119] ztest: use $ZDB instead of $ZDB_PATH for zdb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Which actually gets zdb as set in common.sh Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- cmd/ztest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/ztest.c b/cmd/ztest.c index d60422279ad7..65d229f6604f 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -6626,14 +6626,14 @@ ztest_get_zdb_bin(char *bin, int len) { char *zdb_path; /* - * Try to use ZDB_PATH and in-tree zdb path. If not successful, just + * Try to use $ZDB and in-tree zdb path. If not successful, just * let popen to search through PATH. */ - if ((zdb_path = getenv("ZDB_PATH"))) { + if ((zdb_path = getenv("ZDB"))) { strlcpy(bin, zdb_path, len); /* In env */ if (!ztest_check_path(bin)) { ztest_dump_core = 0; - fatal(B_TRUE, "invalid ZDB_PATH '%s'", bin); + fatal(B_TRUE, "invalid ZDB '%s'", bin); } return; } @@ -6858,7 +6858,7 @@ ztest_run_zdb(char *pool) free(set_gvars_args_joined); if (ztest_opts.zo_verbose >= 5) - (void) printf("Executing %s\n", strstr(zdb, "zdb ")); + (void) printf("Executing %s\n", zdb); fp = popen(zdb, "r"); From e8ca72439327d1f249bef65bc48f9c7520470818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 12:22:30 +0200 Subject: [PATCH 030/119] ztest: fix in-tree detection for automatic zdb path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- cmd/ztest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/ztest.c b/cmd/ztest.c index 65d229f6604f..2dae34e971d7 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -6639,9 +6639,9 @@ ztest_get_zdb_bin(char *bin, int len) } VERIFY3P(realpath(getexecname(), bin), !=, NULL); - if (strstr(bin, "/ztest/")) { - strstr(bin, "/ztest/")[0] = '\0'; /* In-tree */ - strcat(bin, "/zdb/zdb"); + if (strstr(bin, ".libs/ztest")) { + strstr(bin, ".libs/ztest")[0] = '\0'; /* In-tree */ + strcat(bin, "zdb"); if (ztest_check_path(bin)) return; } From 3ed04d66aa440ee3e2c38d639a26f11d568e387d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 13:17:50 +0200 Subject: [PATCH 031/119] Remove constrained path on clean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- Makefile.am | 4 ++++ contrib/pyzfs/Makefile.am | 3 ++- scripts/Makefile.am | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index bafc0ab2eae4..ebb385fabc06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,7 @@ CLEANFILES = EXTRA_DIST = INSTALL_DATA_HOOKS = ALL_LOCAL = +CLEAN_LOCAL = CHECKS = shellcheck checkbashisms include $(top_srcdir)/config/Rules.am @@ -87,6 +88,9 @@ distclean-local: -o -name '*.gcno' \) \ -type f -delete +PHONY += $(CLEAN_LOCAL) +clean-local: $(CLEAN_LOCAL) + PHONY += $(ALL_LOCAL) all-local: $(ALL_LOCAL) diff --git a/contrib/pyzfs/Makefile.am b/contrib/pyzfs/Makefile.am index 1bcbfd042bc1..505cd3c8b355 100644 --- a/contrib/pyzfs/Makefile.am +++ b/contrib/pyzfs/Makefile.am @@ -32,6 +32,7 @@ install-exec-local: --single-version-externally-managed \ --verbose -clean-local: +CLEAN_LOCAL += pyzfs-clean-local +pyzfs-clean-local: -$(RM) -r %D%/build/ %D%/pyzfs.egg-info/ endif diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 5a409484fed5..6f1dc9ccdba5 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -75,6 +75,10 @@ ALL_LOCAL += scripts-all-local scripts-all-local: %D%/common.sh -SCRIPT_COMMON=$< $(srcdir)/%D%/zfs-tests.sh -c +CLEAN_LOCAL += scripts-clean-local +scripts-clean-local: + -$(RM) -r tests/zfs-tests/bin/ + INSTALL_DATA_HOOKS += scripts-install-data-hook scripts-install-data-hook: %D%/common.sh.in Makefile -$(SED) -e '/^export BIN_DIR=/s|$$|$(bindir)|' \ From f567d67fdae5819ec25048a8b5d648fc14e6defe Mon Sep 17 00:00:00 2001 From: Brian Atkinson Date: Wed, 11 May 2022 11:38:16 -0400 Subject: [PATCH 032/119] Adding ZTS test for O_APPEND Commit 63b18e4 fixed an issue in zpl_aio_write() to make sure that kiocb->ki_pos was updated correctly when opening a file with O_APPEND. Adding a test to verify O_APPEND functionality with lseek can make sure that all other distros/kernel versions also have the correct behavior. Also moved the threadappends_001_pos test into this append test directory in functional ZTS directory. This way the two append tests are together for organization purposes. Reviewed-by: Brian Behlendorf Signed-off-by: Brian Atkinson Closes #13424 --- tests/runfiles/common.run | 8 +- tests/runfiles/sanity.run | 2 +- tests/test-runner/bin/zts-report.py.in | 2 +- tests/zfs-tests/cmd/.gitignore | 1 + tests/zfs-tests/cmd/Makefile.am | 4 +- tests/zfs-tests/cmd/file/file_append.c | 206 ++++++++++++++++++ tests/zfs-tests/include/commands.cfg | 1 + tests/zfs-tests/tests/Makefile.am | 7 +- .../{threadsappend => append}/cleanup.ksh | 9 +- .../tests/functional/append/file_append.ksh | 73 +++++++ .../{threadsappend => append}/setup.ksh | 7 +- .../threadsappend_001_pos.ksh | 0 .../tests/functional/threadsappend/.gitignore | 1 - 13 files changed, 296 insertions(+), 25 deletions(-) create mode 100644 tests/zfs-tests/cmd/file/file_append.c rename tests/zfs-tests/tests/functional/{threadsappend => append}/cleanup.ksh (81%) create mode 100755 tests/zfs-tests/tests/functional/append/file_append.ksh rename tests/zfs-tests/tests/functional/{threadsappend => append}/setup.ksh (85%) rename tests/zfs-tests/tests/functional/{threadsappend => append}/threadsappend_001_pos.ksh (100%) delete mode 100644 tests/zfs-tests/tests/functional/threadsappend/.gitignore diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index 1930dfab1275..59584fd67d51 100644 --- a/tests/runfiles/common.run +++ b/tests/runfiles/common.run @@ -40,6 +40,10 @@ tests = ['alloc_class_001_pos', 'alloc_class_002_neg', 'alloc_class_003_pos', 'alloc_class_013_pos'] tags = ['functional', 'alloc_class'] +[tests/functional/append] +tests = ['file_append', 'threadsappend_001_pos'] +tags = ['functional', 'append'] + [tests/functional/arc] tests = ['dbufstats_001_pos', 'dbufstats_002_pos', 'dbufstats_003_pos', 'arcstats_runtime_tuning'] @@ -884,10 +888,6 @@ tests = ['suid_write_to_suid', 'suid_write_to_sgid', 'suid_write_to_suid_sgid', 'suid_write_to_none', 'suid_write_zil_replay'] tags = ['functional', 'suid'] -[tests/functional/threadsappend] -tests = ['threadsappend_001_pos'] -tags = ['functional', 'threadsappend'] - [tests/functional/trim] tests = ['autotrim_integrity', 'autotrim_config', 'autotrim_trim_integrity', 'trim_integrity', 'trim_config', 'trim_l2arc'] diff --git a/tests/runfiles/sanity.run b/tests/runfiles/sanity.run index 0ed693c2f4ae..f5dcfa5be4b7 100644 --- a/tests/runfiles/sanity.run +++ b/tests/runfiles/sanity.run @@ -584,7 +584,7 @@ tests = ['suid_write_to_suid', 'suid_write_to_sgid', 'suid_write_to_suid_sgid', 'suid_write_to_none'] tags = ['functional', 'suid'] -[tests/functional/threadsappend] +[tests/functional/append] tests = ['threadsappend_001_pos'] tags = ['functional', 'threadsappend'] diff --git a/tests/test-runner/bin/zts-report.py.in b/tests/test-runner/bin/zts-report.py.in index 44dddb5cc691..15660d5cb027 100755 --- a/tests/test-runner/bin/zts-report.py.in +++ b/tests/test-runner/bin/zts-report.py.in @@ -236,7 +236,7 @@ maybe = { 'snapshot/snapshot_010_pos': ['FAIL', 7961], 'snapused/snapused_004_pos': ['FAIL', 5513], 'tmpfile/setup': ['SKIP', tmpfile_reason], - 'threadsappend/threadsappend_001_pos': ['FAIL', 6136], + 'append/threadsappend_001_pos': ['FAIL', 6136], 'trim/setup': ['SKIP', trim_reason], 'upgrade/upgrade_projectquota_001_pos': ['SKIP', project_id_reason], 'user_namespace/setup': ['SKIP', user_ns_reason], diff --git a/tests/zfs-tests/cmd/.gitignore b/tests/zfs-tests/cmd/.gitignore index 9de5687d6ec8..1830cab76fee 100644 --- a/tests/zfs-tests/cmd/.gitignore +++ b/tests/zfs-tests/cmd/.gitignore @@ -4,6 +4,7 @@ /devname2devid /dir_rd_update /draid +/file_append /file_check /file_trunc /file_write diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am index b5609b523d05..71edd4939424 100644 --- a/tests/zfs-tests/cmd/Makefile.am +++ b/tests/zfs-tests/cmd/Makefile.am @@ -41,9 +41,9 @@ scripts_zfs_tests_bin_PROGRAMS += %D%/draid libnvpair.la %C%_draid_LDADD += $(ZLIB_LIBS) - EXTRA_DIST += $(addprefix %D%/,file/file_common.h) -scripts_zfs_tests_bin_PROGRAMS += %D%/file_check %D%/file_trunc %D%/file_write %D%/largest_file %D%/randwritecomp +scripts_zfs_tests_bin_PROGRAMS += %D%/file_append %D%/file_check %D%/file_trunc %D%/file_write %D%/largest_file %D%/randwritecomp +%C%_file_append_SOURCES = %D%/file/file_append.c %C%_file_check_SOURCES = %D%/file/file_check.c %C%_file_trunc_SOURCES = %D%/file/file_trunc.c %C%_file_write_SOURCES = %D%/file/file_write.c diff --git a/tests/zfs-tests/cmd/file/file_append.c b/tests/zfs-tests/cmd/file/file_append.c new file mode 100644 index 000000000000..32433e4fa2f6 --- /dev/null +++ b/tests/zfs-tests/cmd/file/file_append.c @@ -0,0 +1,206 @@ +/* + * 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) 2022 by Triad National Security, LLC + */ + +#include "file_common.h" +#include +#include + +static char *filename = NULL; +static int expected_offset = -1; +static int blocksize = 131072; /* 128KiB */ +static int numblocks = 8; +static const char *execname = "file_append"; +static int use_odirect = 0; + +static void +usage(void) +{ + (void) fprintf(stderr, + "usage %s -f filename -e expected_offset [-b blocksize] \n" + " [-n numblocks] [-d use_odirect] [-h help]\n" + "\n" + "Opens a file using O_APPEND and writes numblocks blocksize\n" + "blocks to filename.\n" + "Checks if expected_offst == lseek(fd, 0, SEEK_CUR)).\n" + "\n" + " filename: File to open with O_APPEND and write to.\n" + " expected_offset: Expected file offset after writing\n" + " blocksize numblocks to filename\n" + " blocksize: Size of each block to writei (must be at\n" + " least >= 512). If using use_odirect (-d)\n" + " must be a mutltiple of _SC_PAGE_SIZE\n" + " numblocks: Total number of blocksized blocks to\n" + " write.\n" + " use_odirect: Open file using O_DIRECT.\n" + " help: Print usage information and exit.\n" + "\n" + " Required parameters:\n" + " filename\n" + " expected_offset\n" + "\n" + " Default values:\n" + " blocksize -> 131072 (128 KiB)\n" + " numblocks -> 8\n" + " use_odirect -> False\n", + execname); + (void) exit(1); +} + +static void +parse_options(int argc, char *argv[]) +{ + int c; + int errflag = 0; + extern char *optarg; + extern int optind, optopt; + + while ((c = getopt(argc, argv, "b:de:f:hn:")) != -1) { + switch (c) { + case 'b': + blocksize = atoi(optarg); + break; + case 'd': + use_odirect = 1; + break; + case 'e': + expected_offset = atoi(optarg); + break; + case 'f': + filename = optarg; + break; + case 'h': + (void) usage(); + break; + case 'n': + numblocks = atoi(optarg); + break; + case ':': + (void) fprintf(stderr, + "Option -%c requires an operand\n", + optopt); + errflag++; + break; + case '?': + default: + (void) fprintf(stderr, + "Unrecognized option: -%c\n", optopt); + errflag++; + break; + } + } + + if (errflag) + (void) usage(); + + if (use_odirect && ((blocksize % sysconf(_SC_PAGE_SIZE)) != 0)) { + (void) fprintf(stderr, + "blocksize parameter invalid when using O_DIRECT.\n"); + (void) usage(); + } + + if (blocksize < 512 || expected_offset < 0 || filename == NULL || + numblocks <= 0) { + (void) fprintf(stderr, + "Required parameters(s) missing or invalid value for " + "parameter.\n"); + (void) usage(); + } +} + +int +main(int argc, char *argv[]) +{ + int err; + const char *datapattern = "0xf00ba3"; + int fd = -1; + int fd_flags = O_WRONLY | O_CREAT | O_APPEND; + int buf_offset = 0; + char *buf; + + parse_options(argc, argv); + + if (use_odirect) + fd_flags |= O_DIRECT; + + fd = open(filename, fd_flags, 0666); + if (fd == -1) { + (void) fprintf(stderr, "%s: %s: ", execname, filename); + perror("open"); + (void) exit(2); + } + + err = posix_memalign((void **)&buf, sysconf(_SC_PAGE_SIZE), + blocksize); + + if (err != 0) { + (void) fprintf(stderr, + "%s: %s\n", execname, strerror(err)); + (void) exit(2); + } + + /* Putting known data pattern in buffer */ + int left = blocksize; + while (left) { + size_t amt = MIN(strlen(datapattern), left); + memcpy(&buf[buf_offset], datapattern, amt); + buf_offset += amt; + left -= amt; + } + + for (int i = 0; i < numblocks; i++) { + int wrote = write(fd, buf, blocksize); + + if (wrote != blocksize) { + if (wrote < 0) { + perror("write"); + } else { + (void) fprintf(stderr, + "%s: unexpected short write, wrote %d " + "byte, expected %d\n", execname, wrote, + blocksize); + } + (void) exit(2); + } + } + + /* Getting current file offset */ + off_t off = lseek(fd, 0, SEEK_CUR); + + if (off == -1) { + perror("output seek"); + (void) exit(2); + } else if (off != expected_offset) { + (void) fprintf(stderr, + "%s: expected offset %d but current offset in %s is set " + "to %ld\n", execname, expected_offset, filename, + (long int)off); + (void) exit(2); + } + + (void) close(fd); + free(buf); + + return (0); +} diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg index 13110ed4f14f..9dc2b4d0e08b 100644 --- a/tests/zfs-tests/include/commands.cfg +++ b/tests/zfs-tests/include/commands.cfg @@ -179,6 +179,7 @@ export ZFSTEST_FILES='badsend devname2devid dir_rd_update draid + file_append file_check file_trunc file_write diff --git a/tests/zfs-tests/tests/Makefile.am b/tests/zfs-tests/tests/Makefile.am index 355ad727dfe2..2202d9026787 100644 --- a/tests/zfs-tests/tests/Makefile.am +++ b/tests/zfs-tests/tests/Makefile.am @@ -385,6 +385,10 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \ functional/alloc_class/alloc_class_013_pos.ksh \ functional/alloc_class/cleanup.ksh \ functional/alloc_class/setup.ksh \ + functional/append/file_append.ksh \ + functional/append/threadsappend_001_pos.ksh \ + functional/append/cleanup.ksh \ + functional/append/setup.ksh \ functional/arc/arcstats_runtime_tuning.ksh \ functional/arc/cleanup.ksh \ functional/arc/dbufstats_001_pos.ksh \ @@ -1842,9 +1846,6 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \ functional/suid/suid_write_to_suid.ksh \ functional/suid/suid_write_to_suid_sgid.ksh \ functional/suid/suid_write_zil_replay.ksh \ - functional/threadsappend/cleanup.ksh \ - functional/threadsappend/setup.ksh \ - functional/threadsappend/threadsappend_001_pos.ksh \ functional/trim/autotrim_config.ksh \ functional/trim/autotrim_integrity.ksh \ functional/trim/autotrim_trim_integrity.ksh \ diff --git a/tests/zfs-tests/tests/functional/threadsappend/cleanup.ksh b/tests/zfs-tests/tests/functional/append/cleanup.ksh similarity index 81% rename from tests/zfs-tests/tests/functional/threadsappend/cleanup.ksh rename to tests/zfs-tests/tests/functional/append/cleanup.ksh index 3166bd6ec16e..307feabd17c6 100755 --- a/tests/zfs-tests/tests/functional/threadsappend/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/append/cleanup.ksh @@ -21,14 +21,9 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2022 by Triad National Security, LCC # -# -# Copyright (c) 2013 by Delphix. All rights reserved. -# - -. $STF_SUITE/include/libtest.shlib +. ${STF_SUITE}/include/libtest.shlib default_cleanup diff --git a/tests/zfs-tests/tests/functional/append/file_append.ksh b/tests/zfs-tests/tests/functional/append/file_append.ksh new file mode 100755 index 000000000000..b40d10c05edb --- /dev/null +++ b/tests/zfs-tests/tests/functional/append/file_append.ksh @@ -0,0 +1,73 @@ +#!/bin/ksh -p +# +# 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) 2022 by Triad National Security, LCC +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# Tests file offset using O_APPEND. +# +# STRATEGY: +# 1. Open file using O_APPEND +# 2. Write to the file using random number of blocks (1, 2, or 3) +# 3. Verify that the file offset is correct using lseek after the write +# 4. Repeat steps 2 and 3, 5 times +# 5. Close the file. +# 6. Repeat steps 1-5 but also open file with O_DIRECT +# + +verify_runnable "global" + +log_assert "Ensure file offset is updated correctly when opened with O_APPEND" + +mntpt=$(get_prop mountpoint $TESTPOOL/$TESTFS) +filename=$mntpt/append_file.txt +bs=131072 +ITERATIONS=5 +expected=0 + +# First test using buffered writes with O_APPEND +for i in $(seq $ITERATIONS); do + num_blocks=$(random_int_between 1 3) + expected=$((expected + ( bs * num_blocks))) + log_must file_append -f $filename -e $expected -b $bs -n $num_blocks + curr_offset=$expected +done + +log_must rm -f $filename + +expected=0 + +# Repeat same test using O_DIRECT writes with O_APPEND +for i in $(seq $ITERATIONS); do + num_blocks=$(random_int_between 1 3) + expected=$((expected + ( bs * num_blocks))) + log_must file_append -f $filename -e $expected -b $bs -n $num_blocks -d +done + +log_must rm -f $filename + +log_pass "File offset updated correctly when opening a file with O_APPEND." diff --git a/tests/zfs-tests/tests/functional/threadsappend/setup.ksh b/tests/zfs-tests/tests/functional/append/setup.ksh similarity index 85% rename from tests/zfs-tests/tests/functional/threadsappend/setup.ksh rename to tests/zfs-tests/tests/functional/append/setup.ksh index 4fc55cd47803..e692d7b1bc0c 100755 --- a/tests/zfs-tests/tests/functional/threadsappend/setup.ksh +++ b/tests/zfs-tests/tests/functional/append/setup.ksh @@ -21,12 +21,7 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# -# Copyright (c) 2013 by Delphix. All rights reserved. +# Copyright (c) 2022 by Triad National Security, LCC # . $STF_SUITE/include/libtest.shlib diff --git a/tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh b/tests/zfs-tests/tests/functional/append/threadsappend_001_pos.ksh similarity index 100% rename from tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh rename to tests/zfs-tests/tests/functional/append/threadsappend_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/threadsappend/.gitignore b/tests/zfs-tests/tests/functional/threadsappend/.gitignore deleted file mode 100644 index 4c8c8cdf34c1..000000000000 --- a/tests/zfs-tests/tests/functional/threadsappend/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/threadsappend From e0911f7b7f1ebd9aa00c198b87618b0308fe8c85 Mon Sep 17 00:00:00 2001 From: szubersk Date: Sat, 7 May 2022 00:53:42 +0000 Subject: [PATCH 033/119] autoconf: Fail when __copy_from_user_inatomic is a non-GPL symbol A followup to 849c14e04844a2f0e1f7e42886c2cef083563f35 Fix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009242 Reviewed-by: Brian Behlendorf Signed-off-by: szubersk Closes #13389 --- config/kernel-copy-from-user-inatomic.m4 | 7 +++++-- module/os/linux/zfs/zfs_uio.c | 4 ---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/config/kernel-copy-from-user-inatomic.m4 b/config/kernel-copy-from-user-inatomic.m4 index 5fddaca59c20..fec354b2f38e 100644 --- a/config/kernel-copy-from-user-inatomic.m4 +++ b/config/kernel-copy-from-user-inatomic.m4 @@ -18,9 +18,12 @@ AC_DEFUN([ZFS_AC_KERNEL___COPY_FROM_USER_INATOMIC], [ AC_MSG_CHECKING([whether __copy_from_user_inatomic is available]) ZFS_LINUX_TEST_RESULT([__copy_from_user_inatomic_license], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE___COPY_FROM_USER_INATOMIC, 1, - [__copy_from_user_inatomic is available]) ], [ AC_MSG_RESULT(no) + AC_MSG_ERROR([ + *** The `__copy_from_user_inatomic()` Linux kernel function is + *** incompatible with the CDDL license and will prevent the module + *** linking stage from succeeding. OpenZFS cannot be compiled. + ]) ]) ]) diff --git a/module/os/linux/zfs/zfs_uio.c b/module/os/linux/zfs/zfs_uio.c index 0d4b4c583118..4f31bcb5959d 100644 --- a/module/os/linux/zfs/zfs_uio.c +++ b/module/os/linux/zfs/zfs_uio.c @@ -75,7 +75,6 @@ zfs_uiomove_iov(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) } else { unsigned long b_left = 0; if (uio->uio_fault_disable) { -#if defined(HAVE___COPY_FROM_USER_INATOMIC) if (!zfs_access_ok(VERIFY_READ, (iov->iov_base + skip), cnt)) { return (EFAULT); @@ -85,9 +84,6 @@ zfs_uiomove_iov(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) __copy_from_user_inatomic(p, (iov->iov_base + skip), cnt); pagefault_enable(); -#else - return (EFAULT); -#endif } else { b_left = copy_from_user(p, From 510ee280c0b6b025eca0a786a180c14f21aee715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 14:52:53 +0200 Subject: [PATCH 034/119] Remove enable_extended_FILE_stdio() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even on Illumos it's only available in the 32-bit programming environment, and, quoth enable_extended_FILE_stdio(3C): > Historically, 32-bit Solaris applications have been limited to using > only the file descriptors 0 through 255 with the standard I/O > functions (see stdio(3C)) in the C library. The extended FILE > facility allows well-behaved 32-bit applications to use any > valid file descriptor with the standard I/O functions. where "well-behaved" means that it > does not directly access any fields in the FILE structure pointed > to by the FILE pointer associated with any standard I/O stream, And the stdio/flush.c implementation reads: /* * if this is not an internal extended FILE then check * if _file is being changed from underneath us. * It should not be because if * it is then then we lose our ability to guard against * silent data corruption. */ if (!iop->__xf_nocheck && bad_fd > -1 && iop->_magic != bad_fd) { (void) fprintf(stderr, "Application violated extended FILE safety mechanism.\n" "Please read the man page for extendedFILE.\nAborting\n"); abort(); } This appears to be an insane workaround for broken implementation with exposed FILE internals and _file being an u8, both only on non-LP64; it's shimmed out on all LP64 targets in Illumos, and we shim it out as well: just get rid of it This appears to've been originally fixed in illumos-gate a5f69788de7ac07553de47f7fec8c05a9a94c105 ("PSARC 2006/162 Extended FILE space for 32-bit Solaris processes", "1085341 32-bit stdio routines should support file descriptors >255"), which also bears extendedFILE and enable_extended_FILE_stdio(3C): - unsigned char _file; /* UNIX System file descriptor */ + unsigned char _magic; /* Old home of the file descriptor */ + /* Only fileno(3C) can retrieve the value now */ and +/* + * Macros to aid the extended fd FILE work. + * This helps isolate the changes to only the 32-bit code + * since 64-bit Solaris is not affected by this. + */ +#ifdef _LP64 +#define GET_FD(iop) ((iop)->_file) +#define SET_FILE(iop, fd) ((iop)->_file = (fd)) +#else +#define GET_FD(iop) \ + (((iop)->__extendedfd) ? _file_get(iop) : (iop)->_magic) +#define SET_FILE(iop, fd) (iop)->_magic = (fd); (iop)->__extendedfd = 0 +#endif Also remove the 1k setrlimit(NOFILE) calls: that's the default on Linux, with 64k on Illumos and 171k on FreeBSD Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13411 --- cmd/zdb/zdb.c | 4 ---- cmd/ztest.c | 7 +------ lib/libspl/include/Makefile.am | 1 - lib/libspl/include/stdio.h | 34 ---------------------------------- 4 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 lib/libspl/include/stdio.h diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 6b418dd31962..3d4d956e5698 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -8405,7 +8405,6 @@ int main(int argc, char **argv) { int c; - struct rlimit rl = { 1024, 1024 }; spa_t *spa = NULL; objset_t *os = NULL; int dump_all = 1; @@ -8424,9 +8423,6 @@ main(int argc, char **argv) boolean_t target_is_spa = B_TRUE, dataset_lookup = B_FALSE; nvlist_t *cfg = NULL; - (void) setrlimit(RLIMIT_NOFILE, &rl); - (void) enable_extended_FILE_stdio(-1, -1); - dprintf_setup(&argc, argv); /* diff --git a/cmd/ztest.c b/cmd/ztest.c index 2dae34e971d7..134a72c9ddb8 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -7888,21 +7888,16 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp) fatal(B_TRUE, "fork failed"); if (pid == 0) { /* child */ - char *emptyargv[2] = { cmd, NULL }; char fd_data_str[12]; - struct rlimit rl = { 1024, 1024 }; - (void) setrlimit(RLIMIT_NOFILE, &rl); - (void) close(ztest_fd_rand); VERIFY3S(11, >=, snprintf(fd_data_str, 12, "%d", ztest_fd_data)); VERIFY0(setenv("ZTEST_FD_DATA", fd_data_str, 1)); - (void) enable_extended_FILE_stdio(-1, -1); if (libpath != NULL) VERIFY0(setenv("LD_LIBRARY_PATH", libpath, 1)); - (void) execv(cmd, emptyargv); + (void) execl(cmd, cmd, (char *)NULL); ztest_dump_core = B_FALSE; fatal(B_TRUE, "exec failed: %s", cmd); } diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index e995ddf66b92..2c0284310723 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -8,7 +8,6 @@ libspl_HEADERS = \ %D%/limits.h \ %D%/locale.h \ %D%/statcommon.h \ - %D%/stdio.h \ %D%/stdlib.h \ %D%/string.h \ %D%/stropts.h \ diff --git a/lib/libspl/include/stdio.h b/lib/libspl/include/stdio.h deleted file mode 100644 index 6152b09f1a97..000000000000 --- a/lib/libspl/include/stdio.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include_next - -#ifndef _LIBSPL_STDIO_H -#define _LIBSPL_STDIO_H - -#define enable_extended_FILE_stdio(fd, sig) ((void) 0) - -#endif From 951a3889d19925fb75bd0bfaac0dce6767e2e0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 15:40:34 +0200 Subject: [PATCH 035/119] tests: many_fds: simplify, modernise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13411 --- .../tests/functional/libzfs/many_fds.c | 54 +++++++------------ 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/tests/zfs-tests/tests/functional/libzfs/many_fds.c b/tests/zfs-tests/tests/functional/libzfs/many_fds.c index 6def57c5a51a..34029e0e32d0 100644 --- a/tests/zfs-tests/tests/functional/libzfs/many_fds.c +++ b/tests/zfs-tests/tests/functional/libzfs/many_fds.c @@ -22,15 +22,13 @@ /* * Copyright (C) 2015 STRATO AG. */ -#include -#include -#include -#include -#include +#include #include #include #include -#include +#include +#include +#include /* * Check if libzfs works with more than 255 held file handles. @@ -38,35 +36,23 @@ int main(void) { - int i; - struct rlimit limit; - libzfs_handle_t *h; - - limit.rlim_cur = 65535; - limit.rlim_max = 65535; - - if (setrlimit(RLIMIT_NOFILE, &limit) != 0) { - (void) printf("many_fds: setrlimit() failed with errno=%d\n", - errno); - exit(1); - } + struct rlimit limit = { + .rlim_cur = 64 * 1024, + .rlim_max = 64 * 1024, + }; + if (setrlimit(RLIMIT_NOFILE, &limit) != 0) + err(1, "setrlimit()"); - for (i = 0; i < 255; ++i) { - int fd = open("/dev/null", O_RDONLY); - if (fd == -1) { - (void) printf("open failed with errno=%d\n", errno); - return (1); - } - } + int fd = open("/dev/null", O_RDONLY); + if (fd == -1) + err(1, "open()"); + for (int i = 0; i < limit.rlim_cur / 2; ++i) + if (dup(fd) == -1) + err(1, "dup()"); - h = libzfs_init(); + libzfs_handle_t *h = libzfs_init(); + if (h == NULL) + err(1, "libzfs_init()"); - if (h != NULL) { - libzfs_fini(h); - return (0); - } else { - (void) printf("many_fds: libzfs_init() failed with errno=%d\n", - errno); - return (1); - } + libzfs_fini(h); } From 888914486e26d81c8dbfd7a9d8091c05f9fc98ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 16:55:14 +0200 Subject: [PATCH 036/119] ztest: take -B ./path/to/ztest, LD_LIBRARY_PATH=./path/lib:$L_L_P MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This changes the behaviour of -B from the illumos one which would, in the example in the manual, take just ./chroots/lenny; this, however, is more versatile, and scales much better for systems with ZFS in /usr/local, for example Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13411 Closes #1770 --- cmd/ztest.c | 93 ++++++++++++++++++++---------------------------- man/man1/ztest.1 | 12 ++++++- 2 files changed, 50 insertions(+), 55 deletions(-) diff --git a/cmd/ztest.c b/cmd/ztest.c index 134a72c9ddb8..1b5459f8e45f 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -929,8 +929,7 @@ process_options(int argc, char **argv) int opt; uint64_t value; - char altdir[MAXNAMELEN] = { 0 }; - char raid_kind[8] = "random"; + const char *raid_kind = "random"; memcpy(zo, &ztest_opts_defaults, sizeof (*zo)); @@ -978,7 +977,7 @@ process_options(int argc, char **argv) zo->zo_raid_parity = MIN(MAX(value, 1), 3); break; case 'K': - (void) strlcpy(raid_kind, optarg, sizeof (raid_kind)); + raid_kind = optarg; break; case 'D': zo->zo_draid_data = MAX(1, value); @@ -1037,7 +1036,8 @@ process_options(int argc, char **argv) zo->zo_maxloops = MAX(1, value); break; case 'B': - (void) strlcpy(altdir, optarg, sizeof (altdir)); + (void) strlcpy(zo->zo_alt_ztest, optarg, + sizeof (zo->zo_alt_ztest)); break; case 'C': ztest_parse_name_value(optarg, zo); @@ -1076,8 +1076,7 @@ process_options(int argc, char **argv) /* When raid choice is 'random' add a draid pool 50% of the time */ if (strcmp(raid_kind, "random") == 0) { - (void) strlcpy(raid_kind, (ztest_random(2) == 0) ? - "draid" : "raidz", sizeof (raid_kind)); + raid_kind = (ztest_random(2) == 0) ? "draid" : "raidz"; if (ztest_opts.zo_verbose >= 3) (void) printf("choosing RAID type '%s'\n", raid_kind); @@ -1127,51 +1126,28 @@ process_options(int argc, char **argv) (zo->zo_vdevs > 0 ? zo->zo_time * NANOSEC / zo->zo_vdevs : UINT64_MAX >> 2); - if (strlen(altdir) > 0) { - char *cmd; - char *realaltdir; - char *bin; - char *ztest; - char *isa; - int isalen; - - cmd = umem_alloc(MAXPATHLEN, UMEM_NOFAIL); - realaltdir = umem_alloc(MAXPATHLEN, UMEM_NOFAIL); - - VERIFY3P(NULL, !=, realpath(getexecname(), cmd)); - if (0 != access(altdir, F_OK)) { - ztest_dump_core = B_FALSE; - fatal(B_TRUE, "invalid alternate ztest path: %s", - altdir); - } - VERIFY3P(NULL, !=, realpath(altdir, realaltdir)); - - /* - * 'cmd' should be of the form "/usr/bin//ztest". - * We want to extract to determine if we should use - * 32 or 64 bit binaries. - */ - bin = strstr(cmd, "/usr/bin/"); - ztest = strstr(bin, "/ztest"); - isa = bin + 9; - isalen = ztest - isa; - (void) snprintf(zo->zo_alt_ztest, sizeof (zo->zo_alt_ztest), - "%s/usr/bin/%.*s/ztest", realaltdir, isalen, isa); - (void) snprintf(zo->zo_alt_libpath, sizeof (zo->zo_alt_libpath), - "%s/usr/lib/%.*s", realaltdir, isalen, isa); - - if (0 != access(zo->zo_alt_ztest, X_OK)) { - ztest_dump_core = B_FALSE; - fatal(B_TRUE, "invalid alternate ztest: %s", - zo->zo_alt_ztest); - } else if (0 != access(zo->zo_alt_libpath, X_OK)) { - ztest_dump_core = B_FALSE; - fatal(B_TRUE, "invalid alternate lib directory %s", - zo->zo_alt_libpath); - } + if (*zo->zo_alt_ztest) { + const char *invalid_what = "ztest"; + char *val = zo->zo_alt_ztest; + if (0 != access(val, X_OK) || + (strrchr(val, '/') == NULL && (errno = EINVAL))) + goto invalid; + + int dirlen = strrchr(val, '/') - val; + strncpy(zo->zo_alt_libpath, val, dirlen); + invalid_what = "library path", val = zo->zo_alt_libpath; + if (strrchr(val, '/') == NULL && (errno = EINVAL)) + goto invalid; + *strrchr(val, '/') = '\0'; + strlcat(val, "/lib", sizeof (zo->zo_alt_libpath)); + + if (0 != access(zo->zo_alt_libpath, X_OK)) + goto invalid; + return; - umem_free(cmd, MAXPATHLEN); - umem_free(realaltdir, MAXPATHLEN); +invalid: + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate %s %s", invalid_what, val); } } @@ -1182,14 +1158,14 @@ ztest_kill(ztest_shared_t *zs) zs->zs_space = metaslab_class_get_space(spa_normal_class(ztest_spa)); /* - * Before we kill off ztest, make sure that the config is updated. + * Before we kill ourselves, make sure that the config is updated. * See comment above spa_write_cachefile(). */ mutex_enter(&spa_namespace_lock); spa_write_cachefile(ztest_spa, B_FALSE, B_FALSE); mutex_exit(&spa_namespace_lock); - (void) kill(getpid(), SIGKILL); + (void) raise(SIGKILL); } static void @@ -7895,8 +7871,17 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp) snprintf(fd_data_str, 12, "%d", ztest_fd_data)); VERIFY0(setenv("ZTEST_FD_DATA", fd_data_str, 1)); - if (libpath != NULL) - VERIFY0(setenv("LD_LIBRARY_PATH", libpath, 1)); + if (libpath != NULL) { + const char *curlp = getenv("LD_LIBRARY_PATH"); + if (curlp == NULL) + VERIFY0(setenv("LD_LIBRARY_PATH", libpath, 1)); + else { + char *newlp = NULL; + VERIFY3S(-1, !=, + asprintf(&newlp, "%s:%s", libpath, curlp)); + VERIFY0(setenv("LD_LIBRARY_PATH", newlp, 1)); + } + } (void) execl(cmd, cmd, (char *)NULL); ztest_dump_core = B_FALSE; fatal(B_TRUE, "exec failed: %s", cmd); diff --git a/man/man1/ztest.1 b/man/man1/ztest.1 index fd1374a2f106..9e44eb4579f9 100644 --- a/man/man1/ztest.1 +++ b/man/man1/ztest.1 @@ -157,7 +157,17 @@ Time per pass. Max loops in .Fn spa_freeze . .It Fl B , -alt-ztest Ns = -Alternate ztest path. +Path to alternate ("older") +.Nm ztest +to drive, which will be used to initialise the pool, and, a stochastic half the time, to run the tests. +The parallel +.Pa lib +directory is prepended to +.Ev LD_LIBRARY_PATH ; +i.e. given +.Fl B Pa ./chroots/lenny/usr/bin/ Ns Nm , +.Pa ./chroots/lenny/usr/lib +will be loaded. .It Fl C , -vdev-class-state Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy random No (default: Sy random ) The vdev allocation class state. .It Fl o , -option Ns = Ns Ar variable Ns = Ns Ar value From 1f5bc12893eefb0e3a247c2266c94a6f7f2b3364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 16:58:40 +0200 Subject: [PATCH 037/119] ztest: O_CLOEXEC ztest_fd_rand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13411 --- cmd/ztest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/ztest.c b/cmd/ztest.c index 1b5459f8e45f..ca05cf26511e 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -7866,7 +7866,6 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp) if (pid == 0) { /* child */ char fd_data_str[12]; - (void) close(ztest_fd_rand); VERIFY3S(11, >=, snprintf(fd_data_str, 12, "%d", ztest_fd_data)); VERIFY0(setenv("ZTEST_FD_DATA", fd_data_str, 1)); @@ -8013,7 +8012,7 @@ main(int argc, char **argv) * ztest from needlessly depleting the system entropy pool. */ random_path = "/dev/urandom"; - ztest_fd_rand = open(random_path, O_RDONLY); + ztest_fd_rand = open(random_path, O_RDONLY | O_CLOEXEC); ASSERT3S(ztest_fd_rand, >=, 0); if (!fd_data_str) { From 5a142533f8b117f6ac3ad7490ae4ac2cef3d78e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 11 May 2022 19:58:19 +0200 Subject: [PATCH 038/119] udev: zvol_id: simplify/modernise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit zero-alloc, sensibler errors, don't close (or free) before exit. Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13337 --- udev/zvol_id.c | 103 ++++++++++++++----------------------------------- 1 file changed, 30 insertions(+), 73 deletions(-) diff --git a/udev/zvol_id.c b/udev/zvol_id.c index 929a1a6e794d..ea38ac8cdf38 100644 --- a/udev/zvol_id.c +++ b/udev/zvol_id.c @@ -24,16 +24,14 @@ */ #include -#include -#include -#include +#include #include +#include +#include #include -#include -#include -#include -#include #include +#include +#include #if defined(ZFS_ASAN_ENABLED) /* @@ -50,80 +48,39 @@ const char *__asan_default_options(void) { } #endif -static int -ioctl_get_msg(char *var, int fd) -{ - int ret; - char msg[ZFS_MAX_DATASET_NAME_LEN]; - - ret = ioctl(fd, BLKZNAME, msg); - if (ret < 0) { - return (ret); - } - - snprintf(var, ZFS_MAX_DATASET_NAME_LEN, "%s", msg); - return (ret); -} - int -main(int argc, char **argv) +main(int argc, const char *const *argv) { - int fd = -1, ret = 0, status = EXIT_FAILURE; - char zvol_name[ZFS_MAX_DATASET_NAME_LEN]; - char *zvol_name_part = NULL; - char *dev_name; - struct stat64 statbuf; - int dev_minor, dev_part; - int i; - - if (argc < 2) { - fprintf(stderr, "Usage: %s /dev/zvol_device_node\n", argv[0]); - goto fail; - } - - dev_name = argv[1]; - ret = stat64(dev_name, &statbuf); - if (ret != 0) { - fprintf(stderr, "Unable to access device file: %s\n", dev_name); - goto fail; + if (argc != 2) { + fprintf(stderr, "usage: %s /dev/zdX\n", argv[0]); + return (1); } - - dev_minor = minor(statbuf.st_rdev); - dev_part = dev_minor % ZVOL_MINORS; - - fd = open(dev_name, O_RDONLY); - if (fd < 0) { - fprintf(stderr, "Unable to open device file: %s\n", dev_name); - goto fail; + const char *dev_name = argv[1]; + + int fd; + struct stat sb; + if ((fd = open(dev_name, O_RDONLY|O_CLOEXEC)) == -1 || + fstat(fd, &sb) != 0) { + fprintf(stderr, "%s: %s\n", dev_name, strerror(errno)); + return (1); } - ret = ioctl_get_msg(zvol_name, fd); - if (ret < 0) { - fprintf(stderr, "ioctl_get_msg failed: %s\n", strerror(errno)); - goto fail; + char zvol_name[MAXNAMELEN + strlen("-part") + 10]; + if (ioctl(fd, BLKZNAME, zvol_name) == -1) { + fprintf(stderr, "%s: BLKZNAME: %s\n", + dev_name, strerror(errno)); + return (1); } - if (dev_part > 0) - ret = asprintf(&zvol_name_part, "%s-part%d", zvol_name, - dev_part); - else - ret = asprintf(&zvol_name_part, "%s", zvol_name); - if (ret == -1 || zvol_name_part == NULL) - goto fail; - - for (i = 0; i < strlen(zvol_name_part); i++) { - if (isblank(zvol_name_part[i])) - zvol_name_part[i] = '+'; - } + unsigned int dev_part = minor(sb.st_rdev) % ZVOL_MINORS; + if (dev_part != 0) + sprintf(zvol_name + strlen(zvol_name), "-part%u", dev_part); - printf("%s\n", zvol_name_part); - status = EXIT_SUCCESS; + for (size_t i = 0; i < strlen(zvol_name); ++i) + if (isblank(zvol_name[i])) + zvol_name[i] = '+'; -fail: - if (zvol_name_part) - free(zvol_name_part); - if (fd >= 0) - close(fd); + puts(zvol_name); - return (status); + return (0); } From bd88c036e61811ced1d8d3dfa89d590b9aa133a6 Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Wed, 11 May 2022 16:26:55 -0400 Subject: [PATCH 039/119] Added a workaround for Linux KASAN builds Linux passes -Wframe-larger-than=1024, which breaks our build in a number of places with -Werror. Reviewed-by: Brian Behlendorf Signed-off-by: Rich Ercolani Closes #13450 --- module/Kbuild.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module/Kbuild.in b/module/Kbuild.in index 4307c3da05f5..11099999fb87 100644 --- a/module/Kbuild.in +++ b/module/Kbuild.in @@ -28,6 +28,12 @@ ZFS_MODULE_CFLAGS += -I$(zfs_include) ZFS_MODULE_CPPFLAGS += -D_KERNEL ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@ +# KASAN enables -Werror=frame-larger-than=1024, which +# breaks oh so many parts of our build. +ifeq ($(CONFIG_KASAN),y) +ZFS_MODULE_CFLAGS += -Wno-error=frame-larger-than= +endif + ifneq ($(KBUILD_EXTMOD),) @CONFIG_QAT_TRUE@ZFS_MODULE_CFLAGS += -I@QAT_SRC@/include @CONFIG_QAT_TRUE@KBUILD_EXTRA_SYMBOLS += @QAT_SYMBOLS@ From 196e7c76174b50df4ab54f0b41a58e5659e15a48 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 12 May 2022 09:11:29 -0700 Subject: [PATCH 040/119] ztest: reduce runtile of zloop.sh in CI The zloop.sh script is primarily designed to randomly stress the DMU and SPA layers. This can result in some unrealistic (or even impossible) scenarios being tested which then fail. Since the longer we run zloop.sh the more likely this is to occur this commit reduces the runtime. The intention being that normally this will result in a clean CI run unless the PR does introduce serious breaking change. Reviewed-by: George Melikov Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13453 --- .github/workflows/zloop.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/zloop.yml b/.github/workflows/zloop.yml index 8eb2a1d9bb0f..d49eeae1653c 100644 --- a/.github/workflows/zloop.yml +++ b/.github/workflows/zloop.yml @@ -38,8 +38,9 @@ jobs: - name: Tests run: | sudo mkdir -p $TEST_DIR - # run for 20 minutes to have a total runner time of 30 minutes - sudo /usr/share/zfs/zloop.sh -t 1200 -l -m1 -- -T 120 -P 60 + # run for 10 minutes or at most 2 iterations for a maximum runner + # time of 20 minutes. + sudo /usr/share/zfs/zloop.sh -t 600 -I 2 -l -m1 -- -T 120 -P 60 - name: Prepare artifacts if: failure() run: | From 45588be2851b16add95883e3a7f0f6bdb9393f97 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 12 May 2022 09:12:32 -0700 Subject: [PATCH 041/119] Add missing AC_MSG_RESULT(no) to configure When the HAVE_IOPS_MKDIR_USERNS check fails output result as required. Reviewed-by: George Melikov Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13454 --- config/kernel-mkdir.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/kernel-mkdir.m4 b/config/kernel-mkdir.m4 index a162bcd880ff..6667ed04fa4c 100644 --- a/config/kernel-mkdir.m4 +++ b/config/kernel-mkdir.m4 @@ -53,6 +53,8 @@ AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [ AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1, [iops->mkdir() takes struct user_namespace*]) ],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING([whether iops->mkdir() takes umode_t]) ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [ AC_MSG_RESULT(yes) From 5f0c1c4ebd3ed1148a57ecdfeafce9b3adadc0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 12:40:14 +0100 Subject: [PATCH 042/119] freebsd: libshare/nfs: constify static const data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/os/freebsd/nfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libshare/os/freebsd/nfs.c b/lib/libshare/os/freebsd/nfs.c index ea02dc1bae3c..0edddf93ee5c 100644 --- a/lib/libshare/os/freebsd/nfs.c +++ b/lib/libshare/os/freebsd/nfs.c @@ -78,9 +78,9 @@ static sa_fstype_t *nfs_fstype; static char * translate_opts(const char *shareopts) { - static const char *known_opts[] = { "ro", "maproot", "mapall", "mask", - "network", "sec", "alldirs", "public", "webnfs", "index", "quiet", - NULL }; + static const char *const known_opts[] = { "ro", "maproot", "mapall", + "mask", "network", "sec", "alldirs", "public", "webnfs", "index", + "quiet" }; static char newopts[OPTSSIZE]; char oldopts[OPTSSIZE]; char *o, *s = NULL; @@ -93,7 +93,7 @@ translate_opts(const char *shareopts) while ((o = strsep(&s, "-, ")) != NULL) { if (o[0] == '\0') continue; - for (i = 0; known_opts[i] != NULL; i++) { + for (i = 0; i < ARRAY_SIZE(known_opts); ++i) { len = strlen(known_opts[i]); if (strncmp(known_opts[i], o, len) == 0 && (o[len] == '\0' || o[len] == '=')) { From ee668b83316c9020abc4929010fbb18ea29b1ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 12:55:07 +0100 Subject: [PATCH 043/119] freebsd: libshare/nfs: write directly in translate_opts() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This renders it thread-safe Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/os/freebsd/nfs.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/libshare/os/freebsd/nfs.c b/lib/libshare/os/freebsd/nfs.c index 0edddf93ee5c..d0cd5f2b3fd9 100644 --- a/lib/libshare/os/freebsd/nfs.c +++ b/lib/libshare/os/freebsd/nfs.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); static sa_fstype_t *nfs_fstype; /* - * This function translate options to a format acceptable by exports(5), eg. + * This function translates options to a format acceptable by exports(5), eg. * * -ro -network=192.168.0.0 -mask=255.255.255.0 -maproot=0 \ * zfs.freebsd.org 69.147.83.54 @@ -72,17 +72,14 @@ static sa_fstype_t *nfs_fstype; * * ro, maproot, mapall, mask, network, sec, alldirs, public, webnfs, * index, quiet - * - * NOTE: This function returns a static buffer and thus is not thread-safe. */ -static char * -translate_opts(const char *shareopts) +static int +translate_opts(const char *shareopts, FILE *out) { static const char *const known_opts[] = { "ro", "maproot", "mapall", "mask", "network", "sec", "alldirs", "public", "webnfs", "index", "quiet" }; - static char newopts[OPTSSIZE]; - char oldopts[OPTSSIZE]; + char oldopts[OPTSSIZE], newopts[OPTSSIZE]; char *o, *s = NULL; unsigned int i; size_t len; @@ -104,7 +101,7 @@ translate_opts(const char *shareopts) strlcat(newopts, o, sizeof (newopts)); strlcat(newopts, " ", sizeof (newopts)); } - return (newopts); + return (fputs(newopts, out)); } static int @@ -114,8 +111,10 @@ nfs_enable_share_impl(sa_share_impl_t impl_share, FILE *tmpfile) if (strcmp(shareopts, "on") == 0) shareopts = ""; - if (fprintf(tmpfile, "%s\t%s\n", impl_share->sa_mountpoint, - translate_opts(shareopts)) < 0) { + if (fputs(impl_share->sa_mountpoint, tmpfile) == EOF || + fputc('\t', tmpfile) == EOF || + translate_opts(shareopts, tmpfile) == EOF || + fputc('\n', tmpfile) == EOF) { fprintf(stderr, "failed to write to temporary file\n"); return (SA_SYSTEM_ERR); } From 566e4a58b7e0952243517fa9ed8b4104975ad884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 12:57:47 +0100 Subject: [PATCH 044/119] libshare/nfs: destaticify nfs_lock_fd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/nfs.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/lib/libshare/nfs.c b/lib/libshare/nfs.c index 2a901bcec503..4a90bcbd3863 100644 --- a/lib/libshare/nfs.c +++ b/lib/libshare/nfs.c @@ -30,33 +30,30 @@ #include "nfs.h" -static int nfs_lock_fd = -1; - - /* * nfs_exports_[lock|unlock] are used to guard against conconcurrent * updates to the exports file. Each protocol is responsible for * providing the necessary locking to ensure consistency. */ static int -nfs_exports_lock(const char *name) +nfs_exports_lock(const char *name, int *nfs_lock_fd) { int err; - nfs_lock_fd = open(name, O_RDWR | O_CREAT | O_CLOEXEC, 0600); - if (nfs_lock_fd == -1) { + *nfs_lock_fd = open(name, O_RDWR | O_CREAT | O_CLOEXEC, 0600); + if (*nfs_lock_fd == -1) { err = errno; fprintf(stderr, "failed to lock %s: %s\n", name, strerror(err)); return (err); } - while ((err = flock(nfs_lock_fd, LOCK_EX)) != 0 && errno == EINTR) + while ((err = flock(*nfs_lock_fd, LOCK_EX)) != 0 && errno == EINTR) ; if (err != 0) { err = errno; fprintf(stderr, "failed to lock %s: %s\n", name, strerror(err)); - (void) close(nfs_lock_fd); - nfs_lock_fd = -1; + (void) close(*nfs_lock_fd); + *nfs_lock_fd = -1; return (err); } @@ -64,17 +61,16 @@ nfs_exports_lock(const char *name) } static void -nfs_exports_unlock(const char *name) +nfs_exports_unlock(const char *name, int *nfs_lock_fd) { - verify(nfs_lock_fd > 0); + verify(*nfs_lock_fd > 0); - if (flock(nfs_lock_fd, LOCK_UN) != 0) { + if (flock(*nfs_lock_fd, LOCK_UN) != 0) fprintf(stderr, "failed to unlock %s: %s\n", name, strerror(errno)); - } - (void) close(nfs_lock_fd); - nfs_lock_fd = -1; + (void) close(*nfs_lock_fd); + *nfs_lock_fd = -1; } struct tmpfile { @@ -216,13 +212,13 @@ nfs_toggle_share(const char *lockfile, const char *exports, const char *expdir, sa_share_impl_t impl_share, int(*cbk)(sa_share_impl_t impl_share, FILE *tmpfile)) { - int error; + int error, nfs_lock_fd = -1; struct tmpfile tmpf; if (!nfs_init_tmpfile(exports, expdir, &tmpf)) return (SA_SYSTEM_ERR); - error = nfs_exports_lock(lockfile); + error = nfs_exports_lock(lockfile, &nfs_lock_fd); if (error != 0) { nfs_abort_tmpfile(&tmpf); return (error); @@ -237,12 +233,12 @@ nfs_toggle_share(const char *lockfile, const char *exports, goto fullerr; error = nfs_fini_tmpfile(exports, &tmpf); - nfs_exports_unlock(lockfile); + nfs_exports_unlock(lockfile, &nfs_lock_fd); return (error); fullerr: nfs_abort_tmpfile(&tmpf); - nfs_exports_unlock(lockfile); + nfs_exports_unlock(lockfile, &nfs_lock_fd); return (error); } From 2faf05612f9172f4c02245cdfcca6b62a3e5f527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 13:13:10 +0100 Subject: [PATCH 045/119] libshare/smb: cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/os/freebsd/smb.c | 17 ++------- lib/libshare/os/linux/nfs.c | 4 +-- lib/libshare/os/linux/smb.c | 67 +++++++++++++++-------------------- lib/libshare/smb.h | 2 -- lib/libspl/include/libshare.h | 2 ++ 5 files changed, 36 insertions(+), 56 deletions(-) diff --git a/lib/libshare/os/freebsd/smb.c b/lib/libshare/os/freebsd/smb.c index 445784b756bc..f14e631b2332 100644 --- a/lib/libshare/os/freebsd/smb.c +++ b/lib/libshare/os/freebsd/smb.c @@ -23,20 +23,9 @@ * Copyright (c) 2020 by Delphix. All rights reserved. */ -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include #include #include "libshare_impl.h" -#include "smb.h" static sa_fstype_t *smb_fstype; @@ -47,7 +36,7 @@ static int smb_enable_share(sa_share_impl_t impl_share) { (void) impl_share; - fprintf(stderr, "No SMB support in FreeBSD yet.\n"); + fputs("No SMB support in FreeBSD yet.\n", stderr); return (SA_NOT_SUPPORTED); } /* @@ -57,7 +46,7 @@ static int smb_disable_share(sa_share_impl_t impl_share) { (void) impl_share; - fprintf(stderr, "No SMB support in FreeBSD yet.\n"); + fputs("No SMB support in FreeBSD yet.\n", stderr); return (SA_NOT_SUPPORTED); } @@ -68,7 +57,7 @@ static int smb_validate_shareopts(const char *shareopts) { (void) shareopts; - fprintf(stderr, "No SMB support in FreeBSD yet.\n"); + fputs("No SMB support in FreeBSD yet.\n", stderr); return (SA_NOT_SUPPORTED); } diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index 5acfa3fb8545..72653b6d40f5 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -496,8 +496,8 @@ static int nfs_commit_shares(void) { char *argv[] = { - "/usr/sbin/exportfs", - "-ra", + (char *)"/usr/sbin/exportfs", + (char *)"-ra", NULL }; diff --git a/lib/libshare/os/linux/smb.c b/lib/libshare/os/linux/smb.c index 47d1aa776c4f..f4a0bfd6bf9b 100644 --- a/lib/libshare/os/linux/smb.c +++ b/lib/libshare/os/linux/smb.c @@ -65,7 +65,7 @@ static boolean_t smb_available(void); static sa_fstype_t *smb_fstype; -smb_share_t *smb_shares; +static smb_share_t *smb_shares; static int smb_disable_share(sa_share_impl_t impl_share); static boolean_t smb_is_share_active(sa_share_impl_t impl_share); @@ -218,46 +218,39 @@ smb_retrieve_shares(void) static int smb_enable_share_one(const char *sharename, const char *sharepath) { - char *argv[10], *pos; char name[SMB_NAME_MAX], comment[SMB_COMMENT_MAX]; - int rc; /* Support ZFS share name regexp '[[:alnum:]_-.: ]' */ strlcpy(name, sharename, sizeof (name)); - name [sizeof (name)-1] = '\0'; - - pos = name; - while (*pos != '\0') { - switch (*pos) { + for (char *itr = name; *itr != '\0'; ++itr) + switch (*itr) { case '/': case '-': case ':': case ' ': - *pos = '_'; + *itr = '_'; } - ++pos; - } - /* * CMD: net -S NET_CMD_ARG_HOST usershare add Test1 /share/Test1 \ * "Comment" "Everyone:F" */ snprintf(comment, sizeof (comment), "Comment: %s", sharepath); - argv[0] = NET_CMD_PATH; - argv[1] = (char *)"-S"; - argv[2] = NET_CMD_ARG_HOST; - argv[3] = (char *)"usershare"; - argv[4] = (char *)"add"; - argv[5] = (char *)name; - argv[6] = (char *)sharepath; - argv[7] = (char *)comment; - argv[8] = (char *)"Everyone:F"; - argv[9] = NULL; - - rc = libzfs_run_process(argv[0], argv, 0); - if (rc < 0) + char *argv[] = { + (char *)NET_CMD_PATH, + (char *)"-S", + (char *)NET_CMD_ARG_HOST, + (char *)"usershare", + (char *)"add", + name, + (char *)sharepath, + comment, + (char *)"Everyone:F", + NULL, + }; + + if (libzfs_run_process(argv[0], argv, 0) < 0) return (SA_SYSTEM_ERR); /* Reload the share file */ @@ -298,20 +291,18 @@ smb_enable_share(sa_share_impl_t impl_share) static int smb_disable_share_one(const char *sharename) { - int rc; - char *argv[7]; - /* CMD: net -S NET_CMD_ARG_HOST usershare delete Test1 */ - argv[0] = NET_CMD_PATH; - argv[1] = (char *)"-S"; - argv[2] = NET_CMD_ARG_HOST; - argv[3] = (char *)"usershare"; - argv[4] = (char *)"delete"; - argv[5] = (char *)sharename; - argv[6] = NULL; - - rc = libzfs_run_process(argv[0], argv, 0); - if (rc < 0) + char *argv[] = { + (char *)NET_CMD_PATH, + (char *)"-S", + (char *)NET_CMD_ARG_HOST, + (char *)"usershare", + (char *)"delete", + (char *)sharename, + NULL, + }; + + if (libzfs_run_process(argv[0], argv, 0) < 0) return (SA_SYSTEM_ERR); else return (SA_OK); diff --git a/lib/libshare/smb.h b/lib/libshare/smb.h index 8ea44677f9ae..c45e0aec6067 100644 --- a/lib/libshare/smb.h +++ b/lib/libshare/smb.h @@ -44,6 +44,4 @@ typedef struct smb_share_s { struct smb_share_s *next; } smb_share_t; -extern smb_share_t *smb_shares; - void libshare_smb_init(void); diff --git a/lib/libspl/include/libshare.h b/lib/libspl/include/libshare.h index 5d06b163a3ba..0395c2815464 100644 --- a/lib/libspl/include/libshare.h +++ b/lib/libspl/include/libshare.h @@ -27,6 +27,8 @@ #ifndef _LIBSPL_LIBSHARE_H #define _LIBSPL_LIBSHARE_H extern __attribute__((visibility("default"))) +#include + /* API Initialization */ #define SA_INIT_SHARE_API 0x0001 /* init share specific interface */ #define SA_INIT_CONTROL_API 0x0002 /* init control specific interface */ From 4ccbb23971f6e8b41073509fb4934f1dd1ea1e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 13:37:06 +0100 Subject: [PATCH 046/119] libshare: interface: {=> const} char * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/libshare.c | 10 +++++----- lib/libspl/include/libshare.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c index 7bc31d7a6823..f4684cc69107 100644 --- a/lib/libshare/libshare.c +++ b/lib/libshare/libshare.c @@ -77,7 +77,7 @@ libshare_init(void) int sa_enable_share(const char *zfsname, const char *mountpoint, - const char *shareopts, char *protocol) + const char *shareopts, const char *protocol) { int rc, ret = SA_OK; boolean_t found_protocol = B_FALSE; @@ -111,7 +111,7 @@ sa_enable_share(const char *zfsname, const char *mountpoint, } int -sa_disable_share(const char *mountpoint, char *protocol) +sa_disable_share(const char *mountpoint, const char *protocol) { int rc, ret = SA_OK; boolean_t found_protocol = B_FALSE; @@ -140,7 +140,7 @@ sa_disable_share(const char *mountpoint, char *protocol) } boolean_t -sa_is_shared(const char *mountpoint, char *protocol) +sa_is_shared(const char *mountpoint, const char *protocol) { sa_fstype_t *fstype; boolean_t ret = B_FALSE; @@ -177,7 +177,7 @@ sa_commit_shares(const char *protocol) * * convert an error value to an error string */ -char * +const char * sa_errorstr(int err) { static char errstr[32]; @@ -295,7 +295,7 @@ sa_errorstr(int err) } int -sa_validate_shareopts(char *options, char *proto) +sa_validate_shareopts(const char *options, const char *proto) { sa_fstype_t *fstype; diff --git a/lib/libspl/include/libshare.h b/lib/libspl/include/libshare.h index 0395c2815464..01a203538b48 100644 --- a/lib/libspl/include/libshare.h +++ b/lib/libspl/include/libshare.h @@ -73,16 +73,16 @@ #define SA_SHARE_EXISTS 33 /* path or file is already shared */ /* initialization */ -_LIBSPL_LIBSHARE_H char *sa_errorstr(int); +_LIBSPL_LIBSHARE_H const char *sa_errorstr(int); /* share control */ _LIBSPL_LIBSHARE_H int sa_enable_share(const char *, const char *, const char *, - char *); -_LIBSPL_LIBSHARE_H int sa_disable_share(const char *, char *); -_LIBSPL_LIBSHARE_H boolean_t sa_is_shared(const char *, char *); + const char *); +_LIBSPL_LIBSHARE_H int sa_disable_share(const char *, const char *); +_LIBSPL_LIBSHARE_H boolean_t sa_is_shared(const char *, const char *); _LIBSPL_LIBSHARE_H void sa_commit_shares(const char *); /* protocol specific interfaces */ -_LIBSPL_LIBSHARE_H int sa_validate_shareopts(char *, char *); +_LIBSPL_LIBSHARE_H int sa_validate_shareopts(const char *, const char *); #endif /* _LIBSPL_LIBSHARE_H */ From 63ce6dd9886a6bf7b070fb353780b1b25f693c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 14:50:28 +0100 Subject: [PATCH 047/119] libshare: use AVL tree with static data, pass all data in arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it so we don't leak a consistent 64 bytes anymore, makes the searches simpler and faster, removes /all allocations/ from the driver (quite trivially, since they were absolutely needless), and makes libshare thread-safe (except, maybe, linux/smb, but that only does pointer-width loads/stores so it's also mostly fine, except for leaking smb_shares) Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/libshare.c | 326 ++++++++++------------------------ lib/libshare/libshare_impl.h | 41 ++--- lib/libshare/nfs.h | 2 - lib/libshare/os/freebsd/nfs.c | 32 +--- lib/libshare/os/freebsd/smb.c | 39 +--- lib/libshare/os/linux/nfs.c | 46 +---- lib/libshare/os/linux/smb.c | 48 +---- lib/libshare/smb.h | 2 - 8 files changed, 121 insertions(+), 415 deletions(-) diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c index f4684cc69107..4a8e32d773c6 100644 --- a/lib/libshare/libshare.c +++ b/lib/libshare/libshare.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -37,139 +38,84 @@ #include #include #include "libshare_impl.h" -#include "nfs.h" -#include "smb.h" -static sa_share_impl_t alloc_share(const char *zfsname, const char *path); -static void free_share(sa_share_impl_t share); - -static int fstypes_count; -static sa_fstype_t *fstypes; - -sa_fstype_t * -register_fstype(const char *name, const sa_share_ops_t *ops) +#define init_share(zfsname, path, shareopts) \ + { \ + .sa_zfsname = zfsname, \ + .sa_mountpoint = path, \ + .sa_shareopts = shareopts, \ + } +#define find_proto(pcol) \ + /* CSTYLED */ \ + ({ \ + sa_fstype_t prot = { \ + .protocol = pcol, \ + }; \ + avl_find(&fstypes, &prot, NULL); \ + }) + +static avl_tree_t fstypes; + +static int +fstypes_compar(const void *lhs, const void *rhs) { - sa_fstype_t *fstype; - - fstype = calloc(1, sizeof (sa_fstype_t)); - - if (fstype == NULL) - return (NULL); - - fstype->name = name; - fstype->ops = ops; - fstype->fsinfo_index = fstypes_count; - - fstypes_count++; - - fstype->next = fstypes; - fstypes = fstype; - - return (fstype); + const sa_fstype_t *l = lhs, *r = rhs; + int cmp = strcmp(l->protocol, r->protocol); + return ((0 < cmp) - (cmp < 0)); } __attribute__((constructor)) static void libshare_init(void) { - libshare_nfs_init(); - libshare_smb_init(); + avl_create(&fstypes, fstypes_compar, + sizeof (sa_fstype_t), offsetof(sa_fstype_t, node)); + avl_add(&fstypes, &libshare_nfs_type); + avl_add(&fstypes, &libshare_smb_type); } int sa_enable_share(const char *zfsname, const char *mountpoint, const char *shareopts, const char *protocol) { - int rc, ret = SA_OK; - boolean_t found_protocol = B_FALSE; - sa_fstype_t *fstype; - - sa_share_impl_t impl_share = alloc_share(zfsname, mountpoint); - if (impl_share == NULL) - return (SA_NO_MEMORY); - - fstype = fstypes; - while (fstype != NULL) { - if (strcmp(fstype->name, protocol) == 0) { - - rc = fstype->ops->update_shareopts(impl_share, - shareopts); - if (rc != SA_OK) - break; + sa_fstype_t *fstype = find_proto(protocol); + if (!fstype) + return (SA_INVALID_PROTOCOL); - rc = fstype->ops->enable_share(impl_share); - if (rc != SA_OK) - ret = rc; - - found_protocol = B_TRUE; - } - - fstype = fstype->next; - } - free_share(impl_share); - - return (found_protocol ? ret : SA_INVALID_PROTOCOL); + const struct sa_share_impl args = + init_share(zfsname, mountpoint, shareopts); + return (fstype->enable_share(&args)); } int sa_disable_share(const char *mountpoint, const char *protocol) { - int rc, ret = SA_OK; - boolean_t found_protocol = B_FALSE; - sa_fstype_t *fstype; - - sa_share_impl_t impl_share = alloc_share(NULL, mountpoint); - if (impl_share == NULL) - return (SA_NO_MEMORY); - - fstype = fstypes; - while (fstype != NULL) { - if (strcmp(fstype->name, protocol) == 0) { + sa_fstype_t *fstype = find_proto(protocol); + if (!fstype) + return (SA_INVALID_PROTOCOL); - rc = fstype->ops->disable_share(impl_share); - if (rc != SA_OK) - ret = rc; - - found_protocol = B_TRUE; - } - - fstype = fstype->next; - } - free_share(impl_share); - - return (found_protocol ? ret : SA_INVALID_PROTOCOL); + const struct sa_share_impl args = init_share(NULL, mountpoint, NULL); + return (fstype->disable_share(&args)); } boolean_t sa_is_shared(const char *mountpoint, const char *protocol) { - sa_fstype_t *fstype; - boolean_t ret = B_FALSE; - - /* guid value is not used */ - sa_share_impl_t impl_share = alloc_share(NULL, mountpoint); - if (impl_share == NULL) + sa_fstype_t *fstype = find_proto(protocol); + if (!fstype) return (B_FALSE); - fstype = fstypes; - while (fstype != NULL) { - if (strcmp(fstype->name, protocol) == 0) { - ret = fstype->ops->is_shared(impl_share); - } - fstype = fstype->next; - } - free_share(impl_share); - return (ret); + const struct sa_share_impl args = init_share(NULL, mountpoint, NULL); + return (fstype->is_shared(&args)); } void sa_commit_shares(const char *protocol) { - sa_fstype_t *fstype = fstypes; - while (fstype != NULL) { - if (strcmp(fstype->name, protocol) == 0) - fstype->ops->commit_shares(); - fstype = fstype->next; - } + sa_fstype_t *fstype = find_proto(protocol); + if (!fstype) + return; + + fstype->commit_shares(); } /* @@ -181,185 +127,91 @@ const char * sa_errorstr(int err) { static char errstr[32]; - char *ret = NULL; switch (err) { case SA_OK: - ret = dgettext(TEXT_DOMAIN, "ok"); - break; + return (dgettext(TEXT_DOMAIN, "ok")); case SA_NO_SUCH_PATH: - ret = dgettext(TEXT_DOMAIN, "path doesn't exist"); - break; + return (dgettext(TEXT_DOMAIN, "path doesn't exist")); case SA_NO_MEMORY: - ret = dgettext(TEXT_DOMAIN, "no memory"); - break; + return (dgettext(TEXT_DOMAIN, "no memory")); case SA_DUPLICATE_NAME: - ret = dgettext(TEXT_DOMAIN, "name in use"); - break; + return (dgettext(TEXT_DOMAIN, "name in use")); case SA_BAD_PATH: - ret = dgettext(TEXT_DOMAIN, "bad path"); - break; + return (dgettext(TEXT_DOMAIN, "bad path")); case SA_NO_SUCH_GROUP: - ret = dgettext(TEXT_DOMAIN, "no such group"); - break; + return (dgettext(TEXT_DOMAIN, "no such group")); case SA_CONFIG_ERR: - ret = dgettext(TEXT_DOMAIN, "configuration error"); - break; + return (dgettext(TEXT_DOMAIN, "configuration error")); case SA_SYSTEM_ERR: - ret = dgettext(TEXT_DOMAIN, "system error"); - break; + return (dgettext(TEXT_DOMAIN, "system error")); case SA_SYNTAX_ERR: - ret = dgettext(TEXT_DOMAIN, "syntax error"); - break; + return (dgettext(TEXT_DOMAIN, "syntax error")); case SA_NO_PERMISSION: - ret = dgettext(TEXT_DOMAIN, "no permission"); - break; + return (dgettext(TEXT_DOMAIN, "no permission")); case SA_BUSY: - ret = dgettext(TEXT_DOMAIN, "busy"); - break; + return (dgettext(TEXT_DOMAIN, "busy")); case SA_NO_SUCH_PROP: - ret = dgettext(TEXT_DOMAIN, "no such property"); - break; + return (dgettext(TEXT_DOMAIN, "no such property")); case SA_INVALID_NAME: - ret = dgettext(TEXT_DOMAIN, "invalid name"); - break; + return (dgettext(TEXT_DOMAIN, "invalid name")); case SA_INVALID_PROTOCOL: - ret = dgettext(TEXT_DOMAIN, "invalid protocol"); - break; + return (dgettext(TEXT_DOMAIN, "invalid protocol")); case SA_NOT_ALLOWED: - ret = dgettext(TEXT_DOMAIN, "operation not allowed"); - break; + return (dgettext(TEXT_DOMAIN, "operation not allowed")); case SA_BAD_VALUE: - ret = dgettext(TEXT_DOMAIN, "bad property value"); - break; + return (dgettext(TEXT_DOMAIN, "bad property value")); case SA_INVALID_SECURITY: - ret = dgettext(TEXT_DOMAIN, "invalid security type"); - break; + return (dgettext(TEXT_DOMAIN, "invalid security type")); case SA_NO_SUCH_SECURITY: - ret = dgettext(TEXT_DOMAIN, "security type not found"); - break; + return (dgettext(TEXT_DOMAIN, "security type not found")); case SA_VALUE_CONFLICT: - ret = dgettext(TEXT_DOMAIN, "property value conflict"); - break; + return (dgettext(TEXT_DOMAIN, "property value conflict")); case SA_NOT_IMPLEMENTED: - ret = dgettext(TEXT_DOMAIN, "not implemented"); - break; + return (dgettext(TEXT_DOMAIN, "not implemented")); case SA_INVALID_PATH: - ret = dgettext(TEXT_DOMAIN, "invalid path"); - break; + return (dgettext(TEXT_DOMAIN, "invalid path")); case SA_NOT_SUPPORTED: - ret = dgettext(TEXT_DOMAIN, "operation not supported"); - break; + return (dgettext(TEXT_DOMAIN, "operation not supported")); case SA_PROP_SHARE_ONLY: - ret = dgettext(TEXT_DOMAIN, "property not valid for group"); - break; + return (dgettext(TEXT_DOMAIN, "property not valid for group")); case SA_NOT_SHARED: - ret = dgettext(TEXT_DOMAIN, "not shared"); - break; + return (dgettext(TEXT_DOMAIN, "not shared")); case SA_NO_SUCH_RESOURCE: - ret = dgettext(TEXT_DOMAIN, "no such resource"); - break; + return (dgettext(TEXT_DOMAIN, "no such resource")); case SA_RESOURCE_REQUIRED: - ret = dgettext(TEXT_DOMAIN, "resource name required"); - break; + return (dgettext(TEXT_DOMAIN, "resource name required")); case SA_MULTIPLE_ERROR: - ret = dgettext(TEXT_DOMAIN, "errors from multiple protocols"); - break; + return (dgettext(TEXT_DOMAIN, + "errors from multiple protocols")); case SA_PATH_IS_SUBDIR: - ret = dgettext(TEXT_DOMAIN, "path is a subpath of share"); - break; + return (dgettext(TEXT_DOMAIN, "path is a subpath of share")); case SA_PATH_IS_PARENTDIR: - ret = dgettext(TEXT_DOMAIN, "path is parent of a share"); - break; + return (dgettext(TEXT_DOMAIN, "path is parent of a share")); case SA_NO_SECTION: - ret = dgettext(TEXT_DOMAIN, "protocol requires a section"); - break; + return (dgettext(TEXT_DOMAIN, "protocol requires a section")); case SA_NO_PROPERTIES: - ret = dgettext(TEXT_DOMAIN, "properties not found"); - break; + return (dgettext(TEXT_DOMAIN, "properties not found")); case SA_NO_SUCH_SECTION: - ret = dgettext(TEXT_DOMAIN, "section not found"); - break; + return (dgettext(TEXT_DOMAIN, "section not found")); case SA_PASSWORD_ENC: - ret = dgettext(TEXT_DOMAIN, "passwords must be encrypted"); - break; + return (dgettext(TEXT_DOMAIN, "passwords must be encrypted")); case SA_SHARE_EXISTS: - ret = dgettext(TEXT_DOMAIN, "path or file is already shared"); - break; + return (dgettext(TEXT_DOMAIN, + "path or file is already shared")); default: (void) snprintf(errstr, sizeof (errstr), dgettext(TEXT_DOMAIN, "unknown %d"), err); - ret = errstr; + return (errstr); } - return (ret); } int -sa_validate_shareopts(const char *options, const char *proto) -{ - sa_fstype_t *fstype; - - fstype = fstypes; - while (fstype != NULL) { - if (strcmp(fstype->name, proto) != 0) { - fstype = fstype->next; - continue; - } - - return (fstype->ops->validate_shareopts(options)); - } - - return (SA_INVALID_PROTOCOL); -} - -static sa_share_impl_t -alloc_share(const char *zfsname, const char *mountpoint) +sa_validate_shareopts(const char *options, const char *protocol) { - sa_share_impl_t impl_share; - - impl_share = calloc(1, sizeof (struct sa_share_impl)); - - if (impl_share == NULL) - return (NULL); - - if (mountpoint != NULL && - ((impl_share->sa_mountpoint = strdup(mountpoint)) == NULL)) { - free(impl_share); - return (NULL); - } - - if (zfsname != NULL && - ((impl_share->sa_zfsname = strdup(zfsname)) == NULL)) { - free(impl_share->sa_mountpoint); - free(impl_share); - return (NULL); - } - - impl_share->sa_fsinfo = calloc(fstypes_count, - sizeof (sa_share_fsinfo_t)); - if (impl_share->sa_fsinfo == NULL) { - free(impl_share->sa_mountpoint); - free(impl_share->sa_zfsname); - free(impl_share); - return (NULL); - } - - return (impl_share); -} - -static void -free_share(sa_share_impl_t impl_share) -{ - sa_fstype_t *fstype; - - fstype = fstypes; - while (fstype != NULL) { - fstype->ops->clear_shareopts(impl_share); - fstype = fstype->next; - } + sa_fstype_t *fstype = find_proto(protocol); + if (!fstype) + return (SA_INVALID_PROTOCOL); - free(impl_share->sa_mountpoint); - free(impl_share->sa_zfsname); - free(impl_share->sa_fsinfo); - free(impl_share); + return (fstype->validate_shareopts(options)); } diff --git a/lib/libshare/libshare_impl.h b/lib/libshare/libshare_impl.h index 63a6907539e0..c79b4f532a4f 100644 --- a/lib/libshare/libshare_impl.h +++ b/lib/libshare/libshare_impl.h @@ -27,39 +27,26 @@ #ifndef _LIBSPL_LIBSHARE_IMPL_H #define _LIBSPL_LIBSHARE_IMPL_H -typedef struct sa_share_fsinfo { - char *shareopts; -} sa_share_fsinfo_t; +#include -typedef struct sa_share_impl { - char *sa_mountpoint; - char *sa_zfsname; - - sa_share_fsinfo_t *sa_fsinfo; /* per-fstype information */ +typedef const struct sa_share_impl { + const char *sa_zfsname; + const char *sa_mountpoint; + const char *sa_shareopts; } *sa_share_impl_t; -#define FSINFO(impl_share, fstype) \ - (&(impl_share->sa_fsinfo[fstype->fsinfo_index])) - -typedef struct sa_share_ops { - int (*enable_share)(sa_share_impl_t share); - int (*disable_share)(sa_share_impl_t share); - boolean_t (*is_shared)(sa_share_impl_t share); - int (*validate_shareopts)(const char *shareopts); - int (*update_shareopts)(sa_share_impl_t impl_share, - const char *shareopts); - void (*clear_shareopts)(sa_share_impl_t impl_share); - int (*commit_shares)(void); -} sa_share_ops_t; +typedef struct { + const char *protocol; -typedef struct sa_fstype { - struct sa_fstype *next; + int (*const enable_share)(sa_share_impl_t share); + int (*const disable_share)(sa_share_impl_t share); + boolean_t (*const is_shared)(sa_share_impl_t share); + int (*const validate_shareopts)(const char *shareopts); + int (*const commit_shares)(void); - const char *name; - const sa_share_ops_t *ops; - int fsinfo_index; + avl_node_t node; } sa_fstype_t; -sa_fstype_t *register_fstype(const char *name, const sa_share_ops_t *ops); +extern sa_fstype_t libshare_nfs_type, libshare_smb_type; #endif /* _LIBSPL_LIBSHARE_IMPL_H */ diff --git a/lib/libshare/nfs.h b/lib/libshare/nfs.h index cfac274c3d26..777581625924 100644 --- a/lib/libshare/nfs.h +++ b/lib/libshare/nfs.h @@ -28,8 +28,6 @@ #define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n" -void libshare_nfs_init(void); - boolean_t nfs_is_shared_impl(const char *exports, sa_share_impl_t impl_share); int nfs_toggle_share(const char *lockfile, const char *exports, const char *expdir, sa_share_impl_t impl_share, diff --git a/lib/libshare/os/freebsd/nfs.c b/lib/libshare/os/freebsd/nfs.c index d0cd5f2b3fd9..388bafc2836b 100644 --- a/lib/libshare/os/freebsd/nfs.c +++ b/lib/libshare/os/freebsd/nfs.c @@ -52,8 +52,6 @@ __FBSDID("$FreeBSD$"); #define ZFS_EXPORTS_FILE "/etc/zfs/exports" #define ZFS_EXPORTS_LOCK ZFS_EXPORTS_FILE".lock" -static sa_fstype_t *nfs_fstype; - /* * This function translates options to a format acceptable by exports(5), eg. * @@ -107,7 +105,7 @@ translate_opts(const char *shareopts, FILE *out) static int nfs_enable_share_impl(sa_share_impl_t impl_share, FILE *tmpfile) { - char *shareopts = FSINFO(impl_share, nfs_fstype)->shareopts; + const char *shareopts = impl_share->sa_shareopts; if (strcmp(shareopts, "on") == 0) shareopts = ""; @@ -158,19 +156,6 @@ nfs_validate_shareopts(const char *shareopts) return (SA_OK); } -static int -nfs_update_shareopts(sa_share_impl_t impl_share, const char *shareopts) -{ - FSINFO(impl_share, nfs_fstype)->shareopts = (char *)shareopts; - return (SA_OK); -} - -static void -nfs_clear_shareopts(sa_share_impl_t impl_share) -{ - FSINFO(impl_share, nfs_fstype)->shareopts = NULL; -} - /* * Commit the shares by restarting mountd. */ @@ -201,22 +186,13 @@ nfs_commit_shares(void) return (SA_OK); } -static const sa_share_ops_t nfs_shareops = { +sa_fstype_t libshare_nfs_type = { + .protocol = "nfs", + .enable_share = nfs_enable_share, .disable_share = nfs_disable_share, .is_shared = nfs_is_shared, .validate_shareopts = nfs_validate_shareopts, - .update_shareopts = nfs_update_shareopts, - .clear_shareopts = nfs_clear_shareopts, .commit_shares = nfs_commit_shares, }; - -/* - * Initializes the NFS functionality of libshare. - */ -void -libshare_nfs_init(void) -{ - nfs_fstype = register_fstype("nfs", &nfs_shareops); -} diff --git a/lib/libshare/os/freebsd/smb.c b/lib/libshare/os/freebsd/smb.c index f14e631b2332..fd61d473d5c6 100644 --- a/lib/libshare/os/freebsd/smb.c +++ b/lib/libshare/os/freebsd/smb.c @@ -27,8 +27,6 @@ #include #include "libshare_impl.h" -static sa_fstype_t *smb_fstype; - /* * Enables SMB sharing for the specified share. */ @@ -71,51 +69,20 @@ smb_is_share_active(sa_share_impl_t impl_share) return (B_FALSE); } -/* - * Called to update a share's options. A share's options might be out of - * date if the share was loaded from disk and the "sharesmb" dataset - * property has changed in the meantime. This function also takes care - * of re-enabling the share if necessary. - */ -static int -smb_update_shareopts(sa_share_impl_t impl_share, const char *shareopts) -{ - (void) impl_share, (void) shareopts; - return (SA_OK); -} - static int smb_update_shares(void) { /* Not implemented */ return (0); } -/* - * Clears a share's SMB options. Used by libshare to - * clean up shares that are about to be free()'d. - */ -static void -smb_clear_shareopts(sa_share_impl_t impl_share) -{ - FSINFO(impl_share, smb_fstype)->shareopts = NULL; -} -static const sa_share_ops_t smb_shareops = { +sa_fstype_t libshare_smb_type = { + .protocol = "smb", + .enable_share = smb_enable_share, .disable_share = smb_disable_share, .is_shared = smb_is_share_active, .validate_shareopts = smb_validate_shareopts, - .update_shareopts = smb_update_shareopts, - .clear_shareopts = smb_clear_shareopts, .commit_shares = smb_update_shares, }; - -/* - * Initializes the SMB functionality of libshare. - */ -void -libshare_smb_init(void) -{ - smb_fstype = register_fstype("smb", &smb_shareops); -} diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index 72653b6d40f5..f8a34924c1eb 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -45,8 +45,6 @@ #define ZFS_EXPORTS_FILE ZFS_EXPORTS_DIR"/zfs.exports" #define ZFS_EXPORTS_LOCK ZFS_EXPORTS_FILE".lock" -static sa_fstype_t *nfs_fstype; - typedef int (*nfs_shareopt_callback_t)(const char *opt, const char *value, void *cookie); @@ -229,7 +227,6 @@ foreach_nfs_host(sa_share_impl_t impl_share, FILE *tmpfile, nfs_host_callback_t callback, void *cookie) { nfs_host_cookie_t udata; - char *shareopts; udata.callback = callback; udata.sharepath = impl_share->sa_mountpoint; @@ -237,10 +234,8 @@ foreach_nfs_host(sa_share_impl_t impl_share, FILE *tmpfile, udata.tmpfile = tmpfile; udata.security = "sys"; - shareopts = FSINFO(impl_share, nfs_fstype)->shareopts; - - return (foreach_nfs_shareopt(shareopts, foreach_nfs_host_cb, - &udata)); + return (foreach_nfs_shareopt(impl_share->sa_shareopts, + foreach_nfs_host_cb, &udata)); } /* @@ -411,11 +406,10 @@ nfs_add_entry(FILE *tmpfile, const char *sharepath, static int nfs_enable_share_impl(sa_share_impl_t impl_share, FILE *tmpfile) { - char *shareopts, *linux_opts; + char *linux_opts; int error; - shareopts = FSINFO(impl_share, nfs_fstype)->shareopts; - error = get_linux_shareopts(shareopts, &linux_opts); + error = get_linux_shareopts(impl_share->sa_shareopts, &linux_opts); if (error != SA_OK) return (error); @@ -475,23 +469,6 @@ nfs_validate_shareopts(const char *shareopts) return (SA_OK); } -static int -nfs_update_shareopts(sa_share_impl_t impl_share, const char *shareopts) -{ - FSINFO(impl_share, nfs_fstype)->shareopts = (char *)shareopts; - return (SA_OK); -} - -/* - * Clears a share's NFS options. Used by libshare to - * clean up shares that are about to be free()'d. - */ -static void -nfs_clear_shareopts(sa_share_impl_t impl_share) -{ - FSINFO(impl_share, nfs_fstype)->shareopts = NULL; -} - static int nfs_commit_shares(void) { @@ -504,22 +481,13 @@ nfs_commit_shares(void) return (libzfs_run_process(argv[0], argv, 0)); } -static const sa_share_ops_t nfs_shareops = { +sa_fstype_t libshare_nfs_type = { + .protocol = "nfs", + .enable_share = nfs_enable_share, .disable_share = nfs_disable_share, .is_shared = nfs_is_shared, .validate_shareopts = nfs_validate_shareopts, - .update_shareopts = nfs_update_shareopts, - .clear_shareopts = nfs_clear_shareopts, .commit_shares = nfs_commit_shares, }; - -/* - * Initializes the NFS functionality of libshare. - */ -void -libshare_nfs_init(void) -{ - nfs_fstype = register_fstype("nfs", &nfs_shareops); -} diff --git a/lib/libshare/os/linux/smb.c b/lib/libshare/os/linux/smb.c index f4a0bfd6bf9b..91dffc9bb8a7 100644 --- a/lib/libshare/os/linux/smb.c +++ b/lib/libshare/os/linux/smb.c @@ -63,8 +63,6 @@ static boolean_t smb_available(void); -static sa_fstype_t *smb_fstype; - static smb_share_t *smb_shares; static int smb_disable_share(sa_share_impl_t impl_share); static boolean_t smb_is_share_active(sa_share_impl_t impl_share); @@ -265,19 +263,16 @@ smb_enable_share_one(const char *sharename, const char *sharepath) static int smb_enable_share(sa_share_impl_t impl_share) { - char *shareopts; - if (!smb_available()) return (SA_SYSTEM_ERR); if (smb_is_share_active(impl_share)) smb_disable_share(impl_share); - shareopts = FSINFO(impl_share, smb_fstype)->shareopts; - if (shareopts == NULL) /* on/off */ + if (impl_share->sa_shareopts == NULL) /* on/off */ return (SA_SYSTEM_ERR); - if (strcmp(shareopts, "off") == 0) + if (strcmp(impl_share->sa_shareopts, "off") == 0) return (SA_OK); /* Magic: Enable (i.e., 'create new') share */ @@ -361,22 +356,6 @@ smb_is_share_active(sa_share_impl_t impl_share) return (B_FALSE); } -/* - * Called to update a share's options. A share's options might be out of - * date if the share was loaded from disk and the "sharesmb" dataset - * property has changed in the meantime. This function also takes care - * of re-enabling the share if necessary. - */ -static int -smb_update_shareopts(sa_share_impl_t impl_share, const char *shareopts) -{ - if (!impl_share) - return (SA_SYSTEM_ERR); - - FSINFO(impl_share, smb_fstype)->shareopts = (char *)shareopts; - return (SA_OK); -} - static int smb_update_shares(void) { @@ -384,24 +363,14 @@ smb_update_shares(void) return (0); } -/* - * Clears a share's SMB options. Used by libshare to - * clean up shares that are about to be free()'d. - */ -static void -smb_clear_shareopts(sa_share_impl_t impl_share) -{ - FSINFO(impl_share, smb_fstype)->shareopts = NULL; -} +sa_fstype_t libshare_smb_type = { + .protocol = "smb", -static const sa_share_ops_t smb_shareops = { .enable_share = smb_enable_share, .disable_share = smb_disable_share, .is_shared = smb_is_share_active, .validate_shareopts = smb_validate_shareopts, - .update_shareopts = smb_update_shareopts, - .clear_shareopts = smb_clear_shareopts, .commit_shares = smb_update_shares, }; @@ -422,12 +391,3 @@ smb_available(void) return (B_TRUE); } - -/* - * Initializes the SMB functionality of libshare. - */ -void -libshare_smb_init(void) -{ - smb_fstype = register_fstype("smb", &smb_shareops); -} diff --git a/lib/libshare/smb.h b/lib/libshare/smb.h index c45e0aec6067..ca3577751923 100644 --- a/lib/libshare/smb.h +++ b/lib/libshare/smb.h @@ -43,5 +43,3 @@ typedef struct smb_share_s { struct smb_share_s *next; } smb_share_t; - -void libshare_smb_init(void); From 21d976a62119d3442a0b83693b96f74ac6d0ff5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 15:00:49 +0100 Subject: [PATCH 048/119] libshare: delineate obsolete errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libspl/include/libshare.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/libspl/include/libshare.h b/lib/libspl/include/libshare.h index 01a203538b48..b8aa02095c29 100644 --- a/lib/libspl/include/libshare.h +++ b/lib/libspl/include/libshare.h @@ -29,28 +29,26 @@ #include -/* API Initialization */ -#define SA_INIT_SHARE_API 0x0001 /* init share specific interface */ -#define SA_INIT_CONTROL_API 0x0002 /* init control specific interface */ - /* * defined error values */ - #define SA_OK 0 -#define SA_NO_SUCH_PATH 1 /* provided path doesn't exist */ +#define SA_SYSTEM_ERR 7 /* system error, use errno */ +#define SA_SYNTAX_ERR 8 /* syntax error on command line */ #define SA_NO_MEMORY 2 /* no memory for data structures */ +#define SA_INVALID_PROTOCOL 13 /* specified protocol not valid */ +#define SA_NOT_SUPPORTED 21 /* operation not supported for proto */ + +/* The following errors are never returned by libshare */ +#define SA_NO_SUCH_PATH 1 /* provided path doesn't exist */ #define SA_DUPLICATE_NAME 3 /* object name is already in use */ #define SA_BAD_PATH 4 /* not a full path */ #define SA_NO_SUCH_GROUP 5 /* group is not defined */ #define SA_CONFIG_ERR 6 /* system configuration error */ -#define SA_SYSTEM_ERR 7 /* system error, use errno */ -#define SA_SYNTAX_ERR 8 /* syntax error on command line */ #define SA_NO_PERMISSION 9 /* no permission for operation */ #define SA_BUSY 10 /* resource is busy */ #define SA_NO_SUCH_PROP 11 /* property doesn't exist */ #define SA_INVALID_NAME 12 /* name of object is invalid */ -#define SA_INVALID_PROTOCOL 13 /* specified protocol not valid */ #define SA_NOT_ALLOWED 14 /* operation not allowed */ #define SA_BAD_VALUE 15 /* bad value for property */ #define SA_INVALID_SECURITY 16 /* invalid security type */ @@ -58,7 +56,6 @@ #define SA_VALUE_CONFLICT 18 /* property value conflict */ #define SA_NOT_IMPLEMENTED 19 /* plugin interface not implemented */ #define SA_INVALID_PATH 20 /* path is sub-dir of existing share */ -#define SA_NOT_SUPPORTED 21 /* operation not supported for proto */ #define SA_PROP_SHARE_ONLY 22 /* property valid on share only */ #define SA_NOT_SHARED 23 /* path is not shared */ #define SA_NO_SUCH_RESOURCE 24 /* resource not found */ From 471e9a108e51e92ef645223efcde59c8ab1b9db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 15:46:25 +0100 Subject: [PATCH 049/119] Publish libshare protocols, use enum-based API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/libshare.c | 88 +++++++----------- lib/libshare/libshare_impl.h | 8 +- lib/libshare/os/freebsd/nfs.c | 4 +- lib/libshare/os/freebsd/smb.c | 4 +- lib/libshare/os/linux/nfs.c | 4 +- lib/libshare/os/linux/smb.c | 4 +- lib/libspl/include/libshare.h | 20 +++-- lib/libzfs/libzfs_changelist.c | 5 +- lib/libzfs/libzfs_dataset.c | 9 +- lib/libzfs/libzfs_impl.h | 33 +++---- lib/libzfs/libzfs_mount.c | 159 +++++++++++++-------------------- 11 files changed, 134 insertions(+), 204 deletions(-) diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c index 4a8e32d773c6..09529e5b4106 100644 --- a/lib/libshare/libshare.c +++ b/lib/libshare/libshare.c @@ -45,77 +45,63 @@ .sa_mountpoint = path, \ .sa_shareopts = shareopts, \ } -#define find_proto(pcol) \ - /* CSTYLED */ \ - ({ \ - sa_fstype_t prot = { \ - .protocol = pcol, \ - }; \ - avl_find(&fstypes, &prot, NULL); \ - }) - -static avl_tree_t fstypes; - -static int -fstypes_compar(const void *lhs, const void *rhs) -{ - const sa_fstype_t *l = lhs, *r = rhs; - int cmp = strcmp(l->protocol, r->protocol); - return ((0 < cmp) - (cmp < 0)); -} -__attribute__((constructor)) static void -libshare_init(void) -{ - avl_create(&fstypes, fstypes_compar, - sizeof (sa_fstype_t), offsetof(sa_fstype_t, node)); - avl_add(&fstypes, &libshare_nfs_type); - avl_add(&fstypes, &libshare_smb_type); -} +#define VALIDATE_PROTOCOL(proto, ...) \ + if ((proto) < 0 || (proto) >= SA_PROTOCOL_COUNT) \ + return __VA_ARGS__ + +const char *const sa_protocol_names[SA_PROTOCOL_COUNT] = { + [SA_PROTOCOL_NFS] = "nfs", + [SA_PROTOCOL_SMB] = "smb", +}; + +static const sa_fstype_t *fstypes[SA_PROTOCOL_COUNT] = + {&libshare_nfs_type, &libshare_smb_type}; int sa_enable_share(const char *zfsname, const char *mountpoint, - const char *shareopts, const char *protocol) + const char *shareopts, enum sa_protocol protocol) { - sa_fstype_t *fstype = find_proto(protocol); - if (!fstype) - return (SA_INVALID_PROTOCOL); + VALIDATE_PROTOCOL(protocol, SA_INVALID_PROTOCOL); const struct sa_share_impl args = init_share(zfsname, mountpoint, shareopts); - return (fstype->enable_share(&args)); + return (fstypes[protocol]->enable_share(&args)); } int -sa_disable_share(const char *mountpoint, const char *protocol) +sa_disable_share(const char *mountpoint, enum sa_protocol protocol) { - sa_fstype_t *fstype = find_proto(protocol); - if (!fstype) - return (SA_INVALID_PROTOCOL); + VALIDATE_PROTOCOL(protocol, SA_INVALID_PROTOCOL); const struct sa_share_impl args = init_share(NULL, mountpoint, NULL); - return (fstype->disable_share(&args)); + return (fstypes[protocol]->disable_share(&args)); } boolean_t -sa_is_shared(const char *mountpoint, const char *protocol) +sa_is_shared(const char *mountpoint, enum sa_protocol protocol) { - sa_fstype_t *fstype = find_proto(protocol); - if (!fstype) - return (B_FALSE); + VALIDATE_PROTOCOL(protocol, B_FALSE); const struct sa_share_impl args = init_share(NULL, mountpoint, NULL); - return (fstype->is_shared(&args)); + return (fstypes[protocol]->is_shared(&args)); } void -sa_commit_shares(const char *protocol) +sa_commit_shares(enum sa_protocol protocol) +{ + /* CSTYLED */ + VALIDATE_PROTOCOL(protocol, ); + + fstypes[protocol]->commit_shares(); +} + +int +sa_validate_shareopts(const char *options, enum sa_protocol protocol) { - sa_fstype_t *fstype = find_proto(protocol); - if (!fstype) - return; + VALIDATE_PROTOCOL(protocol, SA_INVALID_PROTOCOL); - fstype->commit_shares(); + return (fstypes[protocol]->validate_shareopts(options)); } /* @@ -205,13 +191,3 @@ sa_errorstr(int err) return (errstr); } } - -int -sa_validate_shareopts(const char *options, const char *protocol) -{ - sa_fstype_t *fstype = find_proto(protocol); - if (!fstype) - return (SA_INVALID_PROTOCOL); - - return (fstype->validate_shareopts(options)); -} diff --git a/lib/libshare/libshare_impl.h b/lib/libshare/libshare_impl.h index c79b4f532a4f..110fe93d250f 100644 --- a/lib/libshare/libshare_impl.h +++ b/lib/libshare/libshare_impl.h @@ -27,8 +27,6 @@ #ifndef _LIBSPL_LIBSHARE_IMPL_H #define _LIBSPL_LIBSHARE_IMPL_H -#include - typedef const struct sa_share_impl { const char *sa_zfsname; const char *sa_mountpoint; @@ -36,17 +34,13 @@ typedef const struct sa_share_impl { } *sa_share_impl_t; typedef struct { - const char *protocol; - int (*const enable_share)(sa_share_impl_t share); int (*const disable_share)(sa_share_impl_t share); boolean_t (*const is_shared)(sa_share_impl_t share); int (*const validate_shareopts)(const char *shareopts); int (*const commit_shares)(void); - - avl_node_t node; } sa_fstype_t; -extern sa_fstype_t libshare_nfs_type, libshare_smb_type; +extern const sa_fstype_t libshare_nfs_type, libshare_smb_type; #endif /* _LIBSPL_LIBSHARE_IMPL_H */ diff --git a/lib/libshare/os/freebsd/nfs.c b/lib/libshare/os/freebsd/nfs.c index 388bafc2836b..338d25fcd0f8 100644 --- a/lib/libshare/os/freebsd/nfs.c +++ b/lib/libshare/os/freebsd/nfs.c @@ -186,9 +186,7 @@ nfs_commit_shares(void) return (SA_OK); } -sa_fstype_t libshare_nfs_type = { - .protocol = "nfs", - +const sa_fstype_t libshare_nfs_type = { .enable_share = nfs_enable_share, .disable_share = nfs_disable_share, .is_shared = nfs_is_shared, diff --git a/lib/libshare/os/freebsd/smb.c b/lib/libshare/os/freebsd/smb.c index fd61d473d5c6..0f546dc5543e 100644 --- a/lib/libshare/os/freebsd/smb.c +++ b/lib/libshare/os/freebsd/smb.c @@ -76,9 +76,7 @@ smb_update_shares(void) return (0); } -sa_fstype_t libshare_smb_type = { - .protocol = "smb", - +const sa_fstype_t libshare_smb_type = { .enable_share = smb_enable_share, .disable_share = smb_disable_share, .is_shared = smb_is_share_active, diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index f8a34924c1eb..09c7395c660c 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -481,9 +481,7 @@ nfs_commit_shares(void) return (libzfs_run_process(argv[0], argv, 0)); } -sa_fstype_t libshare_nfs_type = { - .protocol = "nfs", - +const sa_fstype_t libshare_nfs_type = { .enable_share = nfs_enable_share, .disable_share = nfs_disable_share, .is_shared = nfs_is_shared, diff --git a/lib/libshare/os/linux/smb.c b/lib/libshare/os/linux/smb.c index 91dffc9bb8a7..1f32d0e1096a 100644 --- a/lib/libshare/os/linux/smb.c +++ b/lib/libshare/os/linux/smb.c @@ -363,9 +363,7 @@ smb_update_shares(void) return (0); } -sa_fstype_t libshare_smb_type = { - .protocol = "smb", - +const sa_fstype_t libshare_smb_type = { .enable_share = smb_enable_share, .disable_share = smb_disable_share, .is_shared = smb_is_share_active, diff --git a/lib/libspl/include/libshare.h b/lib/libspl/include/libshare.h index b8aa02095c29..ae0e2c39dc6d 100644 --- a/lib/libspl/include/libshare.h +++ b/lib/libspl/include/libshare.h @@ -72,14 +72,24 @@ /* initialization */ _LIBSPL_LIBSHARE_H const char *sa_errorstr(int); +/* available protocols */ +enum sa_protocol { + SA_PROTOCOL_NFS, + SA_PROTOCOL_SMB, /* ABI: add before _COUNT */ + SA_PROTOCOL_COUNT, +}; + +/* lower-case */ +_LIBSPL_LIBSHARE_H const char *const sa_protocol_names[SA_PROTOCOL_COUNT]; + /* share control */ _LIBSPL_LIBSHARE_H int sa_enable_share(const char *, const char *, const char *, - const char *); -_LIBSPL_LIBSHARE_H int sa_disable_share(const char *, const char *); -_LIBSPL_LIBSHARE_H boolean_t sa_is_shared(const char *, const char *); -_LIBSPL_LIBSHARE_H void sa_commit_shares(const char *); + enum sa_protocol); +_LIBSPL_LIBSHARE_H int sa_disable_share(const char *, enum sa_protocol); +_LIBSPL_LIBSHARE_H boolean_t sa_is_shared(const char *, enum sa_protocol); +_LIBSPL_LIBSHARE_H void sa_commit_shares(enum sa_protocol); /* protocol specific interfaces */ -_LIBSPL_LIBSHARE_H int sa_validate_shareopts(const char *, const char *); +_LIBSPL_LIBSHARE_H int sa_validate_shareopts(const char *, enum sa_protocol); #endif /* _LIBSPL_LIBSHARE_H */ diff --git a/lib/libzfs/libzfs_changelist.c b/lib/libzfs/libzfs_changelist.c index 5441864c5cf6..a70c7424b997 100644 --- a/lib/libzfs/libzfs_changelist.c +++ b/lib/libzfs/libzfs_changelist.c @@ -345,7 +345,7 @@ changelist_rename(prop_changelist_t *clp, const char *src, const char *dst) * unshare all the datasets in the list. */ int -changelist_unshare(prop_changelist_t *clp, const zfs_share_proto_t *proto) +changelist_unshare(prop_changelist_t *clp, const enum sa_protocol *proto) { prop_changenode_t *cn; uu_avl_walk_t *walk; @@ -363,7 +363,8 @@ changelist_unshare(prop_changelist_t *clp, const zfs_share_proto_t *proto) ret = -1; } - zfs_commit_proto(proto); + for (const enum sa_protocol *p = proto; *p != SA_NO_PROTOCOL; ++p) + sa_commit_shares(*p); uu_avl_walk_end(walk); return (ret); diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 3469d380652e..e5c1bd62d5d1 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1418,14 +1418,15 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, prop == ZFS_PROP_SHARESMB) && strcmp(strval, "on") != 0 && strcmp(strval, "off") != 0) { - zfs_share_proto_t proto; + enum sa_protocol proto; if (prop == ZFS_PROP_SHARESMB) - proto = PROTO_SMB; + proto = SA_PROTOCOL_SMB; else - proto = PROTO_NFS; + proto = SA_PROTOCOL_NFS; - if (zfs_parse_options(strval, proto) != SA_OK) { + if (sa_validate_shareopts(strval, proto) != + SA_OK) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "'%s' cannot be set to invalid " "options"), propname); diff --git a/lib/libzfs/libzfs_impl.h b/lib/libzfs/libzfs_impl.h index 4b18ad66854f..bf1a8359cef2 100644 --- a/lib/libzfs/libzfs_impl.h +++ b/lib/libzfs/libzfs_impl.h @@ -105,21 +105,14 @@ struct zpool_handle { diskaddr_t zpool_start_block; }; -typedef enum { - PROTO_NFS = 0, - PROTO_SMB = 1, - PROTO_END = 2 -} zfs_share_proto_t; - /* - * The following can be used as a bitmask and any new values - * added must preserve that capability. + * Bitmask of shared types: + * 0 means none, otherwise | (1 << (enum sa_protocol + 1)). */ -typedef enum { - SHARED_NOT_SHARED = 0x0, - SHARED_NFS = 0x2, - SHARED_SMB = 0x4 -} zfs_share_type_t; +typedef unsigned zfs_share_type_t; +#define SHARED_NOT_SHARED 0 + +#define SA_NO_PROTOCOL -1 typedef int (*zfs_uri_handler_fn_t)(struct libzfs_handle *, const char *, const char *, zfs_keyformat_t, boolean_t, uint8_t **, size_t *); @@ -189,7 +182,7 @@ extern void changelist_remove(prop_changelist_t *, const char *); extern void changelist_free(prop_changelist_t *); extern prop_changelist_t *changelist_gather(zfs_handle_t *, zfs_prop_t, int, int); -extern int changelist_unshare(prop_changelist_t *, const zfs_share_proto_t *); +extern int changelist_unshare(prop_changelist_t *, const enum sa_protocol *); extern int changelist_haszonedchild(prop_changelist_t *); extern void remove_mountpoint(zfs_handle_t *); @@ -209,11 +202,8 @@ extern int zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type, extern void namespace_clear(libzfs_handle_t *); -extern int zfs_parse_options(char *, zfs_share_proto_t); - typedef struct { zfs_prop_t p_prop; - char *p_name; int p_share_err; int p_unshare_err; } proto_table_t; @@ -244,20 +234,19 @@ extern int do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags); extern int do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags); extern int zfs_mount_delegation_check(void); -extern int zfs_share_proto(zfs_handle_t *zhp, const zfs_share_proto_t *proto); +extern int zfs_share_proto(zfs_handle_t *zhp, const enum sa_protocol *proto); extern int zfs_unshare_proto(zfs_handle_t *, const char *, - const zfs_share_proto_t *); + const enum sa_protocol *); extern int unshare_one(libzfs_handle_t *hdl, const char *name, - const char *mountpoint, zfs_share_proto_t proto); + const char *mountpoint, enum sa_protocol proto); extern boolean_t zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen, zprop_source_t *source, int flags); extern zfs_share_type_t is_shared(const char *mountpoint, - zfs_share_proto_t proto); + enum sa_protocol proto); extern int libzfs_load_module(void); extern int zpool_relabel_disk(libzfs_handle_t *hdl, const char *path, const char *msg); extern int find_shares_object(differ_info_t *di); -extern void zfs_commit_proto(const zfs_share_proto_t *); #ifdef __cplusplus } diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 59cfa22d34cc..ea7e97c2932f 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -96,30 +96,19 @@ static int mount_tp_nthr = 512; /* tpool threads for multi-threaded mounting */ static void zfs_mount_task(void *); static zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, char **, - zfs_share_proto_t); + enum sa_protocol); -/* - * The share protocols table must be in the same order as the zfs_share_proto_t - * enum in libzfs_impl.h - */ -static const proto_table_t proto_table[PROTO_END] = { - {ZFS_PROP_SHARENFS, "nfs", EZFS_SHARENFSFAILED, EZFS_UNSHARENFSFAILED}, - {ZFS_PROP_SHARESMB, "smb", EZFS_SHARESMBFAILED, EZFS_UNSHARESMBFAILED}, +static const proto_table_t proto_table[SA_PROTOCOL_COUNT] = { + [SA_PROTOCOL_NFS] = + {ZFS_PROP_SHARENFS, EZFS_SHARENFSFAILED, EZFS_UNSHARENFSFAILED}, + [SA_PROTOCOL_SMB] = + {ZFS_PROP_SHARESMB, EZFS_SHARESMBFAILED, EZFS_UNSHARESMBFAILED}, }; -static const zfs_share_proto_t nfs_only[] = { - PROTO_NFS, - PROTO_END -}; - -static const zfs_share_proto_t smb_only[] = { - PROTO_SMB, - PROTO_END -}; -static const zfs_share_proto_t share_all_proto[] = { - PROTO_NFS, - PROTO_SMB, - PROTO_END +static const enum sa_protocol share_all_proto[SA_PROTOCOL_COUNT + 1] = { + SA_PROTOCOL_NFS, + SA_PROTOCOL_SMB, + SA_NO_PROTOCOL }; @@ -705,17 +694,14 @@ zfs_unmountall(zfs_handle_t *zhp, int flags) boolean_t zfs_is_shared(zfs_handle_t *zhp) { - zfs_share_type_t rc = 0; - const zfs_share_proto_t *curr_proto; - if (ZFS_IS_VOLUME(zhp)) return (B_FALSE); - for (curr_proto = share_all_proto; *curr_proto != PROTO_END; - curr_proto++) - rc |= zfs_is_shared_proto(zhp, NULL, *curr_proto); + for (enum sa_protocol i = 0; i < SA_PROTOCOL_COUNT; ++i) + if (zfs_is_shared_proto(zhp, NULL, i)) + return (B_TRUE); - return (rc ? B_TRUE : B_FALSE); + return (B_FALSE); } /* @@ -723,16 +709,14 @@ zfs_is_shared(zfs_handle_t *zhp) */ int unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint, - zfs_share_proto_t proto) + enum sa_protocol proto) { - int err; - - err = sa_disable_share(mountpoint, proto_table[proto].p_name); - if (err != SA_OK) { + int err = sa_disable_share(mountpoint, proto); + if (err != SA_OK) return (zfs_error_fmt(hdl, proto_table[proto].p_unshare_err, dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"), name, sa_errorstr(err))); - } + return (0); } @@ -741,19 +725,12 @@ unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint, * a zfs_share_type_t value. */ zfs_share_type_t -is_shared(const char *mountpoint, zfs_share_proto_t proto) +is_shared(const char *mountpoint, enum sa_protocol proto) { - if (sa_is_shared(mountpoint, proto_table[proto].p_name)) { - switch (proto) { - case PROTO_NFS: - return (SHARED_NFS); - case PROTO_SMB: - return (SHARED_SMB); - default: - return (SHARED_NOT_SHARED); - } - } - return (SHARED_NOT_SHARED); + if (sa_is_shared(mountpoint, proto)) + return (1 << (proto + 1)); + else + return (SHARED_NOT_SHARED); } /* @@ -762,19 +739,19 @@ is_shared(const char *mountpoint, zfs_share_proto_t proto) * on "libshare" to do the dirty work for us. */ int -zfs_share_proto(zfs_handle_t *zhp, const zfs_share_proto_t *proto) +zfs_share_proto(zfs_handle_t *zhp, const enum sa_protocol *proto) { char mountpoint[ZFS_MAXPROPLEN]; char shareopts[ZFS_MAXPROPLEN]; char sourcestr[ZFS_MAXPROPLEN]; - const zfs_share_proto_t *curr_proto; + const enum sa_protocol *curr_proto; zprop_source_t sourcetype; int err = 0; if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL, 0)) return (0); - for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) { + for (curr_proto = proto; *curr_proto != SA_NO_PROTOCOL; curr_proto++) { /* * Return success if there are no share options. */ @@ -794,7 +771,7 @@ zfs_share_proto(zfs_handle_t *zhp, const zfs_share_proto_t *proto) continue; err = sa_enable_share(zfs_get_name(zhp), mountpoint, shareopts, - proto_table[*curr_proto].p_name); + *curr_proto); if (err != SA_OK) { return (zfs_error_fmt(zhp->zfs_hdl, proto_table[*curr_proto].p_share_err, @@ -824,7 +801,7 @@ zfs_unshare(zfs_handle_t *zhp) * Check to see if the filesystem is currently shared. */ static zfs_share_type_t -zfs_is_shared_proto(zfs_handle_t *zhp, char **where, zfs_share_proto_t proto) +zfs_is_shared_proto(zfs_handle_t *zhp, char **where, enum sa_protocol proto) { char *mountpoint; zfs_share_type_t rc; @@ -849,74 +826,60 @@ boolean_t zfs_is_shared_nfs(zfs_handle_t *zhp, char **where) { return (zfs_is_shared_proto(zhp, where, - PROTO_NFS) != SHARED_NOT_SHARED); + SA_PROTOCOL_NFS) != SHARED_NOT_SHARED); } boolean_t zfs_is_shared_smb(zfs_handle_t *zhp, char **where) { return (zfs_is_shared_proto(zhp, where, - PROTO_SMB) != SHARED_NOT_SHARED); -} - -/* - * zfs_parse_options(options, proto) - * - * Call the legacy parse interface to get the protocol specific - * options using the NULL arg to indicate that this is a "parse" only. - */ -int -zfs_parse_options(char *options, zfs_share_proto_t proto) -{ - return (sa_validate_shareopts(options, proto_table[proto].p_name)); -} - -void -zfs_commit_proto(const zfs_share_proto_t *proto) -{ - const zfs_share_proto_t *curr_proto; - for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) - sa_commit_shares(proto_table[*curr_proto].p_name); + SA_PROTOCOL_SMB) != SHARED_NOT_SHARED); } void zfs_commit_nfs_shares(void) { - zfs_commit_proto(nfs_only); + sa_commit_shares(SA_PROTOCOL_NFS); } void zfs_commit_smb_shares(void) { - zfs_commit_proto(smb_only); + sa_commit_shares(SA_PROTOCOL_SMB); } void zfs_commit_all_shares(void) { - zfs_commit_proto(share_all_proto); + for (enum sa_protocol i = 0; i < SA_PROTOCOL_COUNT; ++i) + sa_commit_shares(i); } void zfs_commit_shares(const char *proto) { if (proto == NULL) - zfs_commit_proto(share_all_proto); - else if (strcmp(proto, "nfs") == 0) - zfs_commit_proto(nfs_only); - else if (strcmp(proto, "smb") == 0) - zfs_commit_proto(smb_only); + zfs_commit_all_shares(); + else + for (enum sa_protocol i = 0; i < ARRAY_SIZE(sa_protocol_names); + ++i) + if (strcmp(proto, sa_protocol_names[i]) == 0) { + sa_commit_shares(i); + return; + } } int zfs_share_nfs(zfs_handle_t *zhp) { + const enum sa_protocol nfs_only[] = {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; return (zfs_share_proto(zhp, nfs_only)); } int zfs_share_smb(zfs_handle_t *zhp) { + const enum sa_protocol smb_only[] = {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; return (zfs_share_proto(zhp, smb_only)); } @@ -931,7 +894,7 @@ zfs_shareall(zfs_handle_t *zhp) */ int zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint, - const zfs_share_proto_t *proto) + const enum sa_protocol *proto) { libzfs_handle_t *hdl = zhp->zfs_hdl; struct mnttab entry; @@ -943,12 +906,12 @@ zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint, if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) && libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) { - const zfs_share_proto_t *curr_proto; + const enum sa_protocol *curr_proto; if (mountpoint == NULL) mntpt = zfs_strdup(zhp->zfs_hdl, entry.mnt_mountp); - for (curr_proto = proto; *curr_proto != PROTO_END; + for (curr_proto = proto; *curr_proto != SA_NO_PROTOCOL; curr_proto++) { if (is_shared(mntpt, *curr_proto)) { @@ -970,12 +933,14 @@ zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint, int zfs_unshare_nfs(zfs_handle_t *zhp, const char *mountpoint) { + const enum sa_protocol nfs_only[] = {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; return (zfs_unshare_proto(zhp, mountpoint, nfs_only)); } int zfs_unshare_smb(zfs_handle_t *zhp, const char *mountpoint) { + const enum sa_protocol smb_only[] = {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; return (zfs_unshare_proto(zhp, mountpoint, smb_only)); } @@ -983,7 +948,7 @@ zfs_unshare_smb(zfs_handle_t *zhp, const char *mountpoint) * Same as zfs_unmountall(), but for NFS and SMB unshares. */ static int -zfs_unshareall_proto(zfs_handle_t *zhp, const zfs_share_proto_t *proto) +zfs_unshareall_proto(zfs_handle_t *zhp, const enum sa_protocol *proto) { prop_changelist_t *clp; int ret; @@ -1001,12 +966,14 @@ zfs_unshareall_proto(zfs_handle_t *zhp, const zfs_share_proto_t *proto) int zfs_unshareall_nfs(zfs_handle_t *zhp) { + const enum sa_protocol nfs_only[] = {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; return (zfs_unshareall_proto(zhp, nfs_only)); } int zfs_unshareall_smb(zfs_handle_t *zhp) { + const enum sa_protocol smb_only[] = {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; return (zfs_unshareall_proto(zhp, smb_only)); } @@ -1028,12 +995,14 @@ zfs_unshareall_bytype(zfs_handle_t *zhp, const char *mountpoint, { if (proto == NULL) return (zfs_unshare_proto(zhp, mountpoint, share_all_proto)); - if (strcmp(proto, "nfs") == 0) - return (zfs_unshare_proto(zhp, mountpoint, nfs_only)); - else if (strcmp(proto, "smb") == 0) - return (zfs_unshare_proto(zhp, mountpoint, smb_only)); - else - return (1); + + for (enum sa_protocol i = 0; i < ARRAY_SIZE(sa_protocol_names); ++i) + if (strcmp(proto, sa_protocol_names[i]) == 0) { + enum sa_protocol protocols[] = {i, SA_NO_PROTOCOL}; + return (zfs_unshare_proto(zhp, mountpoint, protocols)); + } + + return (1); } /* @@ -1608,12 +1577,10 @@ zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force) * Walk through and first unshare everything. */ for (i = 0; i < used; i++) { - const zfs_share_proto_t *curr_proto; - for (curr_proto = share_all_proto; *curr_proto != PROTO_END; - curr_proto++) { - if (is_shared(sets[i].mountpoint, *curr_proto) && + for (enum sa_protocol i = 0; i < SA_PROTOCOL_COUNT; ++i) { + if (is_shared(sets[i].mountpoint, i) && unshare_one(hdl, sets[i].mountpoint, - sets[i].mountpoint, *curr_proto) != 0) + sets[i].mountpoint, i) != 0) goto out; } } From b4d9a82f6244df1b500a2988cf60849866fb4265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 16:52:07 +0100 Subject: [PATCH 050/119] Replace libzfs sharing _nfs() and _smb() APIs with protocol lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the additional benefit of removing all the _all() functions and treating a NULL list as "all" ‒ the remaining all function is for all /datasets/, which is consistent with the rest of the API Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- cmd/zfs/zfs_main.c | 97 ++++++------- cmd/zpool/zpool_main.c | 4 +- include/libzfs.h | 41 ++---- lib/libzfs/libzfs.abi | 189 ++++++++++++------------ lib/libzfs/libzfs_changelist.c | 34 +++-- lib/libzfs/libzfs_dataset.c | 4 +- lib/libzfs/libzfs_impl.h | 19 --- lib/libzfs/libzfs_mount.c | 254 +++++++-------------------------- 8 files changed, 228 insertions(+), 414 deletions(-) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index c7c826aeceb0..69f5bdf4d494 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -764,12 +764,12 @@ zfs_mount_and_share(libzfs_handle_t *hdl, const char *dataset, zfs_type_t type) (void) fprintf(stderr, gettext("filesystem " "successfully created, but not mounted\n")); ret = 1; - } else if (zfs_share(zhp) != 0) { + } else if (zfs_share(zhp, NULL) != 0) { (void) fprintf(stderr, gettext("filesystem " "successfully created, but not shared\n")); ret = 1; } - zfs_commit_all_shares(); + zfs_commit_shares(NULL); } zfs_close(zhp); @@ -6658,7 +6658,7 @@ typedef struct share_mount_state { boolean_t sm_verbose; int sm_flags; char *sm_options; - char *sm_proto; /* only valid for OP_SHARE */ + enum sa_protocol sm_proto; /* only valid for OP_SHARE */ pthread_mutex_t sm_lock; /* protects the remaining fields */ uint_t sm_total; /* number of filesystems to process */ uint_t sm_done; /* number of filesystems processed */ @@ -6669,7 +6669,7 @@ typedef struct share_mount_state { * Share or mount a dataset. */ static int -share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol, +share_mount_one(zfs_handle_t *zhp, int op, int flags, enum sa_protocol protocol, boolean_t explicit, const char *options) { char mountpoint[ZFS_MAXPROPLEN]; @@ -6787,7 +6787,7 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol, return (0); if (op == OP_SHARE && !zfs_is_mounted(zhp, NULL)) { /* also purge it from existing exports */ - zfs_unshareall_bypath(zhp, mountpoint); + zfs_unshare(zhp, mountpoint, NULL); return (0); } } @@ -6845,10 +6845,11 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol, * filesystem. */ switch (op) { - case OP_SHARE: - - shared_nfs = zfs_is_shared_nfs(zhp, NULL); - shared_smb = zfs_is_shared_smb(zhp, NULL); + case OP_SHARE: { + enum sa_protocol prot[] = {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; + shared_nfs = zfs_is_shared(zhp, NULL, prot); + *prot = SA_PROTOCOL_SMB; + shared_smb = zfs_is_shared(zhp, NULL, prot); if ((shared_nfs && shared_smb) || (shared_nfs && strcmp(shareopts, "on") == 0 && @@ -6868,23 +6869,11 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol, zfs_mount(zhp, NULL, flags) != 0) return (1); - if (protocol == NULL) { - if (zfs_shareall(zhp) != 0) - return (1); - } else if (strcmp(protocol, "nfs") == 0) { - if (zfs_share_nfs(zhp)) - return (1); - } else if (strcmp(protocol, "smb") == 0) { - if (zfs_share_smb(zhp)) - return (1); - } else { - (void) fprintf(stderr, gettext("cannot share " - "'%s': invalid share type '%s' " - "specified\n"), - zfs_get_name(zhp), protocol); + *prot = protocol; + if (zfs_share(zhp, protocol == SA_NO_PROTOCOL ? NULL : prot)) return (1); - } + } break; case OP_MOUNT: @@ -6982,6 +6971,22 @@ append_options(char *mntopts, char *newopts) (void) strcpy(&mntopts[len], newopts); } +static enum sa_protocol +sa_protocol_decode(const char *protocol) +{ + for (enum sa_protocol i = 0; i < ARRAY_SIZE(sa_protocol_names); ++i) + if (strcmp(protocol, sa_protocol_names[i]) == 0) + return (i); + + (void) fputs(gettext("share type must be one of: "), stderr); + for (enum sa_protocol i = 0; + i < ARRAY_SIZE(sa_protocol_names); ++i) + (void) fprintf(stderr, "%s%s", + i != 0 ? ", " : "", sa_protocol_names[i]); + (void) fputc('\n', stderr); + usage(B_FALSE); +} + static int share_mount(int op, int argc, char **argv) { @@ -7040,16 +7045,10 @@ share_mount(int op, int argc, char **argv) /* check number of arguments */ if (do_all) { - char *protocol = NULL; + enum sa_protocol protocol = SA_NO_PROTOCOL; if (op == OP_SHARE && argc > 0) { - if (strcmp(argv[0], "nfs") != 0 && - strcmp(argv[0], "smb") != 0) { - (void) fprintf(stderr, gettext("share type " - "must be 'nfs' or 'smb'\n")); - usage(B_FALSE); - } - protocol = argv[0]; + protocol = sa_protocol_decode(argv[0]); argc--; argv++; } @@ -7086,7 +7085,7 @@ share_mount(int op, int argc, char **argv) zfs_foreach_mountpoint(g_zfs, cb.cb_handles, cb.cb_used, share_mount_one_cb, &share_mount_state, op == OP_MOUNT && !(flags & MS_CRYPT)); - zfs_commit_all_shares(); + zfs_commit_shares(NULL); ret = share_mount_state.sm_status; @@ -7138,9 +7137,9 @@ share_mount(int op, int argc, char **argv) ZFS_TYPE_FILESYSTEM)) == NULL) { ret = 1; } else { - ret = share_mount_one(zhp, op, flags, NULL, B_TRUE, - options); - zfs_commit_all_shares(); + ret = share_mount_one(zhp, op, flags, SA_NO_PROTOCOL, + B_TRUE, options); + zfs_commit_shares(NULL); zfs_close(zhp); } } @@ -7150,7 +7149,7 @@ share_mount(int op, int argc, char **argv) } /* - * zfs mount -a [nfs] + * zfs mount -a * zfs mount filesystem * * Mount all filesystems, or mount the given filesystem. @@ -7259,12 +7258,12 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual) "'%s': legacy share\n"), path); (void) fprintf(stderr, gettext("use exportfs(8) " "or smbcontrol(1) to unshare this filesystem\n")); - } else if (!zfs_is_shared(zhp)) { + } else if (!zfs_is_shared(zhp, NULL, NULL)) { (void) fprintf(stderr, gettext("cannot unshare '%s': " "not currently shared\n"), path); } else { - ret = zfs_unshareall_bypath(zhp, path); - zfs_commit_all_shares(); + ret = zfs_unshare(zhp, path, NULL); + zfs_commit_shares(NULL); } } else { char mtpt_prop[ZFS_MAXPROPLEN]; @@ -7354,16 +7353,12 @@ unshare_unmount(int op, int argc, char **argv) unshare_unmount_node_t *node; uu_avl_index_t idx; uu_avl_walk_t *walk; - char *protocol = NULL; + enum sa_protocol *protocol = NULL, + single_protocol[] = {SA_NO_PROTOCOL, SA_NO_PROTOCOL}; if (op == OP_SHARE && argc > 0) { - if (strcmp(argv[0], "nfs") != 0 && - strcmp(argv[0], "smb") != 0) { - (void) fprintf(stderr, gettext("share type " - "must be 'nfs' or 'smb'\n")); - usage(B_FALSE); - } - protocol = argv[0]; + *single_protocol = sa_protocol_decode(argv[0]); + protocol = single_protocol; argc--; argv++; } @@ -7470,7 +7465,7 @@ unshare_unmount(int op, int argc, char **argv) uu_avl_remove(tree, node); switch (op) { case OP_SHARE: - if (zfs_unshareall_bytype(node->un_zhp, + if (zfs_unshare(node->un_zhp, node->un_mountp, protocol) != 0) ret = 1; break; @@ -7543,12 +7538,12 @@ unshare_unmount(int op, int argc, char **argv) "exports(5) or smb.conf(5) to unshare " "this filesystem\n")); ret = 1; - } else if (!zfs_is_shared(zhp)) { + } else if (!zfs_is_shared(zhp, NULL, NULL)) { (void) fprintf(stderr, gettext("cannot " "unshare '%s': not currently " "shared\n"), zfs_get_name(zhp)); ret = 1; - } else if (zfs_unshareall(zhp) != 0) { + } else if (zfs_unshareall(zhp, NULL) != 0) { ret = 1; } break; diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index aa61ff7c9424..bfe798ffe4cd 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -1790,8 +1790,8 @@ zpool_do_create(int argc, char **argv) tname ? tname : poolname, ZFS_TYPE_FILESYSTEM); if (pool != NULL) { if (zfs_mount(pool, NULL, 0) == 0) { - ret = zfs_shareall(pool); - zfs_commit_all_shares(); + ret = zfs_share(pool, NULL); + zfs_commit_shares(NULL); } zfs_close(pool); } diff --git a/include/libzfs.h b/include/libzfs.h index c0e53b88a636..04f464d12faf 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -35,6 +35,7 @@ #define _LIBZFS_H extern __attribute__((visibility("default"))) #include +#include #include #include #include @@ -878,37 +879,25 @@ _LIBZFS_H void zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint, /* * Share support functions. + * + * enum sa_protocol * lists are terminated with SA_NO_PROTOCOL, + * NULL means "all/any known to this libzfs". */ -_LIBZFS_H boolean_t zfs_is_shared(zfs_handle_t *); -_LIBZFS_H int zfs_share(zfs_handle_t *); -_LIBZFS_H int zfs_unshare(zfs_handle_t *); - -/* - * Protocol-specific share support functions. - */ -_LIBZFS_H boolean_t zfs_is_shared_nfs(zfs_handle_t *, char **); -_LIBZFS_H boolean_t zfs_is_shared_smb(zfs_handle_t *, char **); -_LIBZFS_H int zfs_share_nfs(zfs_handle_t *); -_LIBZFS_H int zfs_share_smb(zfs_handle_t *); -_LIBZFS_H int zfs_shareall(zfs_handle_t *); -_LIBZFS_H int zfs_unshare_nfs(zfs_handle_t *, const char *); -_LIBZFS_H int zfs_unshare_smb(zfs_handle_t *, const char *); -_LIBZFS_H int zfs_unshareall_nfs(zfs_handle_t *); -_LIBZFS_H int zfs_unshareall_smb(zfs_handle_t *); -_LIBZFS_H int zfs_unshareall_bypath(zfs_handle_t *, const char *); -_LIBZFS_H int zfs_unshareall_bytype(zfs_handle_t *, const char *, const char *); -_LIBZFS_H int zfs_unshareall(zfs_handle_t *); -_LIBZFS_H int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, char *, - void *, void *, int, zfs_share_op_t); -_LIBZFS_H void zfs_commit_nfs_shares(void); -_LIBZFS_H void zfs_commit_smb_shares(void); -_LIBZFS_H void zfs_commit_all_shares(void); -_LIBZFS_H void zfs_commit_shares(const char *); +#define SA_NO_PROTOCOL -1 + +_LIBZFS_H boolean_t zfs_is_shared(zfs_handle_t *zhp, char **where, + const enum sa_protocol *proto); +_LIBZFS_H int zfs_share(zfs_handle_t *zhp, const enum sa_protocol *proto); +_LIBZFS_H int zfs_unshare(zfs_handle_t *zhp, const char *mountpoint, + const enum sa_protocol *proto); +_LIBZFS_H int zfs_unshareall(zfs_handle_t *zhp, + const enum sa_protocol *proto); +_LIBZFS_H void zfs_commit_shares(const enum sa_protocol *proto); _LIBZFS_H int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *); /* - * Utility functions to run an _LIBZFS_Hal process. + * Utility functions to run an external process. */ #define STDOUT_VERBOSE 0x01 #define STDERR_VERBOSE 0x02 diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 298cfbd9fb56..40bd6a5574c8 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -288,10 +288,7 @@ - - - @@ -339,8 +336,6 @@ - - @@ -419,9 +414,6 @@ - - - @@ -440,13 +432,7 @@ - - - - - - @@ -596,6 +582,7 @@ + @@ -849,62 +836,108 @@ + + + + - + - + - + - + - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + - + - - + + - - + + - - + + - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4102,6 +4135,14 @@ + + + + + + + + @@ -4139,80 +4180,30 @@ - - - - + - - - - - - - - - - + + - - - - - - - - - - + - - - - - - - - - - - - - - + - - - - - - - - + - - - - - - - - - - - + diff --git a/lib/libzfs/libzfs_changelist.c b/lib/libzfs/libzfs_changelist.c index a70c7424b997..d31bbc4a3b42 100644 --- a/lib/libzfs/libzfs_changelist.c +++ b/lib/libzfs/libzfs_changelist.c @@ -98,6 +98,7 @@ changelist_prefix(prop_changelist_t *clp) prop_changenode_t *cn; uu_avl_walk_t *walk; int ret = 0; + const enum sa_protocol smb[] = {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; boolean_t commit_smb_shares = B_FALSE; if (clp->cl_prop != ZFS_PROP_MOUNTPOINT && @@ -137,7 +138,8 @@ changelist_prefix(prop_changelist_t *clp) } break; case ZFS_PROP_SHARESMB: - (void) zfs_unshare_smb(cn->cn_handle, NULL); + (void) zfs_unshare(cn->cn_handle, NULL, + smb); commit_smb_shares = B_TRUE; break; @@ -148,7 +150,7 @@ changelist_prefix(prop_changelist_t *clp) } if (commit_smb_shares) - zfs_commit_smb_shares(); + zfs_commit_shares(smb); uu_avl_walk_end(walk); if (ret == -1) @@ -257,25 +259,33 @@ changelist_postfix(prop_changelist_t *clp) * if the filesystem is currently shared, so that we can * adopt any new options. */ + const enum sa_protocol nfs[] = + {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; if (sharenfs && mounted) { - errors += zfs_share_nfs(cn->cn_handle); + errors += zfs_share(cn->cn_handle, nfs); commit_nfs_shares = B_TRUE; } else if (cn->cn_shared || clp->cl_waslegacy) { - errors += zfs_unshare_nfs(cn->cn_handle, NULL); + errors += zfs_unshare(cn->cn_handle, NULL, nfs); commit_nfs_shares = B_TRUE; } + const enum sa_protocol smb[] = + {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; if (sharesmb && mounted) { - errors += zfs_share_smb(cn->cn_handle); + errors += zfs_share(cn->cn_handle, smb); commit_smb_shares = B_TRUE; } else if (cn->cn_shared || clp->cl_waslegacy) { - errors += zfs_unshare_smb(cn->cn_handle, NULL); + errors += zfs_unshare(cn->cn_handle, NULL, smb); commit_smb_shares = B_TRUE; } } + + enum sa_protocol proto[SA_PROTOCOL_COUNT + 1], *p = proto; if (commit_nfs_shares) - zfs_commit_nfs_shares(); + *p++ = SA_PROTOCOL_NFS; if (commit_smb_shares) - zfs_commit_smb_shares(); + *p++ = SA_PROTOCOL_SMB; + *p++ = SA_NO_PROTOCOL; + zfs_commit_shares(proto); uu_avl_walk_end(walk); return (errors ? -1 : 0); @@ -359,7 +369,7 @@ changelist_unshare(prop_changelist_t *clp, const enum sa_protocol *proto) return (-1); while ((cn = uu_avl_walk_next(walk)) != NULL) { - if (zfs_unshare_proto(cn->cn_handle, NULL, proto) != 0) + if (zfs_unshare(cn->cn_handle, NULL, proto) != 0) ret = -1; } @@ -452,7 +462,7 @@ changelist_add_mounted(zfs_handle_t *zhp, void *data) cn->cn_handle = zhp; cn->cn_mounted = zfs_is_mounted(zhp, NULL); ASSERT3U(cn->cn_mounted, ==, B_TRUE); - cn->cn_shared = zfs_is_shared(zhp); + cn->cn_shared = zfs_is_shared(zhp, NULL, NULL); cn->cn_zoned = zfs_prop_get_int(zhp, ZFS_PROP_ZONED); cn->cn_needpost = B_TRUE; @@ -522,7 +532,7 @@ change_one(zfs_handle_t *zhp, void *data) cn->cn_handle = zhp; cn->cn_mounted = (clp->cl_gflags & CL_GATHER_MOUNT_ALWAYS) || zfs_is_mounted(zhp, NULL); - cn->cn_shared = zfs_is_shared(zhp); + cn->cn_shared = zfs_is_shared(zhp, NULL, NULL); cn->cn_zoned = zfs_prop_get_int(zhp, ZFS_PROP_ZONED); cn->cn_needpost = B_TRUE; @@ -738,7 +748,7 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int gather_flags, cn->cn_handle = temp; cn->cn_mounted = (clp->cl_gflags & CL_GATHER_MOUNT_ALWAYS) || zfs_is_mounted(temp, NULL); - cn->cn_shared = zfs_is_shared(temp); + cn->cn_shared = zfs_is_shared(temp, NULL, NULL); cn->cn_zoned = zfs_prop_get_int(zhp, ZFS_PROP_ZONED); cn->cn_needpost = B_TRUE; diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index e5c1bd62d5d1..50053e35f0d5 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -3556,14 +3556,14 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen) goto ancestorerr; } - if (zfs_share(h) != 0) { + if (zfs_share(h, NULL) != 0) { opname = dgettext(TEXT_DOMAIN, "share"); goto ancestorerr; } zfs_close(h); } - zfs_commit_all_shares(); + zfs_commit_shares(NULL); return (0); diff --git a/lib/libzfs/libzfs_impl.h b/lib/libzfs/libzfs_impl.h index bf1a8359cef2..926e14a3716c 100644 --- a/lib/libzfs/libzfs_impl.h +++ b/lib/libzfs/libzfs_impl.h @@ -105,15 +105,6 @@ struct zpool_handle { diskaddr_t zpool_start_block; }; -/* - * Bitmask of shared types: - * 0 means none, otherwise | (1 << (enum sa_protocol + 1)). - */ -typedef unsigned zfs_share_type_t; -#define SHARED_NOT_SHARED 0 - -#define SA_NO_PROTOCOL -1 - typedef int (*zfs_uri_handler_fn_t)(struct libzfs_handle *, const char *, const char *, zfs_keyformat_t, boolean_t, uint8_t **, size_t *); @@ -233,16 +224,6 @@ typedef struct differ_info { extern int do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags); extern int do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags); -extern int zfs_mount_delegation_check(void); -extern int zfs_share_proto(zfs_handle_t *zhp, const enum sa_protocol *proto); -extern int zfs_unshare_proto(zfs_handle_t *, const char *, - const enum sa_protocol *); -extern int unshare_one(libzfs_handle_t *hdl, const char *name, - const char *mountpoint, enum sa_protocol proto); -extern boolean_t zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen, - zprop_source_t *source, int flags); -extern zfs_share_type_t is_shared(const char *mountpoint, - enum sa_protocol proto); extern int libzfs_load_module(void); extern int zpool_relabel_disk(libzfs_handle_t *hdl, const char *path, const char *msg); diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index ea7e97c2932f..77837a3b0f36 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -41,23 +41,13 @@ * zfs_unmount() * zfs_unmountall() * - * This file also contains the functions used to manage sharing filesystems via - * NFS and iSCSI: + * This file also contains the functions used to manage sharing filesystems: * * zfs_is_shared() * zfs_share() * zfs_unshare() - * - * zfs_is_shared_nfs() - * zfs_is_shared_smb() - * zfs_share_proto() - * zfs_shareall(); - * zfs_unshare_nfs() - * zfs_unshare_smb() - * zfs_unshareall_nfs() - * zfs_unshareall_smb() * zfs_unshareall() - * zfs_unshareall_bypath() + * zfs_commit_shares() * * The following functions are available for pool consumers, and will * mount/unmount and share/unshare all datasets within pool: @@ -95,8 +85,6 @@ static int mount_tp_nthr = 512; /* tpool threads for multi-threaded mounting */ static void zfs_mount_task(void *); -static zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, char **, - enum sa_protocol); static const proto_table_t proto_table[SA_PROTOCOL_COUNT] = { [SA_PROTOCOL_NFS] = @@ -249,7 +237,7 @@ zfs_is_mountable_internal(zfs_handle_t *zhp) * Returns true if the given dataset is mountable, false otherwise. Returns the * mountpoint in 'buf'. */ -boolean_t +static boolean_t zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen, zprop_source_t *source, int flags) { @@ -623,16 +611,16 @@ zfs_unmount(zfs_handle_t *zhp, const char *mountpoint, int flags) /* * Unshare and unmount the filesystem */ - if (zfs_unshare_proto(zhp, mntpt, share_all_proto) != 0) { + if (zfs_unshare(zhp, mntpt, share_all_proto) != 0) { free(mntpt); return (-1); } - zfs_commit_all_shares(); + zfs_commit_shares(NULL); if (unmount_one(zhp, mntpt, flags) != 0) { free(mntpt); - (void) zfs_shareall(zhp); - zfs_commit_all_shares(); + (void) zfs_share(zhp, NULL); + zfs_commit_shares(NULL); return (-1); } @@ -691,23 +679,10 @@ zfs_unmountall(zfs_handle_t *zhp, int flags) return (ret); } -boolean_t -zfs_is_shared(zfs_handle_t *zhp) -{ - if (ZFS_IS_VOLUME(zhp)) - return (B_FALSE); - - for (enum sa_protocol i = 0; i < SA_PROTOCOL_COUNT; ++i) - if (zfs_is_shared_proto(zhp, NULL, i)) - return (B_TRUE); - - return (B_FALSE); -} - /* * Unshare a filesystem by mountpoint. */ -int +static int unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint, enum sa_protocol proto) { @@ -720,26 +695,13 @@ unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint, return (0); } -/* - * Query libshare for the given mountpoint and protocol, returning - * a zfs_share_type_t value. - */ -zfs_share_type_t -is_shared(const char *mountpoint, enum sa_protocol proto) -{ - if (sa_is_shared(mountpoint, proto)) - return (1 << (proto + 1)); - else - return (SHARED_NOT_SHARED); -} - /* * Share the given filesystem according to the options in the specified * protocol specific properties (sharenfs, sharesmb). We rely * on "libshare" to do the dirty work for us. */ int -zfs_share_proto(zfs_handle_t *zhp, const enum sa_protocol *proto) +zfs_share(zfs_handle_t *zhp, const enum sa_protocol *proto) { char mountpoint[ZFS_MAXPROPLEN]; char shareopts[ZFS_MAXPROPLEN]; @@ -748,6 +710,9 @@ zfs_share_proto(zfs_handle_t *zhp, const enum sa_protocol *proto) zprop_source_t sourcetype; int err = 0; + if (proto == NULL) + proto = share_all_proto; + if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL, 0)) return (0); @@ -783,138 +748,74 @@ zfs_share_proto(zfs_handle_t *zhp, const enum sa_protocol *proto) return (0); } -int -zfs_share(zfs_handle_t *zhp) -{ - assert(!ZFS_IS_VOLUME(zhp)); - return (zfs_share_proto(zhp, share_all_proto)); -} - -int -zfs_unshare(zfs_handle_t *zhp) -{ - assert(!ZFS_IS_VOLUME(zhp)); - return (zfs_unshareall(zhp)); -} - /* * Check to see if the filesystem is currently shared. */ -static zfs_share_type_t -zfs_is_shared_proto(zfs_handle_t *zhp, char **where, enum sa_protocol proto) -{ - char *mountpoint; - zfs_share_type_t rc; - - if (!zfs_is_mounted(zhp, &mountpoint)) - return (SHARED_NOT_SHARED); - - if ((rc = is_shared(mountpoint, proto)) - != SHARED_NOT_SHARED) { - if (where != NULL) - *where = mountpoint; - else - free(mountpoint); - return (rc); - } else { - free(mountpoint); - return (SHARED_NOT_SHARED); - } -} - boolean_t -zfs_is_shared_nfs(zfs_handle_t *zhp, char **where) +zfs_is_shared(zfs_handle_t *zhp, char **where, + const enum sa_protocol *proto) { - return (zfs_is_shared_proto(zhp, where, - SA_PROTOCOL_NFS) != SHARED_NOT_SHARED); -} + char *mountpoint; + if (proto == NULL) + proto = share_all_proto; -boolean_t -zfs_is_shared_smb(zfs_handle_t *zhp, char **where) -{ - return (zfs_is_shared_proto(zhp, where, - SA_PROTOCOL_SMB) != SHARED_NOT_SHARED); -} + if (ZFS_IS_VOLUME(zhp)) + return (B_FALSE); -void -zfs_commit_nfs_shares(void) -{ - sa_commit_shares(SA_PROTOCOL_NFS); -} + if (!zfs_is_mounted(zhp, &mountpoint)) + return (B_FALSE); -void -zfs_commit_smb_shares(void) -{ - sa_commit_shares(SA_PROTOCOL_SMB); -} + for (const enum sa_protocol *p = proto; *p != SA_NO_PROTOCOL; ++p) + if (sa_is_shared(mountpoint, *p)) { + if (where != NULL) + *where = mountpoint; + else + free(mountpoint); + return (B_TRUE); + } -void -zfs_commit_all_shares(void) -{ - for (enum sa_protocol i = 0; i < SA_PROTOCOL_COUNT; ++i) - sa_commit_shares(i); + free(mountpoint); + return (B_FALSE); } void -zfs_commit_shares(const char *proto) +zfs_commit_shares(const enum sa_protocol *proto) { if (proto == NULL) - zfs_commit_all_shares(); - else - for (enum sa_protocol i = 0; i < ARRAY_SIZE(sa_protocol_names); - ++i) - if (strcmp(proto, sa_protocol_names[i]) == 0) { - sa_commit_shares(i); - return; - } -} + proto = share_all_proto; -int -zfs_share_nfs(zfs_handle_t *zhp) -{ - const enum sa_protocol nfs_only[] = {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; - return (zfs_share_proto(zhp, nfs_only)); -} - -int -zfs_share_smb(zfs_handle_t *zhp) -{ - const enum sa_protocol smb_only[] = {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; - return (zfs_share_proto(zhp, smb_only)); -} - -int -zfs_shareall(zfs_handle_t *zhp) -{ - return (zfs_share_proto(zhp, share_all_proto)); + for (const enum sa_protocol *p = proto; *p != SA_NO_PROTOCOL; ++p) + sa_commit_shares(*p); } /* * Unshare the given filesystem. */ int -zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint, +zfs_unshare(zfs_handle_t *zhp, const char *mountpoint, const enum sa_protocol *proto) { libzfs_handle_t *hdl = zhp->zfs_hdl; struct mnttab entry; char *mntpt = NULL; + if (proto == NULL) + proto = share_all_proto; + /* check to see if need to unmount the filesystem */ if (mountpoint != NULL) mntpt = zfs_strdup(hdl, mountpoint); if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) && libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) { - const enum sa_protocol *curr_proto; if (mountpoint == NULL) mntpt = zfs_strdup(zhp->zfs_hdl, entry.mnt_mountp); - for (curr_proto = proto; *curr_proto != SA_NO_PROTOCOL; - curr_proto++) { + for (const enum sa_protocol *curr_proto = proto; + *curr_proto != SA_NO_PROTOCOL; curr_proto++) { - if (is_shared(mntpt, *curr_proto)) { + if (sa_is_shared(mntpt, *curr_proto)) { if (unshare_one(hdl, zhp->zfs_name, mntpt, *curr_proto) != 0) { if (mntpt != NULL) @@ -930,29 +831,18 @@ zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint, return (0); } -int -zfs_unshare_nfs(zfs_handle_t *zhp, const char *mountpoint) -{ - const enum sa_protocol nfs_only[] = {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; - return (zfs_unshare_proto(zhp, mountpoint, nfs_only)); -} - -int -zfs_unshare_smb(zfs_handle_t *zhp, const char *mountpoint) -{ - const enum sa_protocol smb_only[] = {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; - return (zfs_unshare_proto(zhp, mountpoint, smb_only)); -} - /* * Same as zfs_unmountall(), but for NFS and SMB unshares. */ -static int -zfs_unshareall_proto(zfs_handle_t *zhp, const enum sa_protocol *proto) +int +zfs_unshareall(zfs_handle_t *zhp, const enum sa_protocol *proto) { prop_changelist_t *clp; int ret; + if (proto == NULL) + proto = share_all_proto; + clp = changelist_gather(zhp, ZFS_PROP_SHARENFS, 0, 0); if (clp == NULL) return (-1); @@ -963,48 +853,6 @@ zfs_unshareall_proto(zfs_handle_t *zhp, const enum sa_protocol *proto) return (ret); } -int -zfs_unshareall_nfs(zfs_handle_t *zhp) -{ - const enum sa_protocol nfs_only[] = {SA_PROTOCOL_NFS, SA_NO_PROTOCOL}; - return (zfs_unshareall_proto(zhp, nfs_only)); -} - -int -zfs_unshareall_smb(zfs_handle_t *zhp) -{ - const enum sa_protocol smb_only[] = {SA_PROTOCOL_SMB, SA_NO_PROTOCOL}; - return (zfs_unshareall_proto(zhp, smb_only)); -} - -int -zfs_unshareall(zfs_handle_t *zhp) -{ - return (zfs_unshareall_proto(zhp, share_all_proto)); -} - -int -zfs_unshareall_bypath(zfs_handle_t *zhp, const char *mountpoint) -{ - return (zfs_unshare_proto(zhp, mountpoint, share_all_proto)); -} - -int -zfs_unshareall_bytype(zfs_handle_t *zhp, const char *mountpoint, - const char *proto) -{ - if (proto == NULL) - return (zfs_unshare_proto(zhp, mountpoint, share_all_proto)); - - for (enum sa_protocol i = 0; i < ARRAY_SIZE(sa_protocol_names); ++i) - if (strcmp(proto, sa_protocol_names[i]) == 0) { - enum sa_protocol protocols[] = {i, SA_NO_PROTOCOL}; - return (zfs_unshare_proto(zhp, mountpoint, protocols)); - } - - return (1); -} - /* * Remove the mountpoint associated with the current dataset, if necessary. * We only remove the underlying directory if: @@ -1295,7 +1143,7 @@ zfs_share_one(zfs_handle_t *zhp, void *arg) mount_state_t *ms = arg; int ret = 0; - if (zfs_share(zhp) != 0) + if (zfs_share(zhp, NULL) != 0) ret = ms->ms_mntstatus = -1; return (ret); } @@ -1468,7 +1316,7 @@ zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags) if (ms.ms_mntstatus != 0) ret = ms.ms_mntstatus; else - zfs_commit_all_shares(); + zfs_commit_shares(NULL); out: for (int i = 0; i < cb.cb_used; i++) @@ -1578,13 +1426,13 @@ zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force) */ for (i = 0; i < used; i++) { for (enum sa_protocol i = 0; i < SA_PROTOCOL_COUNT; ++i) { - if (is_shared(sets[i].mountpoint, i) && + if (sa_is_shared(sets[i].mountpoint, i) && unshare_one(hdl, sets[i].mountpoint, sets[i].mountpoint, i) != 0) goto out; } } - zfs_commit_all_shares(); + zfs_commit_shares(NULL); /* * Now unmount everything, removing the underlying directories as From 5b14feec0646ae3a09e1713388bb7b3ef745a421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 16:55:16 +0100 Subject: [PATCH 051/119] libzfs: mount: zfs_unshare: don't reallocate mountpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libzfs/libzfs_mount.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 77837a3b0f36..d007441f8a8a 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -797,36 +797,28 @@ zfs_unshare(zfs_handle_t *zhp, const char *mountpoint, { libzfs_handle_t *hdl = zhp->zfs_hdl; struct mnttab entry; - char *mntpt = NULL; + const char *mntpt = NULL; if (proto == NULL) proto = share_all_proto; /* check to see if need to unmount the filesystem */ if (mountpoint != NULL) - mntpt = zfs_strdup(hdl, mountpoint); + mntpt = mountpoint; if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) && libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) { if (mountpoint == NULL) - mntpt = zfs_strdup(zhp->zfs_hdl, entry.mnt_mountp); + mntpt = entry.mnt_mountp; for (const enum sa_protocol *curr_proto = proto; - *curr_proto != SA_NO_PROTOCOL; curr_proto++) { - - if (sa_is_shared(mntpt, *curr_proto)) { - if (unshare_one(hdl, zhp->zfs_name, - mntpt, *curr_proto) != 0) { - if (mntpt != NULL) - free(mntpt); + *curr_proto != SA_NO_PROTOCOL; curr_proto++) + if (sa_is_shared(mntpt, *curr_proto) && + unshare_one(hdl, zhp->zfs_name, + mntpt, *curr_proto) != 0) return (-1); - } - } - } } - if (mntpt != NULL) - free(mntpt); return (0); } From a31fcd4bad22d20a22cdd8e9f7e388a99508a8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 17:44:06 +0100 Subject: [PATCH 052/119] linux: libshare/nfs: bsearch() over valid keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/os/linux/nfs.c | 48 ++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index 09c7395c660c..b93d73ecfe28 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -294,6 +294,11 @@ add_linux_shareopt(char **plinux_opts, const char *key, const char *value) return (SA_OK); } +static int string_cmp(const void *lhs, const void *rhs) { + const char *const *l = lhs, *const *r = rhs; + return (strcmp(*l, *r)); +} + /* * Validates and converts a single Solaris share option to its Linux * equivalent. @@ -301,6 +306,15 @@ add_linux_shareopt(char **plinux_opts, const char *key, const char *value) static int get_linux_shareopts_cb(const char *key, const char *value, void *cookie) { + /* This list must remain sorted, since we bsearch() it */ + static const char *const valid_keys[] = { "all_squash", "anongid", + "anonuid", "async", "auth_nlm", "crossmnt", "fsid", "fsuid", "hide", + "insecure", "insecure_locks", "mountpoint", "mp", "no_acl", + "no_all_squash", "no_auth_nlm", "no_root_squash", + "no_subtree_check", "no_wdelay", "nohide", "refer", "replicas", + "root_squash", "secure", "secure_locks", "subtree_check", "sync", + "wdelay" }; + char **plinux_opts = (char **)cookie; /* host-specific options, these are taken care of elsewhere */ @@ -319,26 +333,9 @@ get_linux_shareopts_cb(const char *key, const char *value, void *cookie) if (strcmp(key, "nosub") == 0) key = "subtree_check"; - if (strcmp(key, "insecure") != 0 && strcmp(key, "secure") != 0 && - strcmp(key, "async") != 0 && strcmp(key, "sync") != 0 && - strcmp(key, "no_wdelay") != 0 && strcmp(key, "wdelay") != 0 && - strcmp(key, "nohide") != 0 && strcmp(key, "hide") != 0 && - strcmp(key, "crossmnt") != 0 && - strcmp(key, "no_subtree_check") != 0 && - strcmp(key, "subtree_check") != 0 && - strcmp(key, "insecure_locks") != 0 && - strcmp(key, "secure_locks") != 0 && - strcmp(key, "no_auth_nlm") != 0 && strcmp(key, "auth_nlm") != 0 && - strcmp(key, "no_acl") != 0 && strcmp(key, "mountpoint") != 0 && - strcmp(key, "mp") != 0 && strcmp(key, "fsuid") != 0 && - strcmp(key, "refer") != 0 && strcmp(key, "replicas") != 0 && - strcmp(key, "root_squash") != 0 && - strcmp(key, "no_root_squash") != 0 && - strcmp(key, "all_squash") != 0 && - strcmp(key, "no_all_squash") != 0 && strcmp(key, "fsid") != 0 && - strcmp(key, "anonuid") != 0 && strcmp(key, "anongid") != 0) { + if (bsearch(&key, valid_keys, ARRAY_SIZE(valid_keys), + sizeof (*valid_keys), string_cmp) == NULL) return (SA_SYNTAX_ERR); - } (void) add_linux_shareopt(plinux_opts, key, value); @@ -406,10 +403,8 @@ nfs_add_entry(FILE *tmpfile, const char *sharepath, static int nfs_enable_share_impl(sa_share_impl_t impl_share, FILE *tmpfile) { - char *linux_opts; - int error; - - error = get_linux_shareopts(impl_share->sa_shareopts, &linux_opts); + char *linux_opts = NULL; + int error = get_linux_shareopts(impl_share->sa_shareopts, &linux_opts); if (error != SA_OK) return (error); @@ -457,11 +452,8 @@ nfs_is_shared(sa_share_impl_t impl_share) static int nfs_validate_shareopts(const char *shareopts) { - char *linux_opts; - int error; - - error = get_linux_shareopts(shareopts, &linux_opts); - + char *linux_opts = NULL; + int error = get_linux_shareopts(shareopts, &linux_opts); if (error != SA_OK) return (error); From 9b06aa634a80d6820ffb1453ccb3e4572be303d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 28 Feb 2022 20:42:22 +0100 Subject: [PATCH 053/119] libshare/nfs: escape mount points when needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 Closes #13153 --- lib/libshare/nfs.c | 43 +++++++++++++++++++++++++++++++++-- lib/libshare/nfs.h | 1 + lib/libshare/os/freebsd/nfs.c | 15 +++++++++--- lib/libshare/os/linux/nfs.c | 13 ++++++++--- 4 files changed, 64 insertions(+), 8 deletions(-) diff --git a/lib/libshare/nfs.c b/lib/libshare/nfs.c index 4a90bcbd3863..2146346cf08c 100644 --- a/lib/libshare/nfs.c +++ b/lib/libshare/nfs.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -143,6 +144,34 @@ nfs_fini_tmpfile(const char *exports, struct tmpfile *tmpf) return (SA_OK); } +int +nfs_escape_mountpoint(const char *mp, char **out, boolean_t *need_free) +{ + if (strpbrk(mp, "\t\n\v\f\r \\") == NULL) { + *out = (char *)mp; + *need_free = B_FALSE; + return (SA_OK); + } else { + size_t len = strlen(mp); + *out = malloc(len * 4 + 1); + if (!*out) + return (SA_NO_MEMORY); + *need_free = B_TRUE; + + char *oc = *out; + for (const char *c = mp; c < mp + len; ++c) + if (memchr("\t\n\v\f\r \\", *c, + strlen("\t\n\v\f\r \\"))) { + sprintf(oc, "\\%03hho", *c); + oc += 4; + } else + *oc++ = *c; + *oc = '\0'; + } + + return (SA_OK); +} + static int nfs_process_exports(const char *exports, const char *mountpoint, boolean_t (*cbk)(void *userdata, char *line, boolean_t found_mountpoint), @@ -153,8 +182,16 @@ nfs_process_exports(const char *exports, const char *mountpoint, FILE *oldfp = fopen(exports, "re"); if (oldfp != NULL) { + boolean_t need_mp_free; + char *mp; + if ((error = nfs_escape_mountpoint(mountpoint, + &mp, &need_mp_free)) != SA_OK) { + (void) fclose(oldfp); + return (error); + } + char *buf = NULL, *sep; - size_t buflen = 0, mplen = strlen(mountpoint); + size_t buflen = 0, mplen = strlen(mp); while (cont && getline(&buf, &buflen, oldfp) != -1) { if (buf[0] == '\n' || buf[0] == '#') @@ -163,9 +200,11 @@ nfs_process_exports(const char *exports, const char *mountpoint, cont = cbk(userdata, buf, (sep = strpbrk(buf, "\t \n")) != NULL && sep - buf == mplen && - strncmp(buf, mountpoint, mplen) == 0); + strncmp(buf, mp, mplen) == 0); } free(buf); + if (need_mp_free) + free(mp); if (ferror(oldfp) != 0) error = ferror(oldfp); diff --git a/lib/libshare/nfs.h b/lib/libshare/nfs.h index 777581625924..24ae1f8adb85 100644 --- a/lib/libshare/nfs.h +++ b/lib/libshare/nfs.h @@ -28,6 +28,7 @@ #define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n" +int nfs_escape_mountpoint(const char *mp, char **out, boolean_t *need_free); boolean_t nfs_is_shared_impl(const char *exports, sa_share_impl_t impl_share); int nfs_toggle_share(const char *lockfile, const char *exports, const char *expdir, sa_share_impl_t impl_share, diff --git a/lib/libshare/os/freebsd/nfs.c b/lib/libshare/os/freebsd/nfs.c index 338d25fcd0f8..78977a25f4f5 100644 --- a/lib/libshare/os/freebsd/nfs.c +++ b/lib/libshare/os/freebsd/nfs.c @@ -109,15 +109,24 @@ nfs_enable_share_impl(sa_share_impl_t impl_share, FILE *tmpfile) if (strcmp(shareopts, "on") == 0) shareopts = ""; - if (fputs(impl_share->sa_mountpoint, tmpfile) == EOF || + boolean_t need_free; + char *mp; + int rc = nfs_escape_mountpoint(impl_share->sa_mountpoint, &mp, + &need_free); + if (rc != SA_OK) + return (rc); + + if (fputs(mp, tmpfile) == EOF || fputc('\t', tmpfile) == EOF || translate_opts(shareopts, tmpfile) == EOF || fputc('\n', tmpfile) == EOF) { fprintf(stderr, "failed to write to temporary file\n"); - return (SA_SYSTEM_ERR); + rc = SA_SYSTEM_ERR; } - return (SA_OK); + if (need_free) + free(mp); + return (rc); } static int diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index b93d73ecfe28..a7b40ea77be3 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -387,14 +387,21 @@ nfs_add_entry(FILE *tmpfile, const char *sharepath, if (linux_opts == NULL) linux_opts = ""; - if (fprintf(tmpfile, "%s %s(sec=%s,%s,%s)\n", sharepath, + boolean_t need_free; + char *mp; + int rc = nfs_escape_mountpoint(sharepath, &mp, &need_free); + if (rc != SA_OK) + return (rc); + if (fprintf(tmpfile, "%s %s(sec=%s,%s,%s)\n", mp, get_linux_hostspec(host), security, access_opts, linux_opts) < 0) { fprintf(stderr, "failed to write to temporary file\n"); - return (SA_SYSTEM_ERR); + rc = SA_SYSTEM_ERR; } - return (SA_OK); + if (need_free) + free(mp); + return (rc); } /* From 88d5580e511540b996dfb802a7ee4912980fe1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 6 Mar 2022 01:39:54 +0100 Subject: [PATCH 054/119] tests: add zfs_unshare_008_pos checking whitespace escaping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- tests/runfiles/common.run | 2 +- tests/test-runner/bin/zts-report.py.in | 1 + tests/zfs-tests/include/libtest.shlib | 12 ++++ tests/zfs-tests/tests/Makefile.am | 1 + .../zfs_unshare/zfs_unshare_008_pos.ksh | 58 +++++++++++++++++++ 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100755 tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index 59584fd67d51..4ff46e7af35f 100644 --- a/tests/runfiles/common.run +++ b/tests/runfiles/common.run @@ -309,7 +309,7 @@ tags = ['functional', 'cli_root', 'zfs_unmount'] [tests/functional/cli_root/zfs_unshare] tests = ['zfs_unshare_001_pos', 'zfs_unshare_002_pos', 'zfs_unshare_003_pos', 'zfs_unshare_004_neg', 'zfs_unshare_005_neg', 'zfs_unshare_006_pos', - 'zfs_unshare_007_pos'] + 'zfs_unshare_007_pos', 'zfs_unshare_008_pos'] tags = ['functional', 'cli_root', 'zfs_unshare'] [tests/functional/cli_root/zfs_upgrade] diff --git a/tests/test-runner/bin/zts-report.py.in b/tests/test-runner/bin/zts-report.py.in index 15660d5cb027..ddb9bb7eed1d 100755 --- a/tests/test-runner/bin/zts-report.py.in +++ b/tests/test-runner/bin/zts-report.py.in @@ -165,6 +165,7 @@ if sys.platform.startswith('freebsd'): 'cli_root/zpool_wait/zpool_wait_trim_basic': ['SKIP', trim_reason], 'cli_root/zpool_wait/zpool_wait_trim_cancel': ['SKIP', trim_reason], 'cli_root/zpool_wait/zpool_wait_trim_flag': ['SKIP', trim_reason], + 'cli_root/zfs_unshare/zfs_unshare_008_pos': ['SKIP', na_reason], 'link_count/link_count_001': ['SKIP', na_reason], 'casenorm/mixed_create_failure': ['FAIL', 13215], 'mmap/mmap_sync_001_pos': ['SKIP', na_reason], diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 175adfc62e4a..51d4e225f10f 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -1110,6 +1110,18 @@ function datasetnonexists return 0 } +# FreeBSD breaks exports(5) at whitespace and doesn't process escapes +# Solaris just breaks +# +# cf. https://github.com/openzfs/zfs/pull/13165#issuecomment-1059845807 +# +# Linux can have spaces (which are \OOO-escaped), +# but can't have backslashes because they're parsed recursively +function shares_can_have_whitespace +{ + is_linux +} + function is_shared_freebsd { typeset fs=$1 diff --git a/tests/zfs-tests/tests/Makefile.am b/tests/zfs-tests/tests/Makefile.am index 2202d9026787..4bc05c92f592 100644 --- a/tests/zfs-tests/tests/Makefile.am +++ b/tests/zfs-tests/tests/Makefile.am @@ -878,6 +878,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \ functional/cli_root/zfs_unshare/zfs_unshare_005_neg.ksh \ functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh \ functional/cli_root/zfs_unshare/zfs_unshare_007_pos.ksh \ + functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh \ functional/cli_root/zfs_upgrade/cleanup.ksh \ functional/cli_root/zfs_upgrade/setup.ksh \ functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh \ diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh new file mode 100755 index 000000000000..21d5ac79bbdc --- /dev/null +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh @@ -0,0 +1,58 @@ +#!/bin/ksh -p +# +# 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 +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# Verify that datasets mounted at directories with whitespace are properly escaped +# both going in (for mountd consumption) and going out (for removing from export list) +# +# STRATEGY: +# 1. Create and share a dataset with spaces, tabs, and newlines +# 2. Verify it's shared +# 3. Unshare it +# 4. Verify it's not shared +# + +shares_can_have_whitespace || log_unsupported "Platform doesn't permit whitespace in NFS shares" +basename='a + b + c d' +escname='a\040+\040b\012\040c\011d' + +verify_runnable "global" + +function cleanup +{ + datasetexists "$TESTPOOL/$TESTFS/shared1" && \ + destroy_dataset "$TESTPOOL/$TESTFS/shared1" -f +} + +log_assert "Datasets with spaces are properly shared and unshared." +log_onexit cleanup + +log_must zfs create -o sharenfs=on -o mountpoint="$TESTDIR/$basename" "$TESTPOOL/$TESTFS/shared1" +log_must is_shared "$TESTDIR/$escname" +log_must zfs unshare "$TESTPOOL/$TESTFS/shared1" +log_mustnot is_shared "$TESTDIR/$escname" + +log_pass "Datasets with spaces are properly shared and unshared." From 1ec9218faa2f0d11b66ec1eb9d202692b1eec2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 18 Mar 2022 18:40:13 +0100 Subject: [PATCH 055/119] libzfs: zfs_unshare: minor cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libzfs/libzfs_mount.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index d007441f8a8a..a2f1c982c9f4 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -797,20 +797,15 @@ zfs_unshare(zfs_handle_t *zhp, const char *mountpoint, { libzfs_handle_t *hdl = zhp->zfs_hdl; struct mnttab entry; - const char *mntpt = NULL; if (proto == NULL) proto = share_all_proto; - /* check to see if need to unmount the filesystem */ - if (mountpoint != NULL) - mntpt = mountpoint; - if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) && libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) { - if (mountpoint == NULL) - mntpt = entry.mnt_mountp; + /* check to see if need to unmount the filesystem */ + const char *mntpt = mountpoint ?: entry.mnt_mountp; for (const enum sa_protocol *curr_proto = proto; *curr_proto != SA_NO_PROTOCOL; curr_proto++) From 086af23e683c62d24055b46a6b93de78825a5219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 17 Apr 2022 15:00:15 +0200 Subject: [PATCH 056/119] linux: libshare/smb: cache smb_available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 --- lib/libshare/os/linux/smb.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/libshare/os/linux/smb.c b/lib/libshare/os/linux/smb.c index 1f32d0e1096a..2a2b32bc10e9 100644 --- a/lib/libshare/os/linux/smb.c +++ b/lib/libshare/os/linux/smb.c @@ -378,14 +378,18 @@ const sa_fstype_t libshare_smb_type = { static boolean_t smb_available(void) { - struct stat statbuf; + static int avail; - if (lstat(SHARE_DIR, &statbuf) != 0 || - !S_ISDIR(statbuf.st_mode)) - return (B_FALSE); + if (!avail) { + struct stat statbuf; - if (access(NET_CMD_PATH, F_OK) != 0) - return (B_FALSE); + if (access(NET_CMD_PATH, F_OK) != 0 || + lstat(SHARE_DIR, &statbuf) != 0 || + !S_ISDIR(statbuf.st_mode)) + avail = -1; + else + avail = 1; + } - return (B_TRUE); + return (avail == 1); } From 53600767ee8c9e3c25fff3fbb61de89a2952a4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 17 Apr 2022 15:03:03 +0200 Subject: [PATCH 057/119] linux: libshare/nfs: don't do anything unless exportfs is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13165 Closes #13324 --- lib/libshare/os/linux/nfs.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index a7b40ea77be3..1da6d1617247 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -45,6 +45,9 @@ #define ZFS_EXPORTS_FILE ZFS_EXPORTS_DIR"/zfs.exports" #define ZFS_EXPORTS_LOCK ZFS_EXPORTS_FILE".lock" + +static boolean_t nfs_available(void); + typedef int (*nfs_shareopt_callback_t)(const char *opt, const char *value, void *cookie); @@ -424,6 +427,9 @@ nfs_enable_share_impl(sa_share_impl_t impl_share, FILE *tmpfile) static int nfs_enable_share(sa_share_impl_t impl_share) { + if (!nfs_available()) + return (SA_SYSTEM_ERR); + return (nfs_toggle_share( ZFS_EXPORTS_LOCK, ZFS_EXPORTS_FILE, ZFS_EXPORTS_DIR, impl_share, nfs_enable_share_impl)); @@ -442,6 +448,9 @@ nfs_disable_share_impl(sa_share_impl_t impl_share, FILE *tmpfile) static int nfs_disable_share(sa_share_impl_t impl_share) { + if (!nfs_available()) + return (SA_SYSTEM_ERR); + return (nfs_toggle_share( ZFS_EXPORTS_LOCK, ZFS_EXPORTS_FILE, ZFS_EXPORTS_DIR, impl_share, nfs_disable_share_impl)); @@ -450,6 +459,9 @@ nfs_disable_share(sa_share_impl_t impl_share) static boolean_t nfs_is_shared(sa_share_impl_t impl_share) { + if (!nfs_available()) + return (SA_SYSTEM_ERR); + return (nfs_is_shared_impl(ZFS_EXPORTS_FILE, impl_share)); } @@ -471,6 +483,9 @@ nfs_validate_shareopts(const char *shareopts) static int nfs_commit_shares(void) { + if (!nfs_available()) + return (SA_SYSTEM_ERR); + char *argv[] = { (char *)"/usr/sbin/exportfs", (char *)"-ra", @@ -488,3 +503,18 @@ const sa_fstype_t libshare_nfs_type = { .validate_shareopts = nfs_validate_shareopts, .commit_shares = nfs_commit_shares, }; + +static boolean_t +nfs_available(void) +{ + static int avail; + + if (!avail) { + if (access("/usr/sbin/exportfs", F_OK) != 0) + avail = -1; + else + avail = 1; + } + + return (avail == 1); +} From 0c11a2738d3778a359de708911643a6b2cc15fa6 Mon Sep 17 00:00:00 2001 From: Mateusz Piotrowski Date: Thu, 12 May 2022 18:34:24 +0200 Subject: [PATCH 058/119] Fix typos in zfs-bookmark examples Reviewed-by: George Melikov Reviewed-by: Brian Behlendorf Signed-off-by: Mateusz Piotrowski <0mp@FreeBSD.org> Closes #13456 --- man/man8/zfs-bookmark.8 | 6 +++--- man/man8/zfs.8 | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/man/man8/zfs-bookmark.8 b/man/man8/zfs-bookmark.8 index 88153b2ccfb5..8b268b714385 100644 --- a/man/man8/zfs-bookmark.8 +++ b/man/man8/zfs-bookmark.8 @@ -30,7 +30,7 @@ .\" Copyright 2019 Joyent, Inc. .\" Copyright (c) 2019, 2020 by Christian Schwarz. All Rights Reserved. .\" -.Dd March 16, 2022 +.Dd May 12, 2022 .Dt ZFS-BOOKMARK 8 .Os . @@ -65,8 +65,8 @@ feature. .\" These are, respectively, examples 23 from zfs.8 .\" Make sure to update them bidirectionally .Ss Example 1 : No Creating a bookmark -The following example create a bookmark to a snapshot. -This bookmark can then be used instead of snapshot in send streams. +The following example creates a bookmark to a snapshot. +This bookmark can then be used instead of a snapshot in send streams. .Dl # Nm zfs Cm bookmark Ar rpool Ns @ Ns Ar snapshot rpool Ns # Ns Ar bookmark . .Sh SEE ALSO diff --git a/man/man8/zfs.8 b/man/man8/zfs.8 index bf8e86a5b2d6..cac4327e0721 100644 --- a/man/man8/zfs.8 +++ b/man/man8/zfs.8 @@ -36,7 +36,7 @@ .\" Copyright 2018 Nexenta Systems, Inc. .\" Copyright 2019 Joyent, Inc. .\" -.Dd March 16, 2022 +.Dd May 12, 2022 .Dt ZFS 8 .Os . @@ -703,8 +703,8 @@ M F /tank/test/modified .Ed . .Ss Example 23 : No Creating a bookmark -The following example create a bookmark to a snapshot. -This bookmark can then be used instead of snapshot in send streams. +The following example creates a bookmark to a snapshot. +This bookmark can then be used instead of a snapshot in send streams. .Dl # Nm zfs Cm bookmark Ar rpool Ns @ Ns Ar snapshot rpool Ns # Ns Ar bookmark . .Ss Example 24 : No Setting Sy sharesmb No Property Options on a ZFS File System From c25b281378e504d69ad0f2212f233f0c6b016b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 7 May 2022 19:18:41 +0200 Subject: [PATCH 059/119] Remove hw_serial, ddi_strtoul() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13434 --- include/os/freebsd/spl/sys/misc.h | 2 -- include/os/freebsd/spl/sys/sunddi.h | 1 - include/os/linux/spl/sys/sunddi.h | 1 - include/sys/zfs_context.h | 4 ---- lib/libzpool/kernel.c | 19 +++---------------- module/os/freebsd/spl/spl_misc.c | 4 ---- module/os/freebsd/spl/spl_sunddi.c | 13 ------------- module/os/linux/spl/spl-generic.c | 12 ++++++------ 8 files changed, 9 insertions(+), 47 deletions(-) diff --git a/include/os/freebsd/spl/sys/misc.h b/include/os/freebsd/spl/sys/misc.h index 3481507d2c33..2e4efc60544a 100644 --- a/include/os/freebsd/spl/sys/misc.h +++ b/include/os/freebsd/spl/sys/misc.h @@ -52,8 +52,6 @@ struct opensolaris_utsname { char *machine; }; -extern char hw_serial[11]; - #define task_io_account_read(n) #define task_io_account_write(n) diff --git a/include/os/freebsd/spl/sys/sunddi.h b/include/os/freebsd/spl/sys/sunddi.h index bfbc3e10a1d2..28d40121d92e 100644 --- a/include/os/freebsd/spl/sys/sunddi.h +++ b/include/os/freebsd/spl/sys/sunddi.h @@ -48,7 +48,6 @@ typedef int ddi_devid_t; #define ddi_prop_free(x) (void)0 #define ddi_root_node() (void)0 -extern int ddi_strtoul(const char *, char **, int, unsigned long *); extern int ddi_strtol(const char *, char **, int, long *); extern int ddi_strtoull(const char *, char **, int, unsigned long long *); extern int ddi_strtoll(const char *, char **, int, long long *); diff --git a/include/os/linux/spl/sys/sunddi.h b/include/os/linux/spl/sys/sunddi.h index 8524ec9c300e..df6a204d5cf9 100644 --- a/include/os/linux/spl/sys/sunddi.h +++ b/include/os/linux/spl/sys/sunddi.h @@ -46,7 +46,6 @@ typedef int ddi_devid_t; #define ddi_prop_free(x) (void)0 #define ddi_root_node() (void)0 -extern int ddi_strtoul(const char *, char **, int, unsigned long *); extern int ddi_strtol(const char *, char **, int, long *); extern int ddi_strtoull(const char *, char **, int, unsigned long long *); extern int ddi_strtoll(const char *, char **, int, long long *); diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 944acdcfbe56..50257f1d6fdd 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -692,10 +692,6 @@ extern char *kmem_asprintf(const char *fmt, ...); /* * Hostname information */ -extern char hw_serial[]; /* for userland-emulated hostid access */ -extern int ddi_strtoul(const char *str, char **nptr, int base, - unsigned long *result); - extern int ddi_strtoull(const char *str, char **nptr, int base, u_longlong_t *result); diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index 89151f70ecb1..011f9d2110ce 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -53,7 +53,7 @@ */ uint64_t physmem; -char hw_serial[HW_HOSTID_LEN]; +uint32_t hostid; struct utsname hw_utsname; /* If set, all blocks read will be copied to the specified directory. */ @@ -299,7 +299,7 @@ zone_get_hostid(void *zonep) * We're emulating the system's hostid in userland. */ (void) zonep; - return (strtoul(hw_serial, NULL, 10)); + return (hostid); } int @@ -766,18 +766,6 @@ random_get_pseudo_bytes(uint8_t *ptr, size_t len) return (random_get_bytes_common(ptr, len, urandom_fd)); } -int -ddi_strtoul(const char *hw_serial, char **nptr, int base, unsigned long *result) -{ - (void) nptr; - char *end; - - *result = strtoul(hw_serial, &end, base); - if (*result == 0) - return (errno); - return (0); -} - int ddi_strtoull(const char *str, char **nptr, int base, u_longlong_t *result) { @@ -823,8 +811,7 @@ kernel_init(int mode) dprintf("physmem = %llu pages (%.2f GB)\n", (u_longlong_t)physmem, (double)physmem * sysconf(_SC_PAGE_SIZE) / (1ULL << 30)); - (void) snprintf(hw_serial, sizeof (hw_serial), "%ld", - (mode & SPA_MODE_WRITE) ? get_system_hostid() : 0); + hostid = (mode & SPA_MODE_WRITE) ? get_system_hostid() : 0; random_init(); diff --git a/module/os/freebsd/spl/spl_misc.c b/module/os/freebsd/spl/spl_misc.c index 0354b986cd5f..e46271a039de 100644 --- a/module/os/freebsd/spl/spl_misc.c +++ b/module/os/freebsd/spl/spl_misc.c @@ -43,15 +43,11 @@ static struct opensolaris_utsname hw_utsname = { .machine = MACHINE }; -#ifndef KERNEL_STATIC -char hw_serial[11] = "0"; - utsname_t * utsname(void) { return (&hw_utsname); } -#endif static void opensolaris_utsname_init(void *arg) diff --git a/module/os/freebsd/spl/spl_sunddi.c b/module/os/freebsd/spl/spl_sunddi.c index ebec77bdb37f..2a3c027c9389 100644 --- a/module/os/freebsd/spl/spl_sunddi.c +++ b/module/os/freebsd/spl/spl_sunddi.c @@ -45,19 +45,6 @@ ddi_strtol(const char *str, char **nptr, int base, long *result) return (0); } -int -ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result) -{ - - if (str == hw_serial) { - *result = prison0.pr_hostid; - return (0); - } - - *result = strtoul(str, nptr, base); - return (0); -} - int ddi_strtoull(const char *str, char **nptr, int base, unsigned long long *result) { diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c index 143f34598588..6fa564b8550b 100644 --- a/module/os/linux/spl/spl-generic.c +++ b/module/os/linux/spl/spl-generic.c @@ -425,13 +425,13 @@ EXPORT_SYMBOL(__aeabi_ldivmod); * functions against their Solaris counterparts. It is possible that I * may have misinterpreted the man page or the man page is incorrect. */ -int ddi_strtoul(const char *, char **, int, unsigned long *); +static int ddi_strtoul(const char *, char **, int, unsigned long *); int ddi_strtol(const char *, char **, int, long *); int ddi_strtoull(const char *, char **, int, unsigned long long *); int ddi_strtoll(const char *, char **, int, long long *); -#define define_ddi_strtoux(type, valtype) \ -int ddi_strtou##type(const char *str, char **endptr, \ +#define define_ddi_strtoux(type, valtype, ...) \ +__VA_ARGS__ int ddi_strtou##type(const char *str, char **endptr, \ int base, valtype *result) \ { \ valtype last_value, value = 0; \ @@ -508,12 +508,12 @@ int ddi_strto##type(const char *str, char **endptr, \ return (rc); \ } -define_ddi_strtoux(l, unsigned long) +#define blank +define_ddi_strtoux(l, unsigned long, static) define_ddi_strtox(l, long) -define_ddi_strtoux(ll, unsigned long long) +define_ddi_strtoux(ll, unsigned long long, blank) define_ddi_strtox(ll, long long) -EXPORT_SYMBOL(ddi_strtoul); EXPORT_SYMBOL(ddi_strtol); EXPORT_SYMBOL(ddi_strtoll); EXPORT_SYMBOL(ddi_strtoull); From 354a1bfb8e77ebcba5482139931144e88ec74bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 7 May 2022 19:23:28 +0200 Subject: [PATCH 060/119] linux: spl: generic: ddi_strtou##type: elide unused flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13434 --- module/os/linux/spl/spl-generic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c index 6fa564b8550b..435b054617cf 100644 --- a/module/os/linux/spl/spl-generic.c +++ b/module/os/linux/spl/spl-generic.c @@ -436,7 +436,7 @@ __VA_ARGS__ int ddi_strtou##type(const char *str, char **endptr, \ { \ valtype last_value, value = 0; \ char *ptr = (char *)str; \ - int flag = 1, digit; \ + int digit; \ \ if (strlen(ptr) == 0) \ return (EINVAL); \ @@ -474,15 +474,13 @@ __VA_ARGS__ int ddi_strtou##type(const char *str, char **endptr, \ if (last_value > value) /* Overflow */ \ return (ERANGE); \ \ - flag = 1; \ ptr++; \ } \ \ - if (flag) \ - *result = value; \ + *result = value; \ \ if (endptr) \ - *endptr = (char *)(flag ? ptr : str); \ + *endptr = ptr; \ \ return (0); \ } \ From de8216451840add3be18df0d9fa423a30e35e8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 7 May 2022 19:54:29 +0200 Subject: [PATCH 061/119] linux: spl: generic: ddi_strto*: match solaris ddi_strto*(9) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recognise initial whitespace, + in both cases, and - also in unsigneds Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13434 --- module/os/linux/spl/spl-generic.c | 46 ++++++++++++------------------- module/zfs/sa.c | 4 +-- 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c index 435b054617cf..f99a2f966660 100644 --- a/module/os/linux/spl/spl-generic.c +++ b/module/os/linux/spl/spl-generic.c @@ -425,22 +425,33 @@ EXPORT_SYMBOL(__aeabi_ldivmod); * functions against their Solaris counterparts. It is possible that I * may have misinterpreted the man page or the man page is incorrect. */ -static int ddi_strtoul(const char *, char **, int, unsigned long *); int ddi_strtol(const char *, char **, int, long *); int ddi_strtoull(const char *, char **, int, unsigned long long *); int ddi_strtoll(const char *, char **, int, long long *); -#define define_ddi_strtoux(type, valtype, ...) \ -__VA_ARGS__ int ddi_strtou##type(const char *str, char **endptr, \ +#define define_ddi_strtox(type, valtype) \ +int ddi_strto##type(const char *str, char **endptr, \ int base, valtype *result) \ { \ valtype last_value, value = 0; \ char *ptr = (char *)str; \ - int digit; \ + int digit, minus = 0; \ + \ + while (strchr(" \t\n\r\f", *ptr)) \ + ++ptr; \ \ if (strlen(ptr) == 0) \ return (EINVAL); \ \ + switch (*ptr) { \ + case '-': \ + minus = 1; \ + zfs_fallthrough; \ + case '+': \ + ++ptr; \ + break; \ + } \ + \ /* Auto-detect base based on prefix */ \ if (!base) { \ if (str[0] == '0') { \ @@ -477,7 +488,7 @@ __VA_ARGS__ int ddi_strtou##type(const char *str, char **endptr, \ ptr++; \ } \ \ - *result = value; \ + *result = minus ? -value : value; \ \ if (endptr) \ *endptr = ptr; \ @@ -485,31 +496,8 @@ __VA_ARGS__ int ddi_strtou##type(const char *str, char **endptr, \ return (0); \ } \ -#define define_ddi_strtox(type, valtype) \ -int ddi_strto##type(const char *str, char **endptr, \ - int base, valtype *result) \ -{ \ - int rc; \ - \ - if (*str == '-') { \ - rc = ddi_strtou##type(str + 1, endptr, base, result); \ - if (!rc) { \ - if (*endptr == str + 1) \ - *endptr = (char *)str; \ - else \ - *result = -*result; \ - } \ - } else { \ - rc = ddi_strtou##type(str, endptr, base, result); \ - } \ - \ - return (rc); \ -} - -#define blank -define_ddi_strtoux(l, unsigned long, static) define_ddi_strtox(l, long) -define_ddi_strtoux(ll, unsigned long long, blank) +define_ddi_strtox(ull, unsigned long long) define_ddi_strtox(ll, long long) EXPORT_SYMBOL(ddi_strtol); diff --git a/module/zfs/sa.c b/module/zfs/sa.c index 2b6776581a47..db8c2b831f1d 100644 --- a/module/zfs/sa.c +++ b/module/zfs/sa.c @@ -1068,8 +1068,8 @@ sa_setup(objset_t *os, uint64_t sa_obj, const sa_attr_reg_t *reg_attrs, za.za_num_integers); break; } - VERIFY(ddi_strtoull(za.za_name, NULL, 10, - (unsigned long long *)&lot_num) == 0); + VERIFY0(ddi_strtoull(za.za_name, NULL, 10, + (unsigned long long *)&lot_num)); (void) sa_add_layout_entry(os, lot_attrs, za.za_num_integers, lot_num, From e9072c76f832dc649d27cdb7cd739b3e73fbed37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 19:33:31 +0200 Subject: [PATCH 062/119] zpool: max_width: monomorphise subtype iteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13413 --- cmd/zpool/zpool_main.c | 43 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index bfe798ffe4cd..ac4a0b23adad 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -1987,40 +1987,21 @@ static int max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth, int max, int name_flags) { - char *name; - nvlist_t **child; - uint_t c, children; - int ret; - - name = zpool_vdev_name(g_zfs, zhp, nv, name_flags); - if (strlen(name) + depth > max) - max = strlen(name) + depth; + static const char *const subtypes[] = + {ZPOOL_CONFIG_SPARES, ZPOOL_CONFIG_L2CACHE, ZPOOL_CONFIG_CHILDREN}; + char *name = zpool_vdev_name(g_zfs, zhp, nv, name_flags); + max = MAX(strlen(name) + depth, max); free(name); - if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, - &child, &children) == 0) { - for (c = 0; c < children; c++) - if ((ret = max_width(zhp, child[c], depth + 2, - max, name_flags)) > max) - max = ret; - } - - if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, - &child, &children) == 0) { - for (c = 0; c < children; c++) - if ((ret = max_width(zhp, child[c], depth + 2, - max, name_flags)) > max) - max = ret; - } - - if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, - &child, &children) == 0) { - for (c = 0; c < children; c++) - if ((ret = max_width(zhp, child[c], depth + 2, - max, name_flags)) > max) - max = ret; - } + nvlist_t **child; + uint_t children; + for (size_t i = 0; i < ARRAY_SIZE(subtypes); ++i) + if (nvlist_lookup_nvlist_array(nv, subtypes[i], + &child, &children) == 0) + for (uint_t c = 0; c < children; ++c) + max = MAX(max_width(zhp, child[c], depth + 2, + max, name_flags), max); return (max); } From ca3b105cd99198e59fa6f0b74943319ad7eedcde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 19:38:15 +0200 Subject: [PATCH 063/119] libzfs: pool: zpool_vdev_name: use libzfs_envvar_is_set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13413 --- lib/libzfs/libzfs_pool.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 83fab043366a..ffebf2340b68 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -4123,10 +4123,10 @@ char * zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, int name_flags) { - char *path, *type, *env; + char *path, *type; uint64_t value; char buf[PATH_BUF_LEN]; - char tmpbuf[PATH_BUF_LEN]; + char tmpbuf[PATH_BUF_LEN * 2]; /* * vdev_name will be "root"/"root-0" for the root vdev, but it is the @@ -4136,19 +4136,11 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, if (zhp != NULL && strcmp(type, "root") == 0) return (zfs_strdup(hdl, zpool_get_name(zhp))); - env = getenv("ZPOOL_VDEV_NAME_PATH"); - if (env && (strtoul(env, NULL, 0) > 0 || - !strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2))) + if (libzfs_envvar_is_set("ZPOOL_VDEV_NAME_PATH")) name_flags |= VDEV_NAME_PATH; - - env = getenv("ZPOOL_VDEV_NAME_GUID"); - if (env && (strtoul(env, NULL, 0) > 0 || - !strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2))) + if (libzfs_envvar_is_set("ZPOOL_VDEV_NAME_GUID")) name_flags |= VDEV_NAME_GUID; - - env = getenv("ZPOOL_VDEV_NAME_FOLLOW_LINKS"); - if (env && (strtoul(env, NULL, 0) > 0 || - !strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2))) + if (libzfs_envvar_is_set("ZPOOL_VDEV_NAME_FOLLOW_LINKS")) name_flags |= VDEV_NAME_FOLLOW_LINKS; if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, &value) == 0 || From 5ac80603bdafef9317b3a815137181667cef8947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 19:56:12 +0200 Subject: [PATCH 064/119] libzfs: constify zfs_strip_partition(), zfs_strip_path() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13413 --- include/libzutil.h | 4 ++-- lib/libzfs/libzfs.abi | 6 +++--- lib/libzfs/libzfs_pool.c | 7 +++++-- lib/libzutil/os/freebsd/zutil_device_path_os.c | 6 +++--- lib/libzutil/os/linux/zutil_device_path_os.c | 8 ++++---- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/libzutil.h b/include/libzutil.h index c0a660ea7067..d0d5632c027a 100644 --- a/include/libzutil.h +++ b/include/libzutil.h @@ -97,8 +97,8 @@ _LIBZUTIL_H int zfs_append_partition(char *path, size_t max_len); _LIBZUTIL_H int zfs_resolve_shortname(const char *name, char *path, size_t pathlen); -_LIBZUTIL_H char *zfs_strip_partition(char *); -_LIBZUTIL_H char *zfs_strip_path(char *); +_LIBZUTIL_H char *zfs_strip_partition(const char *); +_LIBZUTIL_H const char *zfs_strip_path(const char *); _LIBZUTIL_H int zfs_strcmp_pathname(const char *, const char *, int); diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 40bd6a5574c8..1c7695275f56 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -5588,12 +5588,12 @@ - + - - + + diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index ffebf2340b68..730e6db53f1b 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -4123,7 +4123,8 @@ char * zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, int name_flags) { - char *path, *type; + char *type, *tpath; + const char *path; uint64_t value; char buf[PATH_BUF_LEN]; char tmpbuf[PATH_BUF_LEN * 2]; @@ -4148,7 +4149,9 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, (void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &value); (void) snprintf(buf, sizeof (buf), "%llu", (u_longlong_t)value); path = buf; - } else if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) { + } else if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &tpath) == 0) { + path = tpath; + if (name_flags & VDEV_NAME_FOLLOW_LINKS) { char *rp = realpath(path, NULL); if (rp) { diff --git a/lib/libzutil/os/freebsd/zutil_device_path_os.c b/lib/libzutil/os/freebsd/zutil_device_path_os.c index ac4748ec7ac8..f93ab9ad7538 100644 --- a/lib/libzutil/os/freebsd/zutil_device_path_os.c +++ b/lib/libzutil/os/freebsd/zutil_device_path_os.c @@ -40,7 +40,7 @@ * Note: The caller must free the returned string. */ char * -zfs_strip_partition(char *dev) +zfs_strip_partition(const char *dev) { return (strdup(dev)); } @@ -56,8 +56,8 @@ zfs_append_partition(char *path, size_t max_len) * On FreeBSD we only want to remove "/dev/" from the beginning of * paths if present. */ -char * -zfs_strip_path(char *path) +const char * +zfs_strip_path(const char *path) { if (strncmp(path, _PATH_DEV, sizeof (_PATH_DEV) - 1) == 0) return (path + sizeof (_PATH_DEV) - 1); diff --git a/lib/libzutil/os/linux/zutil_device_path_os.c b/lib/libzutil/os/linux/zutil_device_path_os.c index f24696259f23..14461b857b54 100644 --- a/lib/libzutil/os/linux/zutil_device_path_os.c +++ b/lib/libzutil/os/linux/zutil_device_path_os.c @@ -81,7 +81,7 @@ zfs_append_partition(char *path, size_t max_len) * caller must free the returned string */ char * -zfs_strip_partition(char *path) +zfs_strip_partition(const char *path) { char *tmp = strdup(path); char *part = NULL, *d = NULL; @@ -117,7 +117,7 @@ zfs_strip_partition(char *path) * Returned string must be freed. */ static char * -zfs_strip_partition_path(char *path) +zfs_strip_partition_path(const char *path) { char *newpath = strdup(path); char *sd_offset; @@ -148,8 +148,8 @@ zfs_strip_partition_path(char *path) /* * Strip the unwanted portion of a device path. */ -char * -zfs_strip_path(char *path) +const char * +zfs_strip_path(const char *path) { return (strrchr(path, '/') + 1); } From 276b08cb0077d7f6c4fe6b735e72740e8e72d572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 3 May 2022 20:13:22 +0200 Subject: [PATCH 065/119] linux: libzutil: zfs_strip_path: only strip known prefixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This mirrors FreeBSD: # zpool create -o cachefile= testpsko media/testpsko # zpool create -o cachefile= testpsko2 $PWD/testpsko2 $ ./zpool list -v NAME SIZE ALLOC FREE filling 25.5T 6.85T 18.6T mirror-0 3.64T 500G 3.15T ata-HGST_HUS726T4TALE6L4_V6K2L4RR - - - ata-HGST_HUS726T4TALE6L4_V6K2MHYR - - - raidz1-1 21.8T 6.36T 15.5T ata-HGST_HUS728T8TALE6L4_VDKT237K - - - ata-HGST_HUS728T8TALE6L4_VDGY075D - - - ata-HGST_HUS728T8TALE6L4_VDKVRRJK - - - cache - - - nvme0n1p4 63.0G 12.8G 50.2G tarta-boot 240M 50.0M 190M mirror-0 240M 50.0M 190M tarta-boot - - - tarta-boot-nvme - - - tarta-zoot 55.5G 6.96G 48.5G mirror-0 55.5G 6.96G 48.5G tarta-zoot - - - tarta-zoot-nvme - - - testpsko 39.5G 744K 39.5G media/testpsko1 39.5G 744K 39.5G testpsko2 39.5G 130K 39.5G /home/nabijaczleweli/store/code/zfs/testpsko2 39.5G 130K 39.5G Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13413 Closes #9771 --- lib/libzutil/os/linux/zutil_device_path_os.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/libzutil/os/linux/zutil_device_path_os.c b/lib/libzutil/os/linux/zutil_device_path_os.c index 14461b857b54..cfd4bfbf1e2c 100644 --- a/lib/libzutil/os/linux/zutil_device_path_os.c +++ b/lib/libzutil/os/linux/zutil_device_path_os.c @@ -151,7 +151,15 @@ zfs_strip_partition_path(const char *path) const char * zfs_strip_path(const char *path) { - return (strrchr(path, '/') + 1); + size_t spath_count; + const char *const *spaths = zpool_default_search_paths(&spath_count); + + for (size_t i = 0; i < spath_count; ++i) + if (strncmp(path, spaths[i], strlen(spaths[i])) == 0 && + path[strlen(spaths[i])] == '/') + return (path + strlen(spaths[i]) + 1); + + return (path); } /* From c0cf6ed6792e545fd614c2a88cb53756db7e03f8 Mon Sep 17 00:00:00 2001 From: Coleman Kane Date: Tue, 17 May 2022 16:07:39 -0400 Subject: [PATCH 066/119] Fix compiler warnings about zero-length arrays in inline bitops The compiler appears to be expanding the unused NULL pointer into a zero-length array via the inline bitops code. When -Werror=array-bounds is used, this causes a build failure. Recommended solution is allocate temporary structures, fill with zeros (to avoid uninitialized data use warnings), and pass the pointer to those to the inline calls. Reviewed-by: Brian Behlendorf Signed-off-by: Coleman Kane Closes #13463 Closes #13465 --- config/kernel-blk-queue.m4 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/config/kernel-blk-queue.m4 b/config/kernel-blk-queue.m4 index 559ae9800e8f..2472c49dda4b 100644 --- a/config/kernel-blk-queue.m4 +++ b/config/kernel-blk-queue.m4 @@ -93,8 +93,10 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ ZFS_LINUX_TEST_SRC([blk_queue_discard], [ #include ],[ - struct request_queue *q __attribute__ ((unused)) = NULL; + struct request_queue r; + struct request_queue *q = &r; int value __attribute__ ((unused)); + memset(q, 0, sizeof(r)); value = blk_queue_discard(q); ]) ]) @@ -119,16 +121,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ #include ],[ - struct request_queue *q __attribute__ ((unused)) = NULL; + struct request_queue r; + struct request_queue *q = &r; int value __attribute__ ((unused)); + memset(q, 0, sizeof(r)); value = blk_queue_secure_erase(q); ]) ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [ #include ],[ - struct request_queue *q __attribute__ ((unused)) = NULL; + struct request_queue r; + struct request_queue *q = &r; int value __attribute__ ((unused)); + memset(q, 0, sizeof(r)); value = blk_queue_secdiscard(q); ]) ]) From 00ac77464ef15c56b2cffb049518b78545552a9d Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 18 May 2022 12:25:33 -0500 Subject: [PATCH 067/119] Expose zpool guids through kstats There are times when end-users may wish to have a fast and convenient method to get zpool guid without having to use libzfs. This commit exposes the zpool guid via kstats in similar manner to the zpool state. Reviewed-by: Alexander Motin Reviewed-by: Brian Behlendorf Signed-off-by: Andrew Walker Closes #13466 --- include/sys/spa.h | 1 + module/zfs/spa_stats.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/include/sys/spa.h b/include/sys/spa.h index 232855449c17..442bc7792b2b 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -898,6 +898,7 @@ typedef struct spa_stats { spa_history_kstat_t tx_assign_histogram; spa_history_list_t mmp_history; spa_history_kstat_t state; /* pool state */ + spa_history_kstat_t guid; /* pool guid */ spa_history_kstat_t iostats; } spa_stats_t; diff --git a/module/zfs/spa_stats.c b/module/zfs/spa_stats.c index 2a75b37f020e..f1d644bc68ca 100644 --- a/module/zfs/spa_stats.c +++ b/module/zfs/spa_stats.c @@ -819,6 +819,41 @@ spa_state_init(spa_t *spa) kmem_strfree(name); } +static int +spa_guid_data(char *buf, size_t size, void *data) +{ + spa_t *spa = (spa_t *)data; + (void) snprintf(buf, size, "%llu\n", (u_longlong_t)spa_guid(spa)); + return (0); +} + +static void +spa_guid_init(spa_t *spa) +{ + spa_history_kstat_t *shk = &spa->spa_stats.guid; + char *name; + kstat_t *ksp; + + mutex_init(&shk->lock, NULL, MUTEX_DEFAULT, NULL); + + name = kmem_asprintf("zfs/%s", spa_name(spa)); + + ksp = kstat_create(name, 0, "guid", "misc", + KSTAT_TYPE_RAW, 0, KSTAT_FLAG_VIRTUAL); + + shk->kstat = ksp; + if (ksp) { + ksp->ks_lock = &shk->lock; + ksp->ks_data = NULL; + ksp->ks_private = spa; + ksp->ks_flags |= KSTAT_FLAG_NO_HEADERS; + kstat_set_raw_ops(ksp, NULL, spa_guid_data, spa_state_addr); + kstat_install(ksp); + } + + kmem_strfree(name); +} + static void spa_health_destroy(spa_t *spa) { @@ -830,6 +865,17 @@ spa_health_destroy(spa_t *spa) mutex_destroy(&shk->lock); } +static void +spa_guid_destroy(spa_t *spa) +{ + spa_history_kstat_t *shk = &spa->spa_stats.guid; + kstat_t *ksp = shk->kstat; + if (ksp) + kstat_delete(ksp); + + mutex_destroy(&shk->lock); +} + static const spa_iostats_t spa_iostats_template = { { "trim_extents_written", KSTAT_DATA_UINT64 }, { "trim_bytes_written", KSTAT_DATA_UINT64 }, @@ -950,6 +996,7 @@ spa_stats_init(spa_t *spa) spa_tx_assign_init(spa); spa_mmp_history_init(spa); spa_state_init(spa); + spa_guid_init(spa); spa_iostats_init(spa); } @@ -962,6 +1009,7 @@ spa_stats_destroy(spa_t *spa) spa_txg_history_destroy(spa); spa_read_history_destroy(spa); spa_mmp_history_destroy(spa); + spa_guid_destroy(spa); } ZFS_MODULE_PARAM(zfs, zfs_, read_history, INT, ZMOD_RW, From 08b32c6fa9dd68d024447979e7c9b711b9e60c56 Mon Sep 17 00:00:00 2001 From: heeplr <32984777+heeplr@users.noreply.github.com> Date: Wed, 18 May 2022 19:27:53 +0200 Subject: [PATCH 068/119] zed: support subject as header in zed_notify_email() Some minimal MUAs don't support passing the subjects as cmdline option. This commit checks if "@SUBJECT@" is missing in ZED_EMAIL_OPTS and then prepends a subject header to the notification message. Also set a default for ${subject}. Reviewed-by: Ahelenia Ziemia<84>ska Reviewed-by: Tony Hutter Signed-off-by: Daniel Hiepler Closes #13440 --- cmd/zed/zed.d/zed-functions.sh | 19 ++++++++++++++++--- cmd/zed/zed.d/zed.rc | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cmd/zed/zed.d/zed-functions.sh b/cmd/zed/zed.d/zed-functions.sh index 70a7113c6580..49b6b54029aa 100644 --- a/cmd/zed/zed.d/zed-functions.sh +++ b/cmd/zed/zed.d/zed-functions.sh @@ -223,6 +223,8 @@ zed_notify() # ZED_EMAIL_OPTS. This undergoes the following keyword substitutions: # - @ADDRESS@ is replaced with the space-delimited recipient email address(es) # - @SUBJECT@ is replaced with the notification subject +# If @SUBJECT@ was omited here, a "Subject: ..." header will be added to notification +# # # Arguments # subject: notification subject @@ -240,7 +242,7 @@ zed_notify() # zed_notify_email() { - local subject="$1" + local subject="${1:-"ZED notification"}" local pathname="${2:-"/dev/null"}" : "${ZED_EMAIL_PROG:="mail"}" @@ -261,12 +263,23 @@ zed_notify_email() return 1 fi - ZED_EMAIL_OPTS="$(echo "${ZED_EMAIL_OPTS}" \ + # construct cmdline options + ZED_EMAIL_OPTS_PARSED="$(echo "${ZED_EMAIL_OPTS}" \ | sed -e "s/@ADDRESS@/${ZED_EMAIL_ADDR}/g" \ -e "s/@SUBJECT@/${subject}/g")" + # pipe message to email prog # shellcheck disable=SC2086,SC2248 - eval ${ZED_EMAIL_PROG} ${ZED_EMAIL_OPTS} < "${pathname}" >/dev/null 2>&1 + { + # no subject passed as option? + if [ "${ZED_EMAIL_OPTS%@SUBJECT@*}" = "${ZED_EMAIL_OPTS}" ] ; then + # inject subject header + printf "Subject: %s\n" "${subject}" + fi + # output message + cat "${pathname}" + } | + eval ${ZED_EMAIL_PROG} ${ZED_EMAIL_OPTS_PARSED} >/dev/null 2>&1 rv=$? if [ "${rv}" -ne 0 ]; then zed_log_err "${ZED_EMAIL_PROG##*/} exit=${rv}" diff --git a/cmd/zed/zed.d/zed.rc b/cmd/zed/zed.d/zed.rc index 3c58a2c281f5..c55a70c79f75 100644 --- a/cmd/zed/zed.d/zed.rc +++ b/cmd/zed/zed.d/zed.rc @@ -29,6 +29,7 @@ ZED_EMAIL_ADDR="root" # The string @SUBJECT@ will be replaced with the notification subject; # this should be protected with quotes to prevent word-splitting. # Email will only be sent if ZED_EMAIL_ADDR is defined. +# If @SUBJECT@ was omited here, a "Subject: ..." header will be added to notification # #ZED_EMAIL_OPTS="-s '@SUBJECT@' @ADDRESS@" From 7506f5af922895afe52377e2ea1e9813e3be8111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 10 May 2022 22:05:20 +0200 Subject: [PATCH 069/119] Add make regen-tests to regenerate the test bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13447 --- Makefile.am | 4 ++++ tests/zfs-tests/tests/Makefile.am | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ebb385fabc06..0a73a63870bc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -170,6 +170,10 @@ flake8: echo "skipping flake8 because flake8 is not installed"; \ fi +PHONY += regen-tests +regen-tests: + @$(MAKE) -C tests/zfs-tests/tests regen + PHONY += ctags ctags: $(RM) tags diff --git a/tests/zfs-tests/tests/Makefile.am b/tests/zfs-tests/tests/Makefile.am index 4bc05c92f592..49f9f3aaa7d6 100644 --- a/tests/zfs-tests/tests/Makefile.am +++ b/tests/zfs-tests/tests/Makefile.am @@ -32,7 +32,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS = \ \ perf/scripts/prefetch_io.sh -# These lists can be regenerated by running, on a *clean* source: +# These lists can be regenerated by running make regen-tests at the root, or, on a *clean* source: # find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' ! -executable -name '*.in' | sort | sed 's/\.in$//;s/^/\t/;$!s/$/ \\/' # find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' -executable -name '*.in' | sort | sed 's/\.in$//;s/^/\t/;$!s/$/ \\/' # find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' ! -name '*.in' ! -name '*.c' | grep -Fe /simd -e /tmpfile | sort | sed 's/^/\t/;$!s/$/ \\/' @@ -43,6 +43,32 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS = \ # # C programs are specced in ../Makefile.am above as part of the main Makefile +find_common := find functional/ ! -type d ! -name .gitignore ! -name .dirstamp ! -name '*.Po' +regen: + @$(MAKE) -C $(top_builddir) clean + @$(MAKE) clean + $(SED) $(ac_inplace) '/^# -- >8 --/q' Makefile.am + echo >> Makefile.am + echo 'nobase_nodist_datadir_zfs_tests_tests_DATA = \' >> Makefile.am + $(find_common) ! -executable -name '*.in' | sort | sed 's/\.in$$//;s/^/\t/;$$!s/$$/ \\/' >> Makefile.am + echo 'nobase_nodist_datadir_zfs_tests_tests_SCRIPTS = \' >> Makefile.am + $(find_common) -executable -name '*.in' | sort | sed 's/\.in$$//;s/^/\t/;$$!s/$$/ \\/' >> Makefile.am + echo >> Makefile.am + echo 'SUBSTFILES += $$(nobase_nodist_datadir_zfs_tests_tests_DATA) $$(nobase_nodist_datadir_zfs_tests_tests_SCRIPTS)' >> Makefile.am + echo >> Makefile.am + echo 'if BUILD_LINUX' >> Makefile.am + echo 'nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \' >> Makefile.am + $(find_common) ! -name '*.in' ! -name '*.c' | grep -Fe /simd -e /tmpfile | sort | sed 's/^/\t/;$$!s/$$/ \\/' >> Makefile.am + echo 'endif' >> Makefile.am + echo >> Makefile.am + echo 'nobase_dist_datadir_zfs_tests_tests_DATA += \' >> Makefile.am + $(find_common) ! -executable ! -name '*.in' ! -name '*.c' | grep -vFe /simd -e /tmpfile | sort | sed 's/^/\t/;$$!s/$$/ \\/' >> Makefile.am + echo >> Makefile.am + echo 'nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \' >> Makefile.am + $(find_common) -executable ! -name '*.in' ! -name '*.c' | grep -vFe /simd -e /tmpfile | sort | sed 's/^/\t/;$$!s/$$/ \\/' >> Makefile.am + +# -- >8 -- + nobase_nodist_datadir_zfs_tests_tests_DATA = \ functional/pam/utilities.kshlib nobase_nodist_datadir_zfs_tests_tests_SCRIPTS = \ From 7062a956f79b264084d71e542ce74bc5144f504d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 10 May 2022 22:10:57 +0200 Subject: [PATCH 070/119] rpm: don't spec obsolete_name/version anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13447 --- rpm/generic/zfs-kmod.spec.in | 4 +-- rpm/redhat/zfs-kmod.spec.in | 5 +-- scripts/kmodtool | 61 +++++------------------------------- 3 files changed, 10 insertions(+), 60 deletions(-) diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in index 4ed719b8fe14..79fe2753c1e8 100644 --- a/rpm/generic/zfs-kmod.spec.in +++ b/rpm/generic/zfs-kmod.spec.in @@ -98,7 +98,7 @@ BuildRequires: %{_bindir}/kmodtool # Kmodtool does its magic here. A patched version of kmodtool is shipped # with the source rpm until kmod development packages are supported upstream. # https://bugzilla.rpmfusion.org/show_bug.cgi?id=2714 -%{expand:%(bash %{SOURCE10} --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} --devel %{?prefix:--prefix "%{?prefix}"} %{?kernels:--for-kernels "%{?kernels}"} %{?kernelbuildroot:--buildroot "%{?kernelbuildroot}"} --obsolete-name spl --obsolete-version 0.8 2>/dev/null) } +%{expand:%(bash %{SOURCE10} --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} --devel %{?prefix:--prefix "%{?prefix}"} %{?kernels:--for-kernels "%{?kernels}"} %{?kernelbuildroot:--buildroot "%{?kernelbuildroot}"} 2>/dev/null) } %description @@ -109,7 +109,7 @@ This package contains the ZFS kernel modules. %{?kmodtool_check} # Print kmodtool output for debugging purposes: -bash %{SOURCE10} --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} --devel %{?prefix:--prefix "%{?prefix}"} %{?kernels:--for-kernels "%{?kernels}"} %{?kernelbuildroot:--buildroot "%{?kernelbuildroot}"} --obsolete-name spl --obsolete-version 0.8 2>/dev/null +bash %{SOURCE10} --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} --devel %{?prefix:--prefix "%{?prefix}"} %{?kernels:--for-kernels "%{?kernels}"} %{?kernelbuildroot:--buildroot "%{?kernelbuildroot}"} 2>/dev/null %if %{with debug} %define debug --enable-debug diff --git a/rpm/redhat/zfs-kmod.spec.in b/rpm/redhat/zfs-kmod.spec.in index 7ee04e2340c6..f59551c0b43a 100644 --- a/rpm/redhat/zfs-kmod.spec.in +++ b/rpm/redhat/zfs-kmod.spec.in @@ -17,9 +17,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # by generating a preamble text file which kmodtool can append to the spec file. %(/bin/echo -e "\ Requires: @PACKAGE@ = %{version}\n\ -Conflicts: @PACKAGE@-dkms\n\ -Obsoletes: kmod-spl\n\ -Obsoletes: spl-kmod\n\n" > %{_sourcedir}/kmod-preamble) +Conflicts: @PACKAGE@-dkms) # LDFLAGS are not sanitized by arch/*/Makefile for these architectures. %ifarch ppc ppc64 ppc64le aarch64 @@ -39,7 +37,6 @@ This package contains the ZFS kernel modules. %package -n kmod-%{kmod_name}-devel Summary: ZFS kernel module(s) devel common Group: System Environment/Kernel -Provides: kmod-spl-devel = %{version} %description -n kmod-%{kmod_name}-devel This package provides the header files and objects to build kernel modules. diff --git a/scripts/kmodtool b/scripts/kmodtool index f66341196acb..bda5c41ee7a6 100755 --- a/scripts/kmodtool +++ b/scripts/kmodtool @@ -72,7 +72,7 @@ LANG=C rpmbuild --define "_sourcedir %{_sourcedir}" \\\ ln -s \$(ls \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/) \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/${kmodname}-kmod.latest %package -n akmod-${kmodname} -Summary: Akmod package for ${kmodname} kernel module(s) +Summary: Akmod package for ${kmodname} kernel module(s) Group: System Environment/Kernel Requires: kmodtool Requires: akmods @@ -82,11 +82,6 @@ Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version} Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} EOF - if [ -n "${obsolete_name}" ]; then - echo "Provides: akmod-${obsolete_name} = ${obsolete_version}" - echo "Obsoletes: akmod-${obsolete_name} < ${obsolete_version}" - fi - cat <= %{?epoch:%{epoch}:}%{version}-%{release}" fi - if [ -n "${obsolete_name}" ]; then - echo "Provides: kmod-${obsolete_name}-devel = ${obsolete_version}" - echo "Obsoletes: kmod-${obsolete_name}-devel < ${obsolete_version}" - fi - cat <= %{?epoch:%{epoch}:}%{vers %{?KmodsMetaRequires:Requires: %{?KmodsMetaRequires}} EOF - if [ -n "${obsolete_name}" ]; then - echo "Provides: kmod-${obsolete_name}${kernel_variant} = ${obsolete_version}" - echo "Obsoletes: kmod-${obsolete_name}${kernel_variant} < ${obsolete_version}" - fi - cat <&2 - elif [ ! -e "${1}" ]; then + elif [ ! -e "${1}" ]; then error_out 2 "Filterfile ${1} not found" >&2 fi filterfile="${1}" @@ -505,22 +476,6 @@ while [ -n "${1}" ] ; do shift noakmod="true" ;; - --obsolete-name) - shift - if [ -z "${1}" ] ; then - error_out 2 "Please provide the name of the kmod to obsolete together with --obsolete-name" >&2 - fi - obsolete_name="${1}" - shift - ;; - --obsolete-version) - shift - if [ -z "${1}" ] ; then - error_out 2 "Please provide the version of the kmod to obsolete together with --obsolete-version" >&2 - fi - obsolete_version="${1}" - shift - ;; --target) shift target="${1}" @@ -574,8 +529,6 @@ elif [ -z "${kmodname}" ]; then error_out 2 "please pass kmodname with --kmodname" elif [ -z "${kernels_known_variants}" ] ; then error_out 2 "could not determine known variants" -elif { [ -n "${obsolete_name}" ] && [ -z "${obsolete_version}" ]; } || { [ -z "${obsolete_name}" ] && [ -n "${obsolete_version}" ]; } ; then - error_out 2 "you need to provide both --obsolete-name and --obsolete-version" fi # go @@ -599,7 +552,7 @@ else # call buildsys-build-${repo}-kerneldevpkgs to get the list of kernels cmdoptions="--target ${target}" - # filterfile to filter list of kernels? + # filterfile to filter list of kernels? if [ -n "${filterfile}" ] ; then cmdoptions="${cmdoptions} --filterfile ${filterfile}" fi @@ -607,7 +560,7 @@ else kernel_versions_to_build_for=$(buildsys-build-${repo}-kerneldevpkgs "--${build_kernels}" ${cmdoptions}) returncode=$? if [ "$returncode" -ne 0 ]; then - + error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: ${kernel_versions_to_build_for}" fi @@ -615,5 +568,5 @@ else print_akmodtemplate fi - print_rpmtemplate + print_rpmtemplate fi From 2f713390d18ff3ae8ad4fdb8e97f9fdfbf867bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 10 May 2022 22:11:30 +0200 Subject: [PATCH 071/119] kmodtool: cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13447 --- scripts/kmodtool | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/kmodtool b/scripts/kmodtool index bda5c41ee7a6..a79ad0c7a0f3 100755 --- a/scripts/kmodtool +++ b/scripts/kmodtool @@ -557,12 +557,8 @@ else cmdoptions="${cmdoptions} --filterfile ${filterfile}" fi - kernel_versions_to_build_for=$(buildsys-build-${repo}-kerneldevpkgs "--${build_kernels}" ${cmdoptions}) - returncode=$? - if [ "$returncode" -ne 0 ]; then - + kernel_versions_to_build_for=$(buildsys-build-${repo}-kerneldevpkgs "--${build_kernels}" ${cmdoptions}) || error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: ${kernel_versions_to_build_for}" - fi if [ "${build_kernels}" = "current" ] && [ -z "${noakmod}" ]; then print_akmodtemplate From 6b575417e2bd500906ede0c82c0d29780ee26e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 10 May 2022 23:25:43 +0200 Subject: [PATCH 072/119] libspl/include: remove unused/empty headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13447 --- include/libzfs.h | 2 - include/thread_pool.h | 1 - lib/libspl/include/Makefile.am | 13 -- lib/libspl/include/libdevinfo.h | 30 ---- lib/libspl/include/limits.h | 45 ----- lib/libspl/include/locale.h | 35 ---- lib/libspl/include/os/freebsd/sys/byteorder.h | 2 +- lib/libspl/include/os/freebsd/sys/mnttab.h | 4 +- .../include/os/freebsd/sys/zfs_context_os.h | 1 - lib/libspl/include/os/linux/sys/byteorder.h | 2 +- lib/libspl/include/stropts.h | 25 --- lib/libspl/include/sys/int_limits.h | 30 ---- lib/libspl/include/sys/int_types.h | 32 ---- lib/libspl/include/sys/kstat.h | 35 +--- lib/libspl/include/sys/stropts.h | 29 ---- lib/libspl/include/sys/types.h | 2 +- lib/libspl/include/sys/tzfile.h | 164 ------------------ lib/libspl/include/sys/va_list.h | 32 ---- lib/libspl/include/sys/varargs.h | 30 ---- lib/libspl/include/thread.h | 30 ---- lib/libspl/include/tzfile.h | 32 ---- lib/libspl/include/ucred.h | 32 ---- lib/libzfs/libzfs_dataset.c | 1 - lib/libzfs/libzfs_diff.c | 1 - 24 files changed, 6 insertions(+), 604 deletions(-) delete mode 100644 lib/libspl/include/libdevinfo.h delete mode 100644 lib/libspl/include/limits.h delete mode 100644 lib/libspl/include/locale.h delete mode 100644 lib/libspl/include/stropts.h delete mode 100644 lib/libspl/include/sys/int_limits.h delete mode 100644 lib/libspl/include/sys/int_types.h delete mode 100644 lib/libspl/include/sys/stropts.h delete mode 100644 lib/libspl/include/sys/tzfile.h delete mode 100644 lib/libspl/include/sys/va_list.h delete mode 100644 lib/libspl/include/sys/varargs.h delete mode 100644 lib/libspl/include/thread.h delete mode 100644 lib/libspl/include/tzfile.h delete mode 100644 lib/libspl/include/ucred.h diff --git a/include/libzfs.h b/include/libzfs.h index 04f464d12faf..46cb60520160 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -40,10 +40,8 @@ #include #include #include -#include #include #include -#include #include #ifdef __cplusplus diff --git a/include/thread_pool.h b/include/thread_pool.h index 43090c3c6644..19edebd7da36 100644 --- a/include/thread_pool.h +++ b/include/thread_pool.h @@ -28,7 +28,6 @@ #define _THREAD_POOL_H_ extern __attribute__((visibility("default"))) #include -#include #include #ifdef __cplusplus diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index 2c0284310723..6f0e1818d22e 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -2,18 +2,11 @@ libspldir = $(includedir)/libspl libspl_HEADERS = \ %D%/assert.h \ %D%/atomic.h \ - %D%/libdevinfo.h \ %D%/libgen.h \ %D%/libshare.h \ - %D%/limits.h \ - %D%/locale.h \ %D%/statcommon.h \ %D%/stdlib.h \ %D%/string.h \ - %D%/stropts.h \ - %D%/thread.h \ - %D%/tzfile.h \ - %D%/ucred.h \ %D%/umem.h \ %D%/unistd.h \ %D%/zone.h @@ -40,8 +33,6 @@ libspl_sys_HEADERS = \ %D%/sys/dkio.h \ %D%/sys/dklabel.h \ %D%/sys/feature_tests.h \ - %D%/sys/int_limits.h \ - %D%/sys/int_types.h \ %D%/sys/inttypes.h \ %D%/sys/isa_defs.h \ %D%/sys/kmem.h \ @@ -59,7 +50,6 @@ libspl_sys_HEADERS = \ %D%/sys/stack.h \ %D%/sys/stdtypes.h \ %D%/sys/string.h \ - %D%/sys/stropts.h \ %D%/sys/sunddi.h \ %D%/sys/systeminfo.h \ %D%/sys/time.h \ @@ -67,10 +57,7 @@ libspl_sys_HEADERS = \ %D%/sys/trace_zfs.h \ %D%/sys/types.h \ %D%/sys/types32.h \ - %D%/sys/tzfile.h \ %D%/sys/uio.h \ - %D%/sys/va_list.h \ - %D%/sys/varargs.h \ %D%/sys/vnode.h \ %D%/sys/wmsum.h \ %D%/sys/zone.h diff --git a/lib/libspl/include/libdevinfo.h b/lib/libspl/include/libdevinfo.h deleted file mode 100644 index be1d291f4051..000000000000 --- a/lib/libspl/include/libdevinfo.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_LIBDEVINFO_H -#define _LIBSPL_LIBDEVINFO_H - -#endif /* _LIBSPL_LIBDEVINFO_H */ diff --git a/lib/libspl/include/limits.h b/lib/libspl/include/limits.h deleted file mode 100644 index 5d996eb846d1..000000000000 --- a/lib/libspl/include/limits.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include_next -#include - -#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 */ diff --git a/lib/libspl/include/locale.h b/lib/libspl/include/locale.h deleted file mode 100644 index 6c74df72072e..000000000000 --- a/lib/libspl/include/locale.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include_next - -#ifndef _LIBSPL_LOCALE_H -#define _LIBSPL_LOCALE_H - -#include -#include - -#endif diff --git a/lib/libspl/include/os/freebsd/sys/byteorder.h b/lib/libspl/include/os/freebsd/sys/byteorder.h index cd692d3616e0..d4227ddc5465 100644 --- a/lib/libspl/include/os/freebsd/sys/byteorder.h +++ b/lib/libspl/include/os/freebsd/sys/byteorder.h @@ -43,7 +43,7 @@ #include #include #include -#include +#include #if defined(__GNUC__) && defined(_ASM_INLINES) && \ (defined(__i386) || defined(__amd64)) diff --git a/lib/libspl/include/os/freebsd/sys/mnttab.h b/lib/libspl/include/os/freebsd/sys/mnttab.h index c08349bdf9bd..54c1bc59ab56 100644 --- a/lib/libspl/include/os/freebsd/sys/mnttab.h +++ b/lib/libspl/include/os/freebsd/sys/mnttab.h @@ -79,7 +79,7 @@ extern int _sol_getmntent(FILE *fp, struct mnttab *mp); extern int getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf); extern void statfs2mnttab(struct statfs *sfs, struct mnttab *mp); -char *hasmntopt(struct mnttab *mnt, char *opt); -int getmntent(FILE *fp, struct mnttab *mp); +extern char *hasmntopt(struct mnttab *mnt, char *opt); +extern int getmntent(FILE *fp, struct mnttab *mp); #endif diff --git a/lib/libspl/include/os/freebsd/sys/zfs_context_os.h b/lib/libspl/include/os/freebsd/sys/zfs_context_os.h index b9bf487c2aef..9b9d69bddcf7 100644 --- a/lib/libspl/include/os/freebsd/sys/zfs_context_os.h +++ b/lib/libspl/include/os/freebsd/sys/zfs_context_os.h @@ -30,6 +30,5 @@ #define ZFS_CONTEXT_OS_H_ #define HAVE_LARGE_STACKS 1 -#define ZFS_EXPORTS_PATH "/etc/zfs/exports" #endif diff --git a/lib/libspl/include/os/linux/sys/byteorder.h b/lib/libspl/include/os/linux/sys/byteorder.h index d5ee3e26f5a5..47af7700f031 100644 --- a/lib/libspl/include/os/linux/sys/byteorder.h +++ b/lib/libspl/include/os/linux/sys/byteorder.h @@ -46,7 +46,7 @@ #endif #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/lib/libspl/include/stropts.h b/lib/libspl/include/stropts.h deleted file mode 100644 index 37acd4052b0b..000000000000 --- a/lib/libspl/include/stropts.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 - */ - -#ifndef _LIBSPL_STROPTS_H -#define _LIBSPL_STROPTS_H - -#endif /* _LIBSPL_STROPTS_H */ diff --git a/lib/libspl/include/sys/int_limits.h b/lib/libspl/include/sys/int_limits.h deleted file mode 100644 index 7af68cdb2998..000000000000 --- a/lib/libspl/include/sys/int_limits.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_SYS_INT_LIMITS_H -#define _LIBSPL_SYS_INT_LIMITS_H - -#endif diff --git a/lib/libspl/include/sys/int_types.h b/lib/libspl/include/sys/int_types.h deleted file mode 100644 index 51e9e0285490..000000000000 --- a/lib/libspl/include/sys/int_types.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SOL_SYS_INT_TYPES_H -#define _SOL_SYS_INT_TYPES_H - -#include - -#endif diff --git a/lib/libspl/include/sys/kstat.h b/lib/libspl/include/sys/kstat.h index 7f9aa6d8dbd7..c2de0778485c 100644 --- a/lib/libspl/include/sys/kstat.h +++ b/lib/libspl/include/sys/kstat.h @@ -92,39 +92,6 @@ typedef struct kstat { void *ks_lock; /* protects this kstat's data */ } kstat_t; -#ifdef _SYSCALL32 - -typedef int32_t kid32_t; - -typedef struct kstat32 { - /* - * Fields relevant to both kernel and user - */ - hrtime_t ks_crtime; - caddr32_t ks_next; /* struct kstat pointer */ - kid32_t ks_kid; - char ks_module[KSTAT_STRLEN]; - uint8_t ks_resv; - int32_t ks_instance; - char ks_name[KSTAT_STRLEN]; - uint8_t ks_type; - char ks_class[KSTAT_STRLEN]; - uint8_t ks_flags; - caddr32_t ks_data; /* type-specific data */ - uint32_t ks_ndata; - size32_t ks_data_size; - hrtime_t ks_snaptime; - /* - * Fields relevant to kernel only (only needed here for padding) - */ - int32_t _ks_update; - caddr32_t _ks_private; - int32_t _ks_snapshot; - caddr32_t _ks_lock; -} kstat32_t; - -#endif /* _SYSCALL32 */ - /* * kstat structure and locking strategy * @@ -467,7 +434,7 @@ typedef struct kstat_named { * 64-bit compilation environments or 32-bit non-maximally conformant * C89 or C90 ANSI C compilation environments (cc -Xt and cc -Xa). In the * C99 ANSI C compilation environment, the long long type is supported. - * The _INT64_TYPE is defined by the implementation (see sys/int_types.h). + * The _INT64_TYPE is defined by the implementation (see sys/inttypes.h). */ #if defined(_INT64_TYPE) int64_t i64; diff --git a/lib/libspl/include/sys/stropts.h b/lib/libspl/include/sys/stropts.h deleted file mode 100644 index 08c2e79bc53c..000000000000 --- a/lib/libspl/include/sys/stropts.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_SYS_STROPTS_H -#define _LIBSPL_SYS_STROPTS_H - -#endif /* _LIBSPL_SYS_STROPTS_H */ diff --git a/lib/libspl/include/sys/types.h b/lib/libspl/include/sys/types.h index ea02ffac93ac..f32c2188a111 100644 --- a/lib/libspl/include/sys/types.h +++ b/lib/libspl/include/sys/types.h @@ -37,7 +37,7 @@ #include #include_next #include -#include +#include #include #ifndef HAVE_INTTYPES diff --git a/lib/libspl/include/sys/tzfile.h b/lib/libspl/include/sys/tzfile.h deleted file mode 100644 index e30e7566366e..000000000000 --- a/lib/libspl/include/sys/tzfile.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * from Arthur Olson's 6.1 - */ - -#ifndef _LIBSPL_SYS_TZFILE_H -#define _LIBSPL_SYS_TZFILE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Information about time zone files. - */ - -#define TZDIR "/usr/share/lib/zoneinfo" /* Time zone object file directory */ - -#define TZDEFAULT (getenv("TZ")) - -#define TZDEFRULES "posixrules" - -/* - * Each file begins with. . . - */ - -struct tzhead { - char tzh_reserved[24]; /* reserved for future use */ - char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ - char tzh_leapcnt[4]; /* coded number of leap seconds */ - char tzh_timecnt[4]; /* coded number of transition times */ - char tzh_typecnt[4]; /* coded number of local time types */ - char tzh_charcnt[4]; /* coded number of abbr. chars */ -}; - -/* - * . . .followed by. . . - * - * tzh_timecnt (char [4])s coded transition times a la time(2) - * tzh_timecnt (unsigned char)s types of local time starting at above - * tzh_typecnt repetitions of - * one (char [4]) coded GMT offset in seconds - * one (unsigned char) used to set tm_isdst - * one (unsigned char) that's an abbreviation list index - * tzh_charcnt (char)s '\0'-terminated zone abbreviations - * tzh_leapcnt repetitions of - * one (char [4]) coded leap second transition times - * one (char [4]) total correction after above - * tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition - * time is standard time, if FALSE, - * transition time is wall clock time - * if absent, transition times are - * assumed to be wall clock time - */ - -/* - * In the current implementation, "tzset()" refuses to deal with files that - * exceed any of the limits below. - */ - -/* - * The TZ_MAX_TIMES value below is enough to handle a bit more than a - * year's worth of solar time (corrected daily to the nearest second) or - * 138 years of Pacific Presidential Election time - * (where there are three time zone transitions every fourth year). - */ -#define TZ_MAX_TIMES 370 - -#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ - -#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ - -#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ - -#define SECSPERMIN 60 -#define MINSPERHOUR 60 -#define HOURSPERDAY 24 -#define DAYSPERWEEK 7 -#define DAYSPERNYEAR 365 -#define DAYSPERLYEAR 366 -#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) -#define SECSPERDAY ((long)SECSPERHOUR * HOURSPERDAY) -#define MONSPERYEAR 12 - -#define TM_SUNDAY 0 -#define TM_MONDAY 1 -#define TM_TUESDAY 2 -#define TM_WEDNESDAY 3 -#define TM_THURSDAY 4 -#define TM_FRIDAY 5 -#define TM_SATURDAY 6 - -#define TM_JANUARY 0 -#define TM_FEBRUARY 1 -#define TM_MARCH 2 -#define TM_APRIL 3 -#define TM_MAY 4 -#define TM_JUNE 5 -#define TM_JULY 6 -#define TM_AUGUST 7 -#define TM_SEPTEMBER 8 -#define TM_OCTOBER 9 -#define TM_NOVEMBER 10 -#define TM_DECEMBER 11 - -#define TM_YEAR_BASE 1900 - -#define EPOCH_YEAR 1970 -#define EPOCH_WDAY TM_THURSDAY - -/* - * Accurate only for the past couple of centuries; - * that will probably do. - */ - -#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) - -/* - * Use of the underscored variants may cause problems if you move your code to - * certain System-V-based systems; for maximum portability, use the - * underscore-free variants. The underscored variants are provided for - * backward compatibility only; they may disappear from future versions of - * this file. - */ - -#define SECS_PER_MIN SECSPERMIN -#define MINS_PER_HOUR MINSPERHOUR -#define HOURS_PER_DAY HOURSPERDAY -#define DAYS_PER_WEEK DAYSPERWEEK -#define DAYS_PER_NYEAR DAYSPERNYEAR -#define DAYS_PER_LYEAR DAYSPERLYEAR -#define SECS_PER_HOUR SECSPERHOUR -#define SECS_PER_DAY SECSPERDAY -#define MONS_PER_YEAR MONSPERYEAR - -#ifdef __cplusplus -} -#endif - -#endif /* _LIBSPL_SYS_TZFILE_H */ diff --git a/lib/libspl/include/sys/va_list.h b/lib/libspl/include/sys/va_list.h deleted file mode 100644 index a36f5c77daa9..000000000000 --- a/lib/libspl/include/sys/va_list.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SYS_VA_LIST_H -#define _SYS_VA_LIST_H - -#include - -#endif diff --git a/lib/libspl/include/sys/varargs.h b/lib/libspl/include/sys/varargs.h deleted file mode 100644 index 3d00a3361d87..000000000000 --- a/lib/libspl/include/sys/varargs.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_SYS_VARARGS_H -#define _LIBSPL_SYS_VARARGS_H - -#endif diff --git a/lib/libspl/include/thread.h b/lib/libspl/include/thread.h deleted file mode 100644 index 74694e23eed5..000000000000 --- a/lib/libspl/include/thread.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_THREAD_H -#define _LIBSPL_THREAD_H - -#endif /* _LIBSPL_THREAD_H */ diff --git a/lib/libspl/include/tzfile.h b/lib/libspl/include/tzfile.h deleted file mode 100644 index 7bd4087cd5d1..000000000000 --- a/lib/libspl/include/tzfile.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_TZFILE_H -#define _LIBSPL_TZFILE_H - -#include - -#endif /* _LIBSPL_TZFILE_H */ diff --git a/lib/libspl/include/ucred.h b/lib/libspl/include/ucred.h deleted file mode 100644 index 8178fdec4c74..000000000000 --- a/lib/libspl/include/ucred.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_UCRED_H -#define _LIBSPL_UCRED_H - -typedef int ucred_t; - -#endif diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 50053e35f0d5..1f6addcae58a 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -49,7 +49,6 @@ #include #include #include -#include #ifdef HAVE_IDMAP #include #include diff --git a/lib/libzfs/libzfs_diff.c b/lib/libzfs/libzfs_diff.c index e8b8a1dfc398..a414024bb427 100644 --- a/lib/libzfs/libzfs_diff.c +++ b/lib/libzfs/libzfs_diff.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include From 89e81bc6adf58ec442ddaa23e629bf888bc55488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 10 May 2022 23:28:02 +0200 Subject: [PATCH 073/119] Remove final K&R definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clang trunk now warns -Wstrict-prototypes on this, and they're removed in C2x Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13447 --- cmd/zed/agents/zfs_mod.c | 4 ++-- cmd/zed/zed_disk_event.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/zed/agents/zfs_mod.c b/cmd/zed/agents/zfs_mod.c index 59d8182c0b2e..17e47873ebb7 100644 --- a/cmd/zed/agents/zfs_mod.c +++ b/cmd/zed/agents/zfs_mod.c @@ -1073,7 +1073,7 @@ zfs_enum_pools(void *arg) * For now, each agent has its own libzfs instance */ int -zfs_slm_init() +zfs_slm_init(void) { if ((g_zfshdl = libzfs_init()) == NULL) return (-1); @@ -1099,7 +1099,7 @@ zfs_slm_init() } void -zfs_slm_fini() +zfs_slm_fini(void) { unavailpool_t *pool; pendingdev_t *device; diff --git a/cmd/zed/zed_disk_event.c b/cmd/zed/zed_disk_event.c index 52b80d8c4c93..c4ca5452354b 100644 --- a/cmd/zed/zed_disk_event.c +++ b/cmd/zed/zed_disk_event.c @@ -362,7 +362,7 @@ zed_udev_monitor(void *arg) } int -zed_disk_event_init() +zed_disk_event_init(void) { int fd, fflags; @@ -398,7 +398,7 @@ zed_disk_event_init() } void -zed_disk_event_fini() +zed_disk_event_fini(void) { /* cancel monitor thread at recvmsg() */ (void) pthread_cancel(g_mon_tid); @@ -416,13 +416,13 @@ zed_disk_event_fini() #include "zed_disk_event.h" int -zed_disk_event_init() +zed_disk_event_init(void) { return (0); } void -zed_disk_event_fini() +zed_disk_event_fini(void) { } From 38f4d99f769efbb472ab3c35558700163e4f023c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 14 Apr 2022 23:30:41 +0200 Subject: [PATCH 074/119] linux: libzfs: simplify module-loaded check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The short-path is now one access() call, we always modprobe zfs (ZFS_MODULE_LOADING which doesn't use the libzfs boolean parsing is gone), and we use a simple inotify IN_CREATE loop with a timerfd timeout rather than 10ms kernel-style polling There's one substantial difference: ZFS_MODULE_TIMEOUT=-1 now means "never give up", rather than "wait 10 minutes" Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13330 --- include/sys/fs/zfs.h | 1 + lib/libzfs/os/linux/libzfs_util_os.c | 151 +++++++++++++-------------- man/man8/zfs.8 | 20 +++- man/man8/zpool.8 | 14 +++ 4 files changed, 103 insertions(+), 83 deletions(-) diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index f9fd5cf676e2..9cd1e32cd053 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -1292,6 +1292,7 @@ typedef struct ddt_histogram { #define ZVOL_DRIVER "zvol" #define ZFS_DRIVER "zfs" #define ZFS_DEV "/dev/zfs" +#define ZFS_DEVDIR "/dev" #define ZFS_SUPER_MAGIC 0x2fc12fc1 diff --git a/lib/libzfs/os/linux/libzfs_util_os.c b/lib/libzfs/os/linux/libzfs_util_os.c index a32aa1513b39..c1443fda6697 100644 --- a/lib/libzfs/os/linux/libzfs_util_os.c +++ b/lib/libzfs/os/linux/libzfs_util_os.c @@ -20,20 +20,24 @@ */ +#include #include #include #include +#include +#include #include #include #include #include -#include -#include -#include -#include +#include #include +#include +#include +#include #include #include +#include #include #include @@ -57,7 +61,7 @@ libzfs_error_init(int error) switch (error) { case ENXIO: return (dgettext(TEXT_DOMAIN, "The ZFS modules are not " - "loaded.\nTry running '/sbin/modprobe zfs' as root " + "loaded.\nTry running 'modprobe zfs' as root " "to load them.")); case ENOENT: return (dgettext(TEXT_DOMAIN, "/dev/zfs and /proc/self/mounts " @@ -65,7 +69,7 @@ libzfs_error_init(int error) "-t proc proc /proc' as root.")); case ENOEXEC: return (dgettext(TEXT_DOMAIN, "The ZFS modules cannot be " - "auto-loaded.\nTry running '/sbin/modprobe zfs' as " + "auto-loaded.\nTry running 'modprobe zfs' as " "root to manually load them.")); case EACCES: return (dgettext(TEXT_DOMAIN, "Permission denied the " @@ -76,93 +80,80 @@ libzfs_error_init(int error) } } -static int -libzfs_module_loaded(const char *module) -{ - const char path_prefix[] = "/sys/module/"; - char path[256]; - - memcpy(path, path_prefix, sizeof (path_prefix) - 1); - strcpy(path + sizeof (path_prefix) - 1, module); - - return (access(path, F_OK) == 0); -} - /* - * Verify the required ZFS_DEV device is available and optionally attempt - * to load the ZFS modules. Under normal circumstances the modules - * should already have been loaded by some external mechanism. + * zfs(4) is loaded by udev if there's a fstype=zfs device present, + * but if there isn't, load them automatically; + * always wait for ZFS_DEV to appear via udev. * * Environment variables: - * - ZFS_MODULE_LOADING="YES|yes|ON|on" - Attempt to load modules. - * - ZFS_MODULE_TIMEOUT="" - Seconds to wait for ZFS_DEV + * - ZFS_MODULE_TIMEOUT="" - Seconds to wait for ZFS_DEV, + * defaults to 10, max. 10 min. */ -static int -libzfs_load_module_impl(const char *module) +int +libzfs_load_module(void) { - char *argv[4] = {"/sbin/modprobe", "-q", (char *)module, (char *)0}; - char *load_str, *timeout_str; - long timeout = 10; /* seconds */ - long busy_timeout = 10; /* milliseconds */ - int load = 0, fd; - hrtime_t start; - - /* Optionally request module loading */ - if (!libzfs_module_loaded(module)) { - load_str = getenv("ZFS_MODULE_LOADING"); - if (load_str) { - if (!strncasecmp(load_str, "YES", strlen("YES")) || - !strncasecmp(load_str, "ON", strlen("ON"))) - load = 1; - else - load = 0; - } + if (access(ZFS_DEV, F_OK) == 0) + return (0); - if (load) { - if (libzfs_run_process("/sbin/modprobe", argv, 0)) - return (ENOEXEC); - } + if (access(ZFS_SYSFS_DIR, F_OK) != 0) { + char *argv[] = {"modprobe", "zfs", NULL}; + if (libzfs_run_process("modprobe", argv, 0)) + return (ENOEXEC); - if (!libzfs_module_loaded(module)) + if (access(ZFS_SYSFS_DIR, F_OK) != 0) return (ENXIO); } - /* - * Device creation by udev is asynchronous and waiting may be - * required. Busy wait for 10ms and then fall back to polling every - * 10ms for the allowed timeout (default 10s, max 10m). This is - * done to optimize for the common case where the device is - * immediately available and to avoid penalizing the possible - * case where udev is slow or unable to create the device. - */ - timeout_str = getenv("ZFS_MODULE_TIMEOUT"); - if (timeout_str) { - timeout = strtol(timeout_str, NULL, 0); - timeout = MAX(MIN(timeout, (10 * 60)), 0); /* 0 <= N <= 600 */ + const char *timeout_str = getenv("ZFS_MODULE_TIMEOUT"); + int seconds = 10; + if (timeout_str) + seconds = MIN(strtol(timeout_str, NULL, 0), 600); + struct itimerspec timeout = {.it_value.tv_sec = MAX(seconds, 0)}; + + int ino = inotify_init1(IN_CLOEXEC); + if (ino == -1) + return (ENOENT); + inotify_add_watch(ino, ZFS_DEVDIR, IN_CREATE); + + if (access(ZFS_DEV, F_OK) == 0) { + close(ino); + return (0); + } else if (seconds == 0) { + close(ino); + return (ENOENT); } - start = gethrtime(); - do { - fd = open(ZFS_DEV, O_RDWR | O_CLOEXEC); - if (fd >= 0) { - (void) close(fd); - return (0); - } else if (errno != ENOENT) { - return (errno); - } else if (NSEC2MSEC(gethrtime() - start) < busy_timeout) { - sched_yield(); - } else { - usleep(10 * MILLISEC); - } - } while (NSEC2MSEC(gethrtime() - start) < (timeout * MILLISEC)); - - return (ENOENT); -} + size_t evsz = sizeof (struct inotify_event) + NAME_MAX + 1; + struct inotify_event *ev = alloca(evsz); -int -libzfs_load_module(void) -{ - return (libzfs_load_module_impl(ZFS_DRIVER)); + int tout = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); + if (tout == -1) { + close(ino); + return (ENOENT); + } + timerfd_settime(tout, 0, &timeout, NULL); + + int ret = ENOENT; + struct pollfd pfds[] = { + {.fd = ino, .events = POLLIN}, + {.fd = tout, .events = POLLIN}, + }; + while (poll(pfds, ARRAY_SIZE(pfds), -1) != -1) { + if (pfds[0].revents & POLLIN) { + verify(read(ino, ev, evsz) > + sizeof (struct inotify_event)); + if (strcmp(ev->name, &ZFS_DEV[sizeof (ZFS_DEVDIR)]) + == 0) { + ret = 0; + break; + } + } + if (pfds[1].revents & POLLIN) + break; + } + close(tout); + close(ino); + return (ret); } int diff --git a/man/man8/zfs.8 b/man/man8/zfs.8 index cac4327e0721..eaa93e0ea75c 100644 --- a/man/man8/zfs.8 +++ b/man/man8/zfs.8 @@ -736,7 +736,7 @@ Do note that any changes done with the command will be undone if the share is ever unshared (like via a reboot). . .Sh ENVIRONMENT VARIABLES -.Bl -tag -width "ZFS_MOUNT_HELPER" +.Bl -tag -width "ZFS_MODULE_TIMEOUT" .It Sy ZFS_MOUNT_HELPER Cause .Nm zfs Cm mount @@ -744,14 +744,28 @@ to use .Xr mount 8 to mount ZFS datasets. This option is provided for backwards compatibility with older ZFS versions. -.El -.Bl -tag -width "ZFS_SET_PIPE_MAX" +. .It Sy ZFS_SET_PIPE_MAX Tells .Nm zfs to set the maximum pipe size for sends/recieves. Disabled by default on Linux due to an unfixed deadlock in Linux's pipe size handling code. +. +.\" Shared with zpool.8 +.It Sy ZFS_MODULE_TIMEOUT +Time, in seconds, to wait for +.Pa /dev/zfs +to appear. +Defaults to +.Sy 10 , +max +.Sy 600 Pq 10 minutes . +If +.Pf < Sy 0 , +wait forever; if +.Sy 0 , +don't wait. .El . .Sh INTERFACE STABILITY diff --git a/man/man8/zpool.8 b/man/man8/zpool.8 index 34c816bf0342..075e31bbeb73 100644 --- a/man/man8/zpool.8 +++ b/man/man8/zpool.8 @@ -524,6 +524,20 @@ If .Sy ZPOOL_SCRIPTS_ENABLED is not set, it is assumed that the user is allowed to run .Nm zpool Cm status Ns / Ns Cm iostat Fl c . +.\" Shared with zfs.8 +.It Sy ZFS_MODULE_TIMEOUT +Time, in seconds, to wait for +.Pa /dev/zfs +to appear. +Defaults to +.Sy 10 , +max +.Sy 600 Pq 10 minutes . +If +.Pf < Sy 0 , +wait forever; if +.Sy 0 , +don't wait. .El . .Sh INTERFACE STABILITY From 2b4f2fc93c4298415c5bc70554514c3e8892e5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 15 Apr 2022 00:00:02 +0200 Subject: [PATCH 075/119] libzfs: return (allocated) strings instead of filling buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also expands the zfs version output from 127 characters to However Many Are Actually Set Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13330 --- cmd/zfs/zfs_main.c | 6 +- cmd/zpool/zpool_main.c | 6 +- include/libzfs.h | 4 +- lib/libzfs/libzfs.abi | 7024 ++++++++++++------------- lib/libzfs/libzfs_util.c | 25 +- lib/libzfs/os/freebsd/libzfs_compat.c | 24 +- lib/libzfs/os/linux/libzfs_util_os.c | 42 +- 7 files changed, 3558 insertions(+), 3573 deletions(-) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 69f5bdf4d494..6282d894638e 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -8577,11 +8577,7 @@ static int zfs_do_version(int argc, char **argv) { (void) argc, (void) argv; - - if (zfs_version_print() == -1) - return (1); - - return (0); + return (zfs_version_print() != 0); } int diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index ac4a0b23adad..598d8b1bbb65 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -10818,11 +10818,7 @@ static int zpool_do_version(int argc, char **argv) { (void) argc, (void) argv; - - if (zfs_version_print() == -1) - return (1); - - return (0); + return (zfs_version_print() != 0); } /* diff --git a/include/libzfs.h b/include/libzfs.h index 46cb60520160..2c2aa3faf14b 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -914,8 +914,8 @@ _LIBZFS_H int libzfs_envvar_is_set(char *); /* * Utility functions for zfs version */ -_LIBZFS_H void zfs_version_userland(char *, int); -_LIBZFS_H int zfs_version_kernel(char *, int); +_LIBZFS_H const char *zfs_version_userland(void); +_LIBZFS_H char *zfs_version_kernel(void); _LIBZFS_H int zfs_version_print(void); /* diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 1c7695275f56..8a71da95148e 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -590,110 +590,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -835,7 +732,7 @@ - + @@ -877,7 +774,7 @@ - + @@ -936,10 +833,10 @@ - + - + @@ -953,7 +850,7 @@ - + @@ -1291,12 +1188,12 @@ - + - + @@ -1407,7 +1304,7 @@ - + @@ -1415,12 +1312,12 @@ - + - + @@ -1639,18 +1536,18 @@ - + - + - + @@ -1658,7 +1555,7 @@ - + @@ -1666,13 +1563,13 @@ - + - + @@ -1684,6 +1581,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1758,75 +1724,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1878,3954 +1775,4053 @@ - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - + - + - + - + - - + + + + - - + + - - + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + - + + + + - + + + + - + + + + + + + - + - - - - - + - + - - - - + - - + + + + + + + - + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + - - - - - - + + + - - - + + + - - - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + - - - - - + + + + + + - - - - - - + + + + - - - - + + + + - - - - + + - - + + + + + - - - - - - - - - - - - - - - - - - + + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + - - - - - - - - - - + + + - - - + + + - - - + + + - - + + - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + + - - - + + + + + - - - - + + + + + + - - - + + + + - - + + + - - - - - - - + + + + + + + + + + - - - - + + + + + - - + + + + - + + - - - - - + + - - - + + + + + - - - + + + + + + + - - - + + + - - - + + + + + + + + + + - - + + + - - - + + + + + + + + - - - + + + + + - - - - + + + + + + - - - - + + + + - - - - + + + + + + + - - + + - - + + - - - - - - + + + - - + + + - - - + + + + + - - + + + + - - - - - - - + + + + - - - + + + + + + - - - + + + + - - - + + + + + - - - - + + + + - - - - + + + + - - - + + + - - - - + + + + + - - - + + + + + + - - - + + + + + - - - + + + + + - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - + + + - - - - - - - - - - - + + + - - - - - - - - - - - + + + + + + - - - - - - - - - + + + - - - - - - + + + + + - - - + + + + + - - - - - + + + + - - - - - + + + + + + - - - - - + + + + + + - - - - + + + + + + + - - - - - + + + + + - - + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - + + - - + + - - + + + + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - + + + + - - - - - - - - - - + + + - - - - + + + - - - - - - - + + + + + + + - - + + - + - - - - - + + + + - - - - + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - + - - + + - + - - - - - - - - - - - - - - - + + - - - - - + + + - - - - - + + + - - + + - - - - - + + + - + - - + + + - - - - - - - - - - + + + - - - - - - - + + + - - - + + + - - - - - + + + - - - - + + + + + - - - - - + + + - + - - - - + + + + - + - - + + + - + + + + + - - - - + + + + - - - - - + + + + - - - - - - + + + + - - - - + + + + + - - - - - + + + + - - - - + + + + + + + - - - - - + + + + + + + - - - + + + + - - - - + + + - - - - - + + + + + - - - - - + + + + - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - + + + + + + + - - - - - + + + - - - - - - - - - - - - + + + + + + + - - - - - - - + + + - - - - + + - - - - - - + + + + - - - - - + + + + - - - - + + + - - - - + + + + + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - + + + + - - - - + + + - - - - - + + + + + + + + + + - - - - + + + + + - - - + + + + + + - - - + + + - - - - - + + + + + - - + + + + + + - - - - + + + + + + + + + + + - - - + + + + + - - - - + + + + - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + - - + + + + + + + - + - + + - - - - - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - + - + - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + - - + + - - - + + + + + - - - - - - - + + + + + + + + + - - - - + + + + + + - - - - - + + + + + + - - - - - + + + + - - - - - + + - + + + + - + + + + + + + + + + + + - + - - + + + - - + + + + + + + + - - - + + + + + - - + + + + + - - - + + + - - - - - - + + + + + + - - - + + + + - - + + + + + + + + + + + - - + + + + + + + + + + + + + + + - - - + + + + + + + + - + - - + - - - - + + + - + + + + - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + - - + + + + + - - + - - + - - + - - - - - - - + - - - + + + - - - - + + + - - - - + + + - - - - - + + - - - - + + + - - - + + + + + + + + + - - - - - - + + + - - - + + + + - - - - - + + + + - - - - - - + + + - - - - + + + - - - - - + + + + + + + - - - - - - - + + + - - - - - + + + - - - - - - - - - - + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + - - - - + + - - - - + + + - - - - - + + - - - - + + - - - - - + + + + + + + + + + + - - - - - - + + + + + - - + + + + + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - + - - - - + - - - - + - + - + - - - - + - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - + + + - - - - - + + + - - - - - + + + - - - - - - - - - - + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + - - - + + - + - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + - - - + + + - - - + + - + + + + + + + + + + + + + + + + + + + - - - - - - + + - - + + - + - + - + + + + - - + + + + + - + - - + + - - + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + - - + + + + + - - - - - - + + + + - - - + + + + + - + + - - + + + + + - + + + + - - - - + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + - + + + + - - - - + + + - - - + + + + + - - - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - + - + + - + - + + + + - + - + - + - - + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - - - - + + - - + + - - + + - - + + - - - - - - - + + + + + + + + - - - + + - - - - + + + - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + + + + + - - + + - - - + + + + - - + + + + + + + + + + + + + + - - - - - - - - - + + + - - - + + - - - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - + + + + - - - - - - + + - - - + + + - + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - + + + - - - - - - - + + + - - - - - - - - - - - - + + - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + - - - - + + + + + + + + + + - - - - + + + + + + + + + + - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index c47a5782c8fb..1c067e214800 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1910,37 +1910,30 @@ zprop_iter(zprop_func func, void *cb, boolean_t show_all, boolean_t ordered, return (zprop_iter_common(func, cb, show_all, ordered, type)); } -/* - * Fill given version buffer with zfs userland version - */ -void -zfs_version_userland(char *version, int len) +const char * +zfs_version_userland(void) { - (void) strlcpy(version, ZFS_META_ALIAS, len); + return (ZFS_META_ALIAS); } /* * Prints both zfs userland and kernel versions - * Returns 0 on success, and -1 on error (with errno set) + * Returns 0 on success, and -1 on error */ int zfs_version_print(void) { - char zver_userland[128]; - char zver_kernel[128]; + (void) puts(ZFS_META_ALIAS); - zfs_version_userland(zver_userland, sizeof (zver_userland)); - - (void) printf("%s\n", zver_userland); - - if (zfs_version_kernel(zver_kernel, sizeof (zver_kernel)) == -1) { + char *kver = zfs_version_kernel(); + if (kver == NULL) { fprintf(stderr, "zfs_version_kernel() failed: %s\n", strerror(errno)); return (-1); } - (void) printf("zfs-kmod-%s\n", zver_kernel); - + (void) printf("zfs-kmod-%s\n", kver); + free(kver); return (0); } diff --git a/lib/libzfs/os/freebsd/libzfs_compat.c b/lib/libzfs/os/freebsd/libzfs_compat.c index d2bc6ddfc23a..289c6703c2dd 100644 --- a/lib/libzfs/os/freebsd/libzfs_compat.c +++ b/lib/libzfs/os/freebsd/libzfs_compat.c @@ -351,14 +351,22 @@ zpool_nextboot(libzfs_handle_t *hdl, uint64_t pool_guid, uint64_t dev_guid, } /* - * Fill given version buffer with zfs kernel version. - * Returns 0 on success, and -1 on error (with errno set) + * Return allocated loaded module version, or NULL on error (with errno set) */ -int -zfs_version_kernel(char *version, int len) +char * +zfs_version_kernel(void) { - size_t l = len; - - return (sysctlbyname("vfs.zfs.version.module", - version, &l, NULL, 0)); + size_t l; + if (sysctlbyname("vfs.zfs.version.module", + NULL, &l, NULL, 0) == -1) + return (NULL); + char *version = malloc(l); + if (version == NULL) + return (NULL); + if (sysctlbyname("vfs.zfs.version.module", + version, &l, NULL, 0) == -1) { + free(version); + return (NULL); + } + return (version); } diff --git a/lib/libzfs/os/linux/libzfs_util_os.c b/lib/libzfs/os/linux/libzfs_util_os.c index c1443fda6697..9d6f574a5546 100644 --- a/lib/libzfs/os/linux/libzfs_util_os.c +++ b/lib/libzfs/os/linux/libzfs_util_os.c @@ -183,31 +183,27 @@ zfs_destroy_snaps_nvl_os(libzfs_handle_t *hdl, nvlist_t *snaps) } /* - * Fill given version buffer with zfs kernel version read from ZFS_SYSFS_DIR - * Returns 0 on success, and -1 on error (with errno set) + * Return allocated loaded module version, or NULL on error (with errno set) */ -int -zfs_version_kernel(char *version, int len) +char * +zfs_version_kernel(void) { - int _errno; - int fd; - int rlen; - - if ((fd = open(ZFS_SYSFS_DIR "/version", O_RDONLY | O_CLOEXEC)) == -1) - return (-1); - - if ((rlen = read(fd, version, len)) == -1) { - version[0] = '\0'; - _errno = errno; - (void) close(fd); - errno = _errno; - return (-1); + FILE *f = fopen(ZFS_SYSFS_DIR "/version", "re"); + if (f == NULL) + return (NULL); + + char *ret = NULL; + size_t l; + ssize_t read; + if ((read = getline(&ret, &l, f)) == -1) { + int err = errno; + fclose(f); + errno = err; + return (NULL); } - version[rlen-1] = '\0'; /* discard '\n' */ - - if (close(fd) == -1) - return (-1); - - return (0); + fclose(f); + if (ret[read - 1] == '\n') + ret[read - 1] = '\0'; + return (ret); } From e02d84d3a5158a942c3f09d11c973e5aabb6fa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 19 May 2022 00:56:38 +0200 Subject: [PATCH 076/119] linux: libshare: smb: don't swallow net(1) errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13191 Closes #13470 --- lib/libshare/os/linux/smb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libshare/os/linux/smb.c b/lib/libshare/os/linux/smb.c index 2a2b32bc10e9..57965ebfaad1 100644 --- a/lib/libshare/os/linux/smb.c +++ b/lib/libshare/os/linux/smb.c @@ -248,7 +248,7 @@ smb_enable_share_one(const char *sharename, const char *sharepath) NULL, }; - if (libzfs_run_process(argv[0], argv, 0) < 0) + if (libzfs_run_process(argv[0], argv, 0) != 0) return (SA_SYSTEM_ERR); /* Reload the share file */ @@ -297,7 +297,7 @@ smb_disable_share_one(const char *sharename) NULL, }; - if (libzfs_run_process(argv[0], argv, 0) < 0) + if (libzfs_run_process(argv[0], argv, 0) != 0) return (SA_SYSTEM_ERR); else return (SA_OK); From 03df6bad94504b80929b332a3e5fbfbc8bdae04b Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 20 May 2022 13:32:49 -0400 Subject: [PATCH 077/119] zdb: Fix handling of nul termination in symlink targets The SA attribute containing the symlink target does not include a nul terminator, so when printing the target zdb would sometimes include garbage at the end of the string. Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Mark Johnston Closes #13482 --- cmd/zdb/zdb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 3d4d956e5698..ce95759dc708 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -3194,13 +3194,18 @@ dump_znode_symlink(sa_handle_t *hdl) { int sa_symlink_size = 0; char linktarget[MAXPATHLEN]; - linktarget[0] = '\0'; int error; error = sa_size(hdl, sa_attr_table[ZPL_SYMLINK], &sa_symlink_size); if (error || sa_symlink_size == 0) { return; } + if (sa_symlink_size >= sizeof (linktarget)) { + (void) printf("symlink size %d is too large\n", + sa_symlink_size); + return; + } + linktarget[sa_symlink_size] = '\0'; if (sa_lookup(hdl, sa_attr_table[ZPL_SYMLINK], &linktarget, sa_symlink_size) == 0) (void) printf("\ttarget %s\n", linktarget); From 2cd0f98f4aae7110a48cb0623e1e3d66b9f58785 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 20 May 2022 10:36:14 -0700 Subject: [PATCH 078/119] Verify BPs in spa_load_verify_cb() and dsl_scan_visitbp() We want `zpool import` to be highly robust and never panic, even when encountering corrupt metadata. This is already handled in the arc_read() code path, which covers most cases, but spa_load_verify_cb() relies on zio_read() and is responsible for verifying the block pointer. During import it is also possible to encounter blocks pointers which contain ZIO_COMPRESS_INHERIT and ZIO_CHECKSUM_INHERIT values. Relax the verification function slightly to allow this. Futhermore, extend dsl_scan_recurse() to verify the block pointer contents of level zero blocks which are not of type DMU_OT_DNODE or DMU_OT_OBJSET. This is handled by arc_read() in the other cases. Reviewed-by: Paul Dagnelie Signed-off-by: Brian Behlendorf Closes #13124 Closes #13360 --- module/zfs/dsl_scan.c | 30 +++++++++++++----------------- module/zfs/spa.c | 19 ++++++++++++++++--- module/zfs/zio.c | 6 ++---- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c index dedf9c8a669a..89448f0ecea2 100644 --- a/module/zfs/dsl_scan.c +++ b/module/zfs/dsl_scan.c @@ -1824,6 +1824,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, const zbookmark_phys_t *zb, dmu_tx_t *tx) { dsl_pool_t *dp = scn->scn_dp; + spa_t *spa = dp->dp_spa; int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD; int err; @@ -1838,7 +1839,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, if (dnp != NULL && dnp->dn_bonuslen > DN_MAX_BONUS_LEN(dnp)) { scn->scn_phys.scn_errors++; - spa_log_error(dp->dp_spa, zb); + spa_log_error(spa, zb); return (SET_ERROR(EINVAL)); } @@ -1849,7 +1850,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT; arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, + err = arc_read(NULL, spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_SCRUB, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; @@ -1877,7 +1878,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, zio_flags |= ZIO_FLAG_RAW; } - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, + err = arc_read(NULL, spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_SCRUB, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; @@ -1896,7 +1897,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, objset_phys_t *osp; arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, + err = arc_read(NULL, spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_SCRUB, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; @@ -1927,6 +1928,14 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, DMU_USERUSED_OBJECT, tx); } arc_buf_destroy(buf, &buf); + } else if (!zfs_blkptr_verify(spa, bp, B_FALSE, BLK_VERIFY_LOG)) { + /* + * Sanity check the block pointer contents, this is handled + * by arc_read() for the cases above. + */ + scn->scn_phys.scn_errors++; + spa_log_error(spa, zb); + return (SET_ERROR(EINVAL)); } return (0); @@ -1977,19 +1986,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb, scn->scn_visited_this_txg++; - /* - * This debugging is commented out to conserve stack space. This - * function is called recursively and the debugging adds several - * bytes to the stack for each call. It can be commented back in - * if required to debug an issue in dsl_scan_visitbp(). - * - * dprintf_bp(bp, - * "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx bp=%p", - * ds, ds ? ds->ds_object : 0, - * zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid, - * bp); - */ - if (BP_IS_HOLE(bp)) { scn->scn_holes_this_txg++; return; diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 01114dedef48..baa5fc24761d 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -2310,9 +2310,6 @@ spa_load_verify_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, (void) zilog, (void) dnp; - if (zb->zb_level == ZB_DNODE_LEVEL || BP_IS_HOLE(bp) || - BP_IS_EMBEDDED(bp) || BP_IS_REDACTED(bp)) - return (0); /* * Note: normally this routine will not be called if * spa_load_verify_metadata is not set. However, it may be useful @@ -2320,6 +2317,22 @@ spa_load_verify_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, */ if (!spa_load_verify_metadata) return (0); + + /* + * Sanity check the block pointer in order to detect obvious damage + * before using the contents in subsequent checks or in zio_read(). + * When damaged consider it to be a metadata error since we cannot + * trust the BP_GET_TYPE and BP_GET_LEVEL values. + */ + if (!zfs_blkptr_verify(spa, bp, B_FALSE, BLK_VERIFY_LOG)) { + atomic_inc_64(&sle->sle_meta_count); + return (0); + } + + if (zb->zb_level == ZB_DNODE_LEVEL || BP_IS_HOLE(bp) || + BP_IS_EMBEDDED(bp) || BP_IS_REDACTED(bp)) + return (0); + if (!BP_IS_METADATA(bp) && (!spa_load_verify_data || !sle->sle_verify_data)) return (0); diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 2a16d5cef2e2..ae99f1e6450d 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -962,14 +962,12 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp, boolean_t config_held, "blkptr at %p has invalid TYPE %llu", bp, (longlong_t)BP_GET_TYPE(bp)); } - if (BP_GET_CHECKSUM(bp) >= ZIO_CHECKSUM_FUNCTIONS || - BP_GET_CHECKSUM(bp) <= ZIO_CHECKSUM_ON) { + if (BP_GET_CHECKSUM(bp) >= ZIO_CHECKSUM_FUNCTIONS) { errors += zfs_blkptr_verify_log(spa, bp, blk_verify, "blkptr at %p has invalid CHECKSUM %llu", bp, (longlong_t)BP_GET_CHECKSUM(bp)); } - if (BP_GET_COMPRESS(bp) >= ZIO_COMPRESS_FUNCTIONS || - BP_GET_COMPRESS(bp) <= ZIO_COMPRESS_ON) { + if (BP_GET_COMPRESS(bp) >= ZIO_COMPRESS_FUNCTIONS) { errors += zfs_blkptr_verify_log(spa, bp, blk_verify, "blkptr at %p has invalid COMPRESS %llu", bp, (longlong_t)BP_GET_COMPRESS(bp)); From cf70c0f8ae01c24699767b5ecfbe1882c009d53a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 24 May 2022 09:36:07 -0700 Subject: [PATCH 079/119] zed: Take no action on scrub/resilver checksum errors When scrubbing/resilvering a pool it can be counter productive to cancel the scan and kick of a replace operation to a hot spare when encountering checksum errors. In this case, the best course of action is to allow the scrub/resilver to complete as quickly as possible and to keep the vdevs fully online if possible. Realistically, this is less of an issue for a RAIDZ since a traditional resilver must be used and checksums will be verified. However, this is not the case for a mirror or dRAID pool which is sequentially resilvered and checksum verification is deferred until after the replace operation completes. Regardless, we apply this policy to all pool types since it's a good idea for all vdevs. Degrading additional vdevs has the potential to make a bad situation worse. Note the checksum errors will still be reported as both an event and by `zpool status`. This change only prevents the ZED from proactively taking any action. Reviewed-by: Tony Hutter Reviewed-by: Tony Nguyen Signed-off-by: Brian Behlendorf Closes #13499 --- cmd/zed/agents/zfs_diagnosis.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cmd/zed/agents/zfs_diagnosis.c b/cmd/zed/agents/zfs_diagnosis.c index 4fe9ee2bc5b2..813916d2e82c 100644 --- a/cmd/zed/agents/zfs_diagnosis.c +++ b/cmd/zed/agents/zfs_diagnosis.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "zfs_agents.h" #include "fmd_api.h" @@ -770,6 +771,8 @@ zfs_fm_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class) ZFS_MAKE_EREPORT(FM_EREPORT_ZFS_PROBE_FAILURE))) { char *failmode = NULL; boolean_t checkremove = B_FALSE; + uint32_t pri = 0; + int32_t flags = 0; /* * If this is a checksum or I/O error, then toss it into the @@ -792,6 +795,23 @@ zfs_fm_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class) checkremove = B_TRUE; } else if (fmd_nvl_class_match(hdl, nvl, ZFS_MAKE_EREPORT(FM_EREPORT_ZFS_CHECKSUM))) { + /* + * We ignore ereports for checksum errors generated by + * scrub/resilver I/O to avoid potentially further + * degrading the pool while it's being repaired. + */ + if (((nvlist_lookup_uint32(nvl, + FM_EREPORT_PAYLOAD_ZFS_ZIO_PRIORITY, &pri) == 0) && + (pri == ZIO_PRIORITY_SCRUB || + pri == ZIO_PRIORITY_REBUILD)) || + ((nvlist_lookup_int32(nvl, + FM_EREPORT_PAYLOAD_ZFS_ZIO_FLAGS, &flags) == 0) && + (flags & (ZIO_FLAG_SCRUB | ZIO_FLAG_RESILVER)))) { + fmd_hdl_debug(hdl, "ignoring '%s' for " + "scrub/resilver I/O", class); + return; + } + if (zcp->zc_data.zc_serd_checksum[0] == '\0') { zfs_serd_name(zcp->zc_data.zc_serd_checksum, pool_guid, vdev_guid, "checksum"); From 3c356622994f1837f42a0d4bcd6558a3b3749521 Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Tue, 24 May 2022 12:39:32 -0400 Subject: [PATCH 080/119] Modified ncompress requirement in RPM to exclude RHEL9 The bug this was working around is no longer present. Reviewed-by: Brian Behlendorf Signed-off-by: Rich Ercolani Closes #13480 Closes #13490 --- rpm/generic/zfs-dkms.spec.in | 2 +- rpm/generic/zfs-kmod.spec.in | 2 +- rpm/generic/zfs.spec.in | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rpm/generic/zfs-dkms.spec.in b/rpm/generic/zfs-dkms.spec.in index cd0a3ded2a00..d0cf38caa193 100644 --- a/rpm/generic/zfs-dkms.spec.in +++ b/rpm/generic/zfs-dkms.spec.in @@ -36,7 +36,7 @@ Obsoletes: spl-dkms Provides: %{module}-kmod = %{version} AutoReqProv: no -%if 0%{?rhel}%{?fedora}%{?suse_version} +%if (0%{?fedora}%{?suse_version}) || (0 < 0%{?rhel} && 0%{?rhel} < 9) # We don't directly use it, but if this isn't installed, rpmbuild as root can # crash+corrupt rpmdb # See issue #12071 diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in index 79fe2753c1e8..c25d968d1c94 100644 --- a/rpm/generic/zfs-kmod.spec.in +++ b/rpm/generic/zfs-kmod.spec.in @@ -57,7 +57,7 @@ BuildRequires: gcc, make BuildRequires: elfutils-libelf-devel %endif -%if 0%{?rhel}%{?fedora}%{?suse_version} +%if (0%{?fedora}%{?suse_version}) || (0 < 0%{?rhel} && 0%{?rhel} < 9) # We don't directly use it, but if this isn't installed, rpmbuild as root can # crash+corrupt rpmdb # See issue #12071 diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index 0a29601639c3..8cf702c70e6b 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -110,12 +110,15 @@ BuildRequires: libblkid-devel BuildRequires: libudev-devel BuildRequires: libattr-devel BuildRequires: openssl-devel +%if 0%{?fedora} || 0%{?rhel} >= 8 || 0%{?centos} >= 8 +BuildRequires: libtirpc-devel +%endif + +%if (0%{?fedora}%{?suse_version}) || (0 < 0%{?rhel} && 0%{?rhel} < 9) # We don't directly use it, but if this isn't installed, rpmbuild as root can # crash+corrupt rpmdb # See issue #12071 BuildRequires: ncompress -%if 0%{?fedora} || 0%{?rhel} >= 8 || 0%{?centos} >= 8 -BuildRequires: libtirpc-devel %endif Requires: openssl From 2e05765006913b0c381fdbbbf0370b35c0e61be4 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Tue, 24 May 2022 12:40:20 -0400 Subject: [PATCH 081/119] FreeBSD: libspl: Add locking around statfs globals Makes getmntent and getmntany thread-safe for external consumers of libzfs zpool_disable_datasets, zfs_iter_mounted, libzfs_mnttab_update, libzfs_mnttab_find. Reviewed-by: Alexander Motin Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #13484 --- lib/libspl/os/freebsd/mnttab.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/libspl/os/freebsd/mnttab.c b/lib/libspl/os/freebsd/mnttab.c index d830257fbd16..a240ca70ba8d 100644 --- a/lib/libspl/os/freebsd/mnttab.c +++ b/lib/libspl/os/freebsd/mnttab.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -136,6 +137,7 @@ statfs2mnttab(struct statfs *sfs, struct mnttab *mp) mp->mnt_mntopts = gmntopts; } +static pthread_rwlock_t gsfs_lock = PTHREAD_RWLOCK_INITIALIZER; static struct statfs *gsfs = NULL; static int allfs = 0; @@ -145,6 +147,8 @@ statfs_init(void) struct statfs *sfs; int error; + (void) pthread_rwlock_wrlock(&gsfs_lock); + if (gsfs != NULL) { free(gsfs); gsfs = NULL; @@ -162,6 +166,7 @@ statfs_init(void) sfs = realloc(gsfs, allfs * sizeof (gsfs[0])); if (sfs != NULL) gsfs = sfs; + (void) pthread_rwlock_unlock(&gsfs_lock); return (0); fail: error = errno; @@ -169,6 +174,7 @@ statfs_init(void) free(gsfs); gsfs = NULL; allfs = 0; + (void) pthread_rwlock_unlock(&gsfs_lock); return (error); } @@ -181,6 +187,8 @@ getmntany(FILE *fd __unused, struct mnttab *mgetp, struct mnttab *mrefp) if (error != 0) return (error); + (void) pthread_rwlock_rdlock(&gsfs_lock); + for (i = 0; i < allfs; i++) { if (mrefp->mnt_special != NULL && strcmp(mrefp->mnt_special, gsfs[i].f_mntfromname) != 0) { @@ -195,8 +203,10 @@ getmntany(FILE *fd __unused, struct mnttab *mgetp, struct mnttab *mrefp) continue; } statfs2mnttab(&gsfs[i], mgetp); + (void) pthread_rwlock_unlock(&gsfs_lock); return (0); } + (void) pthread_rwlock_unlock(&gsfs_lock); return (-1); } @@ -214,9 +224,13 @@ getmntent(FILE *fp, struct mnttab *mp) if (error != 0) return (error); } - if (nfs >= allfs) + (void) pthread_rwlock_rdlock(&gsfs_lock); + if (nfs >= allfs) { + (void) pthread_rwlock_unlock(&gsfs_lock); return (-1); + } statfs2mnttab(&gsfs[nfs], mp); + (void) pthread_rwlock_unlock(&gsfs_lock); if (lseek(fileno(fp), 1, SEEK_CUR) == -1) return (errno); return (0); From f375b23c026aec00cc9527470084191b5071d9b2 Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Tue, 24 May 2022 12:43:22 -0400 Subject: [PATCH 082/119] Tiered early abort, zstd edition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It turns out that "do LZ4 and zstd-1 both fail" is a great heuristic for "don't even bother trying higher zstd tiers". By way of illustration: $ cat /incompress | mbuffer | zfs recv -o compression=zstd-12 evenfaster/lowcomp_1M_zstd12_normal summary: 39.8 GiByte in 3min 40.2sec - average of 185 MiB/s $ echo 3 | sudo tee /sys/module/zzstd/parameters/zstd_lz4_pass 3 $ cat /incompress | mbuffer -m 4G | zfs recv -o compression=zstd-12 evenfaster/lowcomp_1M_zstd12_patched summary: 39.8 GiByte in 48.6sec - average of 839 MiB/s $ sudo zfs list -p -o name,used,lused,ratio evenfaster/lowcomp_1M_zstd12_normal evenfaster/lowcomp_1M_zstd12_patched NAME USED LUSED RATIO evenfaster/lowcomp_1M_zstd12_normal 39549931520 42721221632 1.08 evenfaster/lowcomp_1M_zstd12_patched 39626399744 42721217536 1.07 $ python3 -c "print(39626399744 - 39549931520)" 76468224 $ I'll take 76 MB out of 42 GB for > 4x speedup. Reviewed-by: Allan Jude Reviewed-by: Brian Behlendorf Reviewed-by: George Melikov Reviewed-by: Kjeld Schouten Reviewed-by: Ahelenia Ziemiańska Signed-off-by: Rich Ercolani Closes #13244 --- include/sys/zstd/zstd.h | 4 ++ man/man4/zfs.4 | 8 +++ module/zfs/zio_compress.c | 2 +- module/zstd/zfs_zstd.c | 126 ++++++++++++++++++++++++++++++++++++-- 4 files changed, 134 insertions(+), 6 deletions(-) diff --git a/include/sys/zstd/zstd.h b/include/sys/zstd/zstd.h index ca32a7464556..ec2341b76930 100644 --- a/include/sys/zstd/zstd.h +++ b/include/sys/zstd/zstd.h @@ -78,6 +78,8 @@ typedef struct zfs_zstd_meta { * kstat helper macros */ #define ZSTDSTAT(stat) (zstd_stats.stat.value.ui64) +#define ZSTDSTAT_ZERO(stat) \ + (atomic_store_64(&zstd_stats.stat.value.ui64, 0)) #define ZSTDSTAT_ADD(stat, val) \ atomic_add_64(&zstd_stats.stat.value.ui64, (val)) #define ZSTDSTAT_SUB(stat, val) \ @@ -90,6 +92,8 @@ void zstd_fini(void); size_t zfs_zstd_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int level); +size_t zfs_zstd_compress_wrap(void *s_start, void *d_start, size_t s_len, + size_t d_len, int level); int zfs_zstd_get_level(void *s_start, size_t s_len, uint8_t *level); int zfs_zstd_decompress_level(void *s_start, void *d_start, size_t s_len, size_t d_len, uint8_t *level); diff --git a/man/man4/zfs.4 b/man/man4/zfs.4 index 5ef517c46faa..c95fa98c5fd4 100644 --- a/man/man4/zfs.4 +++ b/man/man4/zfs.4 @@ -2129,6 +2129,14 @@ However, if there are fewer than metaslabs in the vdev, this functionality is disabled. This ensures that we don't set aside an unreasonable amount of space for the ZIL. . +.It Sy zfs_zstd_earlyabort_pass Ns = Ns Sy 1 Pq int +Whether heuristic for detection of incompressible data with zstd levels >= 3 +using LZ4 and zstd-1 passes is enabled. +. +.It Sy zfs_zstd_abort_size Ns = Ns Sy 131072 Pq int +Minimal uncompressed size (inclusive) of a record before the early abort +heuristic will be attempted. +. .It Sy zio_deadman_log_all Ns = Ns Sy 0 Ns | Ns 1 Pq int If non-zero, the zio deadman will produce debugging messages .Pq see Sy zfs_dbgmsg_enable diff --git a/module/zfs/zio_compress.c b/module/zfs/zio_compress.c index cded11f4cbd5..38020ce220b1 100644 --- a/module/zfs/zio_compress.c +++ b/module/zfs/zio_compress.c @@ -66,7 +66,7 @@ zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = { {"gzip-9", 9, gzip_compress, gzip_decompress, NULL}, {"zle", 64, zle_compress, zle_decompress, NULL}, {"lz4", 0, lz4_compress_zfs, lz4_decompress_zfs, NULL}, - {"zstd", ZIO_ZSTD_LEVEL_DEFAULT, zfs_zstd_compress, + {"zstd", ZIO_ZSTD_LEVEL_DEFAULT, zfs_zstd_compress_wrap, zfs_zstd_decompress, zfs_zstd_decompress_level}, }; diff --git a/module/zstd/zfs_zstd.c b/module/zstd/zfs_zstd.c index 04e52ae3cec6..41351898981a 100644 --- a/module/zstd/zfs_zstd.c +++ b/module/zstd/zfs_zstd.c @@ -50,6 +50,10 @@ #include "lib/zstd.h" #include "lib/common/zstd_errors.h" +static int zstd_earlyabort_pass = 1; +static int zstd_cutoff_level = ZIO_ZSTD_LEVEL_3; +static unsigned int zstd_abort_size = (128 * 1024); + static kstat_t *zstd_ksp = NULL; typedef struct zstd_stats { @@ -62,6 +66,21 @@ typedef struct zstd_stats { kstat_named_t zstd_stat_dec_header_inval; kstat_named_t zstd_stat_com_fail; kstat_named_t zstd_stat_dec_fail; + /* + * LZ4 first-pass early abort verdict + */ + kstat_named_t zstd_stat_lz4pass_allowed; + kstat_named_t zstd_stat_lz4pass_rejected; + /* + * zstd-1 second-pass early abort verdict + */ + kstat_named_t zstd_stat_zstdpass_allowed; + kstat_named_t zstd_stat_zstdpass_rejected; + /* + * We excluded this from early abort for some reason + */ + kstat_named_t zstd_stat_passignored; + kstat_named_t zstd_stat_passignored_size; kstat_named_t zstd_stat_buffers; kstat_named_t zstd_stat_size; } zstd_stats_t; @@ -76,10 +95,44 @@ static zstd_stats_t zstd_stats = { { "decompress_header_invalid", KSTAT_DATA_UINT64 }, { "compress_failed", KSTAT_DATA_UINT64 }, { "decompress_failed", KSTAT_DATA_UINT64 }, + { "lz4pass_allowed", KSTAT_DATA_UINT64 }, + { "lz4pass_rejected", KSTAT_DATA_UINT64 }, + { "zstdpass_allowed", KSTAT_DATA_UINT64 }, + { "zstdpass_rejected", KSTAT_DATA_UINT64 }, + { "passignored", KSTAT_DATA_UINT64 }, + { "passignored_size", KSTAT_DATA_UINT64 }, { "buffers", KSTAT_DATA_UINT64 }, { "size", KSTAT_DATA_UINT64 }, }; +#ifdef _KERNEL +static int +kstat_zstd_update(kstat_t *ksp, int rw) +{ + ASSERT(ksp != NULL); + + if (rw == KSTAT_WRITE && ksp == zstd_ksp) { + ZSTDSTAT_ZERO(zstd_stat_alloc_fail); + ZSTDSTAT_ZERO(zstd_stat_alloc_fallback); + ZSTDSTAT_ZERO(zstd_stat_com_alloc_fail); + ZSTDSTAT_ZERO(zstd_stat_dec_alloc_fail); + ZSTDSTAT_ZERO(zstd_stat_com_inval); + ZSTDSTAT_ZERO(zstd_stat_dec_inval); + ZSTDSTAT_ZERO(zstd_stat_dec_header_inval); + ZSTDSTAT_ZERO(zstd_stat_com_fail); + ZSTDSTAT_ZERO(zstd_stat_dec_fail); + ZSTDSTAT_ZERO(zstd_stat_lz4pass_allowed); + ZSTDSTAT_ZERO(zstd_stat_lz4pass_rejected); + ZSTDSTAT_ZERO(zstd_stat_zstdpass_allowed); + ZSTDSTAT_ZERO(zstd_stat_zstdpass_rejected); + ZSTDSTAT_ZERO(zstd_stat_passignored); + ZSTDSTAT_ZERO(zstd_stat_passignored_size); + } + + return (0); +} +#endif + /* Enums describing the allocator type specified by kmem_type in zstd_kmem */ enum zstd_kmem_type { ZSTD_KMEM_UNKNOWN = 0, @@ -377,6 +430,64 @@ zstd_enum_to_level(enum zio_zstd_levels level, int16_t *zstd_level) } +size_t +zfs_zstd_compress_wrap(void *s_start, void *d_start, size_t s_len, size_t d_len, + int level) +{ + int16_t zstd_level; + if (zstd_enum_to_level(level, &zstd_level)) { + ZSTDSTAT_BUMP(zstd_stat_com_inval); + return (s_len); + } + /* + * A zstd early abort heuristic. + * + * - Zeroth, if this is <= zstd-3, or < zstd_abort_size (currently + * 128k), don't try any of this, just go. + * (because experimentally that was a reasonable cutoff for a perf win + * with tiny ratio change) + * - First, we try LZ4 compression, and if it doesn't early abort, we + * jump directly to whatever compression level we intended to try. + * - Second, we try zstd-1 - if that errors out (usually, but not + * exclusively, if it would overflow), we give up early. + * + * If it works, instead we go on and compress anyway. + * + * Why two passes? LZ4 alone gets you a lot of the way, but on highly + * compressible data, it was losing up to 8.5% of the compressed + * savings versus no early abort, and all the zstd-fast levels are + * worse indications on their own than LZ4, and don't improve the LZ4 + * pass noticably if stacked like this. + */ + size_t actual_abort_size = zstd_abort_size; + if (zstd_earlyabort_pass > 0 && zstd_level >= zstd_cutoff_level && + s_len >= actual_abort_size) { + int pass_len = 1; + pass_len = lz4_compress_zfs(s_start, d_start, s_len, d_len, 0); + if (pass_len < d_len) { + ZSTDSTAT_BUMP(zstd_stat_lz4pass_allowed); + goto keep_trying; + } + ZSTDSTAT_BUMP(zstd_stat_lz4pass_rejected); + + pass_len = zfs_zstd_compress(s_start, d_start, s_len, d_len, + ZIO_ZSTD_LEVEL_1); + if (pass_len == s_len || pass_len <= 0 || pass_len > d_len) { + ZSTDSTAT_BUMP(zstd_stat_zstdpass_rejected); + return (s_len); + } + ZSTDSTAT_BUMP(zstd_stat_zstdpass_allowed); + } else { + ZSTDSTAT_BUMP(zstd_stat_passignored); + if (s_len < actual_abort_size) { + ZSTDSTAT_BUMP(zstd_stat_passignored_size); + } + } +keep_trying: + return (zfs_zstd_compress(s_start, d_start, s_len, d_len, level)); + +} + /* Compress block using zstd */ size_t zfs_zstd_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, @@ -437,8 +548,10 @@ zfs_zstd_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, * too small, that is not a failure. Everything else is a * failure, so increment the compression failure counter. */ - if (ZSTD_getErrorCode(c_len) != ZSTD_error_dstSize_tooSmall) { + int err = ZSTD_getErrorCode(c_len); + if (err != ZSTD_error_dstSize_tooSmall) { ZSTDSTAT_BUMP(zstd_stat_com_fail); + dprintf("Error: %s", ZSTD_getErrorString(err)); } return (s_len); } @@ -753,6 +866,9 @@ zstd_init(void) if (zstd_ksp != NULL) { zstd_ksp->ks_data = &zstd_stats; kstat_install(zstd_ksp); +#ifdef _KERNEL + zstd_ksp->ks_update = kstat_zstd_update; +#endif } return (0); @@ -781,8 +897,8 @@ module_init(zstd_init); module_exit(zstd_fini); #endif -EXPORT_SYMBOL(zfs_zstd_compress); -EXPORT_SYMBOL(zfs_zstd_decompress_level); -EXPORT_SYMBOL(zfs_zstd_decompress); -EXPORT_SYMBOL(zfs_zstd_cache_reap_now); +ZFS_MODULE_PARAM(zfs, zstd_, earlyabort_pass, INT, ZMOD_RW, + "Enable early abort attempts when using zstd"); +ZFS_MODULE_PARAM(zfs, zstd_, abort_size, UINT, ZMOD_RW, + "Minimal size of block to attempt early abort"); #endif From 84d0a03f3e38b1c4c9361a4b4ec613a2f46248b3 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Tue, 24 May 2022 12:46:35 -0400 Subject: [PATCH 083/119] Refactor Log Size Limit Original Log Size Limit implementation blocked all writes in case of limit reached until the TXG is committed and the log is freed. It caused huge delays and following speed spikes in application writes. This implementation instead smoothly throttles writes, using exactly the same mechanism as used for dirty data. Reviewed-by: Brian Behlendorf Reviewed-by: jxdking Signed-off-by: Alexander Motin Sponsored-By: iXsystems, Inc. Issue #12284 Closes #13476 --- include/sys/dmu_tx.h | 2 +- include/sys/dsl_pool.h | 2 +- man/man4/zfs.4 | 7 +++-- module/zfs/dmu_tx.c | 58 +++++++++++++++++++++++++++--------------- module/zfs/dsl_pool.c | 17 ++++++++----- 5 files changed, 53 insertions(+), 33 deletions(-) diff --git a/include/sys/dmu_tx.h b/include/sys/dmu_tx.h index 71a9ac7ca7bf..ad3f1b0e47ca 100644 --- a/include/sys/dmu_tx.h +++ b/include/sys/dmu_tx.h @@ -124,8 +124,8 @@ typedef struct dmu_tx_stats { kstat_named_t dmu_tx_dirty_throttle; kstat_named_t dmu_tx_dirty_delay; kstat_named_t dmu_tx_dirty_over_max; - kstat_named_t dmu_tx_wrlog_over_max; kstat_named_t dmu_tx_dirty_frees_delay; + kstat_named_t dmu_tx_wrlog_delay; kstat_named_t dmu_tx_quota; } dmu_tx_stats_t; diff --git a/include/sys/dsl_pool.h b/include/sys/dsl_pool.h index 32d973f09810..9270fb7d0b16 100644 --- a/include/sys/dsl_pool.h +++ b/include/sys/dsl_pool.h @@ -164,7 +164,7 @@ uint64_t dsl_pool_unreserved_space(dsl_pool_t *dp, zfs_space_check_t slop_policy); uint64_t dsl_pool_deferred_space(dsl_pool_t *dp); void dsl_pool_wrlog_count(dsl_pool_t *dp, int64_t size, uint64_t txg); -boolean_t dsl_pool_wrlog_over_max(dsl_pool_t *dp); +boolean_t dsl_pool_need_wrlog_delay(dsl_pool_t *dp); void dsl_pool_dirty_space(dsl_pool_t *dp, int64_t space, dmu_tx_t *tx); void dsl_pool_undirty_space(dsl_pool_t *dp, int64_t space, uint64_t txg); void dsl_free(dsl_pool_t *dp, uint64_t txg, const blkptr_t *bpp); diff --git a/man/man4/zfs.4 b/man/man4/zfs.4 index c95fa98c5fd4..d1ca69f80309 100644 --- a/man/man4/zfs.4 +++ b/man/man4/zfs.4 @@ -1098,10 +1098,9 @@ This should be less than . .It Sy zfs_wrlog_data_max Ns = Pq int The upper limit of write-transaction zil log data size in bytes. -Once it is reached, write operation is blocked, until log data is cleared out -after transaction group sync. -Because of some overhead, it should be set -at least 2 times the size of +Write operations are throttled when approaching the limit until log data is +cleared out after transaction group sync. +Because of some overhead, it should be set at least 2 times the size of .Sy zfs_dirty_data_max .No to prevent harming normal write throughput. It also should be smaller than the size of the slog device if slog is present. diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c index fe9860066d31..e7bd53136b85 100644 --- a/module/zfs/dmu_tx.c +++ b/module/zfs/dmu_tx.c @@ -53,8 +53,8 @@ dmu_tx_stats_t dmu_tx_stats = { { "dmu_tx_dirty_throttle", KSTAT_DATA_UINT64 }, { "dmu_tx_dirty_delay", KSTAT_DATA_UINT64 }, { "dmu_tx_dirty_over_max", KSTAT_DATA_UINT64 }, - { "dmu_tx_wrlog_over_max", KSTAT_DATA_UINT64 }, { "dmu_tx_dirty_frees_delay", KSTAT_DATA_UINT64 }, + { "dmu_tx_wrlog_delay", KSTAT_DATA_UINT64 }, { "dmu_tx_quota", KSTAT_DATA_UINT64 }, }; @@ -779,34 +779,49 @@ static void dmu_tx_delay(dmu_tx_t *tx, uint64_t dirty) { dsl_pool_t *dp = tx->tx_pool; - uint64_t delay_min_bytes = + uint64_t delay_min_bytes, wrlog; + hrtime_t wakeup, tx_time = 0, now; + + /* Calculate minimum transaction time for the dirty data amount. */ + delay_min_bytes = zfs_dirty_data_max * zfs_delay_min_dirty_percent / 100; - hrtime_t wakeup, min_tx_time, now; + if (dirty > delay_min_bytes) { + /* + * The caller has already waited until we are under the max. + * We make them pass us the amount of dirty data so we don't + * have to handle the case of it being >= the max, which + * could cause a divide-by-zero if it's == the max. + */ + ASSERT3U(dirty, <, zfs_dirty_data_max); - if (dirty <= delay_min_bytes) - return; + tx_time = zfs_delay_scale * (dirty - delay_min_bytes) / + (zfs_dirty_data_max - dirty); + } - /* - * The caller has already waited until we are under the max. - * We make them pass us the amount of dirty data so we don't - * have to handle the case of it being >= the max, which could - * cause a divide-by-zero if it's == the max. - */ - ASSERT3U(dirty, <, zfs_dirty_data_max); + /* Calculate minimum transaction time for the TX_WRITE log size. */ + wrlog = aggsum_upper_bound(&dp->dp_wrlog_total); + delay_min_bytes = + zfs_wrlog_data_max * zfs_delay_min_dirty_percent / 100; + if (wrlog >= zfs_wrlog_data_max) { + tx_time = zfs_delay_max_ns; + } else if (wrlog > delay_min_bytes) { + tx_time = MAX(zfs_delay_scale * (wrlog - delay_min_bytes) / + (zfs_wrlog_data_max - wrlog), tx_time); + } + if (tx_time == 0) + return; + + tx_time = MIN(tx_time, zfs_delay_max_ns); now = gethrtime(); - min_tx_time = zfs_delay_scale * - (dirty - delay_min_bytes) / (zfs_dirty_data_max - dirty); - min_tx_time = MIN(min_tx_time, zfs_delay_max_ns); - if (now > tx->tx_start + min_tx_time) + if (now > tx->tx_start + tx_time) return; DTRACE_PROBE3(delay__mintime, dmu_tx_t *, tx, uint64_t, dirty, - uint64_t, min_tx_time); + uint64_t, tx_time); mutex_enter(&dp->dp_lock); - wakeup = MAX(tx->tx_start + min_tx_time, - dp->dp_last_wakeup + min_tx_time); + wakeup = MAX(tx->tx_start + tx_time, dp->dp_last_wakeup + tx_time); dp->dp_last_wakeup = wakeup; mutex_exit(&dp->dp_lock); @@ -884,8 +899,9 @@ dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how) } if (!tx->tx_dirty_delayed && - dsl_pool_wrlog_over_max(tx->tx_pool)) { - DMU_TX_STAT_BUMP(dmu_tx_wrlog_over_max); + dsl_pool_need_wrlog_delay(tx->tx_pool)) { + tx->tx_wait_dirty = B_TRUE; + DMU_TX_STAT_BUMP(dmu_tx_wrlog_delay); return (SET_ERROR(ERESTART)); } diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c index c8766090558d..90d7579cbd32 100644 --- a/module/zfs/dsl_pool.c +++ b/module/zfs/dsl_pool.c @@ -105,9 +105,8 @@ int zfs_dirty_data_max_percent = 10; int zfs_dirty_data_max_max_percent = 25; /* - * zfs_wrlog_data_max, the upper limit of TX_WRITE log data. - * Once it is reached, write operation is blocked, - * until log data is cleared out after txg sync. + * The upper limit of TX_WRITE log data. Write operations are throttled + * when approaching the limit until log data is cleared out after txg sync. * It only counts TX_WRITE log with WR_COPIED or WR_NEED_COPY. */ unsigned long zfs_wrlog_data_max = 0; @@ -623,15 +622,18 @@ dsl_pool_wrlog_count(dsl_pool_t *dp, int64_t size, uint64_t txg) /* Choose a value slightly bigger than min dirty sync bytes */ uint64_t sync_min = - zfs_dirty_data_max * (zfs_dirty_data_sync_percent + 10) / 100; + zfs_wrlog_data_max * (zfs_dirty_data_sync_percent + 10) / 200; if (aggsum_compare(&dp->dp_wrlog_pertxg[txg & TXG_MASK], sync_min) > 0) txg_kick(dp, txg); } boolean_t -dsl_pool_wrlog_over_max(dsl_pool_t *dp) +dsl_pool_need_wrlog_delay(dsl_pool_t *dp) { - return (aggsum_compare(&dp->dp_wrlog_total, zfs_wrlog_data_max) > 0); + uint64_t delay_min_bytes = + zfs_wrlog_data_max * zfs_delay_min_dirty_percent / 100; + + return (aggsum_compare(&dp->dp_wrlog_total, delay_min_bytes) > 0); } static void @@ -641,6 +643,9 @@ dsl_pool_wrlog_clear(dsl_pool_t *dp, uint64_t txg) delta = -(int64_t)aggsum_value(&dp->dp_wrlog_pertxg[txg & TXG_MASK]); aggsum_add(&dp->dp_wrlog_pertxg[txg & TXG_MASK], delta); aggsum_add(&dp->dp_wrlog_total, delta); + /* Compact per-CPU sums after the big change. */ + (void) aggsum_value(&dp->dp_wrlog_pertxg[txg & TXG_MASK]); + (void) aggsum_value(&dp->dp_wrlog_total); } #ifdef ZFS_DEBUG From 4dc1c8a0b84678a98e1c541493988b348ea0e644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?= =?UTF-8?q?=E3=82=B4=E3=83=B3=E3=83=91=29?= Date: Tue, 24 May 2022 17:07:01 -0400 Subject: [PATCH 084/119] rpm: Use the correct version-release information in dependencies This tightly links the subpackages together and ensures that everything is upgraded together. Reviewed-by: Tony Hutter Reviewed-by: Brian Behlendorf Signed-off-by: Neal Gompa Closes #13489 --- rpm/generic/zfs.spec.in | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index 8cf702c70e6b..c9eae765a614 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -90,12 +90,12 @@ License: @ZFS_META_LICENSE@ URL: https://github.com/openzfs/zfs Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires: libzpool5 = %{version} -Requires: libnvpair3 = %{version} -Requires: libuutil3 = %{version} -Requires: libzfs5 = %{version} +Requires: libzpool5%{?_isa} = %{version}-%{release} +Requires: libnvpair3%{?_isa} = %{version}-%{release} +Requires: libuutil3%{?_isa} = %{version}-%{release} +Requires: libzfs5%{?_isa} = %{version}-%{release} Requires: %{name}-kmod = %{version} -Provides: %{name}-kmod-common = %{version} +Provides: %{name}-kmod-common = %{version}-%{release} Obsoletes: spl # zfs-fuse provides the same commands and man pages that OpenZFS does. @@ -221,13 +221,13 @@ This package provides support for managing ZFS filesystems %package -n libzfs5-devel Summary: Development headers Group: System Environment/Kernel -Requires: libzfs5 = %{version} -Requires: libzpool5 = %{version} -Requires: libnvpair3 = %{version} -Requires: libuutil3 = %{version} -Provides: libzpool5-devel -Provides: libnvpair3-devel -Provides: libuutil3-devel +Requires: libzfs5%{?_isa} = %{version}-%{release} +Requires: libzpool5%{?_isa} = %{version}-%{release} +Requires: libnvpair3%{?_isa} = %{version}-%{release} +Requires: libuutil3%{?_isa} = %{version}-%{release} +Provides: libzpool5-devel = %{version}-%{release} +Provides: libnvpair3-devel = %{version}-%{release} +Provides: libuutil3-devel = %{version}-%{release} Obsoletes: zfs-devel Obsoletes: libzfs2-devel Obsoletes: libzfs4-devel @@ -281,8 +281,8 @@ Summary: Python %{python_version} wrapper for libzfs_core Group: Development/Languages/Python License: Apache-2.0 BuildArch: noarch -Requires: libzfs5 = %{version} -Requires: libnvpair3 = %{version} +Requires: libzfs5 = %{version}-%{release} +Requires: libnvpair3 = %{version}-%{release} Requires: libffi Requires: python%{__python_pkg_version} @@ -317,7 +317,6 @@ This package provides a python wrapper for the libzfs_core C library. Summary: Initramfs module Group: System Environment/Kernel Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: %{name} = %{version}-%{release} Requires: initramfs-tools %description initramfs From 82aa4f6f858549ba51d8afa207b179e4a3403d95 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 25 May 2022 09:13:51 -0700 Subject: [PATCH 085/119] Switch sed -E to -r for better portability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GNU sed 4.1.2 does not support the -E flag and this version is used by some cross-compiling tool chains. Switch -E to -r which is understood. Reviewed-by: Ahelenia Ziemiańska Signed-off-by: Brian Behlendorf Closes #13502 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7e356cbd20b2..64974aa32925 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ AM_INIT_AUTOMAKE([subdir-objects foreign]) # Remove default macros from config.h: # PACKAGE, PACKAGE_{BUGREPORT,NAME,STRING,TARNAME,VERSION}, STDC_HEADERS, VERSION AC_CONFIG_HEADERS([zfs_config.h], [ - sed -nEi~ -e '/^$/be' -e 'N;N;/#define (PACKAGE|VERSION|STDC_HEADERS)/d' -e ':e' -e 'p' zfs_config.h && rm zfs_config.h~ || exit]) + sed -nri~ -e '/^$/be' -e 'N;N;/#define (PACKAGE|VERSION|STDC_HEADERS)/d' -e ':e' -e 'p' zfs_config.h && rm zfs_config.h~ || exit]) LT_INIT AC_PROG_INSTALL From 3bbc26097e53c472084d978dd37343b07ed17e3c Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Wed, 25 May 2022 12:18:49 -0400 Subject: [PATCH 086/119] Unbreak zstd build on sparc64 It turns out that wrapping the atomic macro in () breaks build on Linux/SPARC64. Oops. Reviewed-by: Brian Behlendorf Signed-off-by: Rich Ercolani Closes #13506 --- include/sys/zstd/zstd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sys/zstd/zstd.h b/include/sys/zstd/zstd.h index ec2341b76930..d8c3fa86dce3 100644 --- a/include/sys/zstd/zstd.h +++ b/include/sys/zstd/zstd.h @@ -79,7 +79,7 @@ typedef struct zfs_zstd_meta { */ #define ZSTDSTAT(stat) (zstd_stats.stat.value.ui64) #define ZSTDSTAT_ZERO(stat) \ - (atomic_store_64(&zstd_stats.stat.value.ui64, 0)) + atomic_store_64(&zstd_stats.stat.value.ui64, 0) #define ZSTDSTAT_ADD(stat, val) \ atomic_add_64(&zstd_stats.stat.value.ui64, (val)) #define ZSTDSTAT_SUB(stat, val) \ From 61ef68727b0b3c53e27d6e503947f6c5efd1318c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 25 May 2022 09:20:17 -0700 Subject: [PATCH 087/119] Standardize RHEL version check in packages This is a follow up to 3c356622994 which standardizes how the RHEL version check is done. This simpler "0%{?rhel}" check is used elsewhere in the packages so we do the same here. Reviewed-by: Neal Gompa Reviewed-by: Rich Ercolani Signed-off-by: Brian Behlendorf Closes #13501 --- rpm/generic/zfs-dkms.spec.in | 2 +- rpm/generic/zfs-kmod.spec.in | 2 +- rpm/generic/zfs.spec.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rpm/generic/zfs-dkms.spec.in b/rpm/generic/zfs-dkms.spec.in index d0cf38caa193..f23347380d05 100644 --- a/rpm/generic/zfs-dkms.spec.in +++ b/rpm/generic/zfs-dkms.spec.in @@ -36,7 +36,7 @@ Obsoletes: spl-dkms Provides: %{module}-kmod = %{version} AutoReqProv: no -%if (0%{?fedora}%{?suse_version}) || (0 < 0%{?rhel} && 0%{?rhel} < 9) +%if (0%{?fedora}%{?suse_version}) || (0%{?rhel} && 0%{?rhel} < 9) # We don't directly use it, but if this isn't installed, rpmbuild as root can # crash+corrupt rpmdb # See issue #12071 diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in index c25d968d1c94..ae0795427868 100644 --- a/rpm/generic/zfs-kmod.spec.in +++ b/rpm/generic/zfs-kmod.spec.in @@ -57,7 +57,7 @@ BuildRequires: gcc, make BuildRequires: elfutils-libelf-devel %endif -%if (0%{?fedora}%{?suse_version}) || (0 < 0%{?rhel} && 0%{?rhel} < 9) +%if (0%{?fedora}%{?suse_version}) || (0%{?rhel} && 0%{?rhel} < 9) # We don't directly use it, but if this isn't installed, rpmbuild as root can # crash+corrupt rpmdb # See issue #12071 diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index c9eae765a614..493e93c1f3e6 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -114,7 +114,7 @@ BuildRequires: openssl-devel BuildRequires: libtirpc-devel %endif -%if (0%{?fedora}%{?suse_version}) || (0 < 0%{?rhel} && 0%{?rhel} < 9) +%if (0%{?fedora}%{?suse_version}) || (0%{?rhel} && 0%{?rhel} < 9) # We don't directly use it, but if this isn't installed, rpmbuild as root can # crash+corrupt rpmdb # See issue #12071 From b37093a188d94279e5e2faaf09e6ff754873b0a2 Mon Sep 17 00:00:00 2001 From: Umer Saleem Date: Wed, 25 May 2022 21:22:11 +0500 Subject: [PATCH 088/119] rpm: Keep debug symbols if configured with '--enable-debuginfo' Do not strip debug information from packages if '--enable-debuginfo' is configured. Reviewed-by: Brian Behlendorf Signed-off-by: Umer Saleem Closes #13500 --- config/zfs-build.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 59bca5579252..582c479f5b5b 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -333,6 +333,10 @@ AC_DEFUN([ZFS_AC_RPM], [ RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(ASAN_ZFS) 1"' RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(UBSAN_ZFS) 1"' + AS_IF([test "x$enable_debuginfo" = xyes], [ + RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "__strip /bin/true"' + ]) + RPM_DEFINE_UTIL=' --define "_initconfdir $(initconfdir)"' dnl # Make the next three RPM_DEFINE_UTIL additions conditional, since From 7829b465a7f736e9458257fcb9dcefd8eb882ee0 Mon Sep 17 00:00:00 2001 From: Paul Dagnelie Date: Wed, 25 May 2022 09:25:13 -0700 Subject: [PATCH 089/119] Cancel in-progress rebuilds when we finish removal This issue was discovered by zloop runs. When a mirror or other redundant top-level vdev has a disk failure, and the disk is replaced, the rebuild process occurs. A removal can happen while this is in progress. If the removal completes before the rebuild does, the removal process will try to free the vdev that is still in use. Reviewed-by: Brian Behlendorf Signed-off-by: Paul Dagnelie Closes #13498 --- module/zfs/vdev_removal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c index 5508d273758d..7dfc4345f236 100644 --- a/module/zfs/vdev_removal.c +++ b/module/zfs/vdev_removal.c @@ -1364,6 +1364,8 @@ vdev_remove_complete(spa_t *spa) ASSERT3P(vd->vdev_initialize_thread, ==, NULL); ASSERT3P(vd->vdev_trim_thread, ==, NULL); ASSERT3P(vd->vdev_autotrim_thread, ==, NULL); + vdev_rebuild_stop_wait(vd); + ASSERT3P(vd->vdev_rebuild_thread, ==, NULL); uint64_t vdev_space = spa_deflate(spa) ? vd->vdev_stat.vs_dspace : vd->vdev_stat.vs_space; From 1d89b989c15acdc9d70878253d68162c3c5c5836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 25 May 2022 18:29:47 +0200 Subject: [PATCH 090/119] automake: don't install /e/d/zfs or /e/z/zfs-functions +x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _SCRIPTS means it's made +x when installing; _DATA is made -x. Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13496 Closes #13503 --- etc/Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/Makefile.am b/etc/Makefile.am index ffe5fad2b4a9..a41f04c90420 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -14,21 +14,21 @@ dist_sysconf_zfs_DATA = \ %D%/zfs/vdev_id.conf.sas_switch.example \ %D%/zfs/vdev_id.conf.scsi.example -sysconf_zfs_SCRIPTS = \ +sysconf_zfs_DATA = \ %D%/zfs/zfs-functions -SUBSTFILES += $(sysconf_zfs_SCRIPTS) -SHELLCHECKSCRIPTS += $(sysconf_zfs_SCRIPTS) -$(call SHELLCHECK_OPTS,$(sysconf_zfs_SCRIPTS)): SHELLCHECK_SHELL = sh +SUBSTFILES += $(sysconf_zfs_DATA) +SHELLCHECKSCRIPTS += $(sysconf_zfs_DATA) +$(call SHELLCHECK_OPTS,$(sysconf_zfs_DATA)): SHELLCHECK_SHELL = sh if BUILD_LINUX -initconf_SCRIPTS = \ +initconf_DATA = \ %D%/default/zfs -SUBSTFILES += $(initconf_SCRIPTS) -SHELLCHECKSCRIPTS += $(initconf_SCRIPTS) -$(call SHELLCHECK_OPTS,$(initconf_SCRIPTS)): SHELLCHECK_SHELL = sh +SUBSTFILES += $(initconf_DATA) +SHELLCHECKSCRIPTS += $(initconf_DATA) +$(call SHELLCHECK_OPTS,$(initconf_DATA)): SHELLCHECK_SHELL = sh if INIT_SYSV From 6aa8c21a2ad29ddd4564cdfd4c99048c891b717a Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 25 May 2022 13:12:52 -0400 Subject: [PATCH 091/119] More speculative prefetcher improvements - Make prefetch distance adaptive: up to 4MB prefetch doubles for every, hit same as before, but after that it grows by 1/8 every time the prefetch read does not complete in time to satisfy the demand. My tests show that 4MB is sufficient for wide NVMe pool to saturate single reader thread at 2.5GB/s, while new 64MB maximum allows the same thread to reach 1.5GB/s on wide HDD pool. Further distance increase may increase speed even more, but less dramatic and with higher latency. - Allow early reuse of inactive prefetch streams: streams that never saw hits can be reused immediately if there is a demand, while others can be reused after 1s of inactivity, starting with the oldest. After 2s of inactivity streams are deleted to free resources same as before. This allows by several times increase strided read performance on HDD pool in presence of simultaneous random reads, previously filling the zfetch_max_streams limit for seconds and so blocking most of prefetch. - Always issue intermediate indirect block reads with SYNC priority. Each of those reads if delayed for longer may delay up to 1024 other block prefetches, that may be not good for wide pools. Reviewed-by: Allan Jude Reviewed-by: Brian Behlendorf Signed-off-by: Alexander Motin Sponsored-By: iXsystems, Inc. Closes #13452 --- include/sys/dbuf.h | 2 +- include/sys/dmu_zfetch.h | 16 ++-- man/man4/zfs.4 | 17 +++- module/zfs/dbuf.c | 14 +-- module/zfs/dmu_zfetch.c | 185 +++++++++++++++++++++------------------ 5 files changed, 133 insertions(+), 101 deletions(-) diff --git a/include/sys/dbuf.h b/include/sys/dbuf.h index deaab82b797d..60f8d5d74d6e 100644 --- a/include/sys/dbuf.h +++ b/include/sys/dbuf.h @@ -329,7 +329,7 @@ typedef struct dbuf_hash_table { krwlock_t hash_rwlocks[DBUF_RWLOCKS] ____cacheline_aligned; } dbuf_hash_table_t; -typedef void (*dbuf_prefetch_fn)(void *, boolean_t); +typedef void (*dbuf_prefetch_fn)(void *, uint64_t, uint64_t, boolean_t); uint64_t dbuf_whichblock(const struct dnode *di, const int64_t level, const uint64_t offset); diff --git a/include/sys/dmu_zfetch.h b/include/sys/dmu_zfetch.h index 4c220b0c79e5..cd1b79eb8e44 100644 --- a/include/sys/dmu_zfetch.h +++ b/include/sys/dmu_zfetch.h @@ -49,20 +49,18 @@ typedef struct zfetch { typedef struct zstream { uint64_t zs_blkid; /* expect next access at this blkid */ - uint64_t zs_pf_blkid1; /* first block to prefetch */ - uint64_t zs_pf_blkid; /* block to prefetch up to */ - - /* - * We will next prefetch the L1 indirect block of this level-0 - * block id. - */ - uint64_t zs_ipf_blkid1; /* first block to prefetch */ - uint64_t zs_ipf_blkid; /* block to prefetch up to */ + unsigned int zs_pf_dist; /* data prefetch distance in bytes */ + unsigned int zs_ipf_dist; /* L1 prefetch distance in bytes */ + uint64_t zs_pf_start; /* first data block to prefetch */ + uint64_t zs_pf_end; /* data block to prefetch up to */ + uint64_t zs_ipf_start; /* first data block to prefetch L1 */ + uint64_t zs_ipf_end; /* data block to prefetch L1 up to */ list_node_t zs_node; /* link for zf_stream */ hrtime_t zs_atime; /* time last prefetch issued */ zfetch_t *zs_fetch; /* parent fetch */ boolean_t zs_missed; /* stream saw cache misses */ + boolean_t zs_more; /* need more distant prefetch */ zfs_refcount_t zs_callers; /* number of pending callers */ /* * Number of stream references: dnode, callers and pending blocks. diff --git a/man/man4/zfs.4 b/man/man4/zfs.4 index d1ca69f80309..fa3159ab82ca 100644 --- a/man/man4/zfs.4 +++ b/man/man4/zfs.4 @@ -487,7 +487,15 @@ However, this is limited by .It Sy zfetch_array_rd_sz Ns = Ns Sy 1048576 Ns B Po 1 MiB Pc Pq ulong If prefetching is enabled, disable prefetching for reads larger than this size. . -.It Sy zfetch_max_distance Ns = Ns Sy 8388608 Ns B Po 8 MiB Pc Pq uint +.It Sy zfetch_min_distance Ns = Ns Sy 4194304 Ns B Po 4 MiB Pc Pq uint +Min bytes to prefetch per stream. +Prefetch distance starts from the demand access size and quickly grows to +this value, doubling on each hit. +After that it may grow further by 1/8 per hit, but only if some prefetch +since last time haven't completed in time to satisfy demand request, i.e. +prefetch depth didn't cover the read latency or the pool got saturated. +. +.It Sy zfetch_max_distance Ns = Ns Sy 67108864 Ns B Po 64 MiB Pc Pq uint Max bytes to prefetch per stream. . .It Sy zfetch_max_idistance Ns = Ns Sy 67108864 Ns B Po 64 MiB Pc Pq uint @@ -496,8 +504,11 @@ Max bytes to prefetch indirects for per stream. .It Sy zfetch_max_streams Ns = Ns Sy 8 Pq uint Max number of streams per zfetch (prefetch streams per file). . -.It Sy zfetch_min_sec_reap Ns = Ns Sy 2 Pq uint -Min time before an active prefetch stream can be reclaimed +.It Sy zfetch_min_sec_reap Ns = Ns Sy 1 Pq uint +Min time before inactive prefetch stream can be reclaimed +. +.It Sy zfetch_max_sec_reap Ns = Ns Sy 2 Pq uint +Max time before inactive prefetch stream can be deleted . .It Sy zfs_abd_scatter_enabled Ns = Ns Sy 1 Ns | Ns 0 Pq int Enables ARC from using scatter/gather lists and forces all allocations to be diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 9a273b010fb1..55a3686fac46 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -3185,8 +3185,10 @@ typedef struct dbuf_prefetch_arg { static void dbuf_prefetch_fini(dbuf_prefetch_arg_t *dpa, boolean_t io_done) { - if (dpa->dpa_cb != NULL) - dpa->dpa_cb(dpa->dpa_arg, io_done); + if (dpa->dpa_cb != NULL) { + dpa->dpa_cb(dpa->dpa_arg, dpa->dpa_zb.zb_level, + dpa->dpa_zb.zb_blkid, io_done); + } kmem_free(dpa, sizeof (*dpa)); } @@ -3320,7 +3322,8 @@ dbuf_prefetch_indirect_done(zio_t *zio, const zbookmark_phys_t *zb, dpa->dpa_zb.zb_object, dpa->dpa_curlevel, nextblkid); (void) arc_read(dpa->dpa_zio, dpa->dpa_spa, - bp, dbuf_prefetch_indirect_done, dpa, dpa->dpa_prio, + bp, dbuf_prefetch_indirect_done, dpa, + ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, &iter_aflags, &zb); } @@ -3455,7 +3458,8 @@ dbuf_prefetch_impl(dnode_t *dn, int64_t level, uint64_t blkid, SET_BOOKMARK(&zb, ds != NULL ? ds->ds_object : DMU_META_OBJSET, dn->dn_object, curlevel, curblkid); (void) arc_read(dpa->dpa_zio, dpa->dpa_spa, - &bp, dbuf_prefetch_indirect_done, dpa, prio, + &bp, dbuf_prefetch_indirect_done, dpa, + ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, &iter_aflags, &zb); } @@ -3467,7 +3471,7 @@ dbuf_prefetch_impl(dnode_t *dn, int64_t level, uint64_t blkid, return (1); no_issue: if (cb != NULL) - cb(arg, B_FALSE); + cb(arg, level, blkid, B_FALSE); return (0); } diff --git a/module/zfs/dmu_zfetch.c b/module/zfs/dmu_zfetch.c index a6facdc65bb4..d00a48159aeb 100644 --- a/module/zfs/dmu_zfetch.c +++ b/module/zfs/dmu_zfetch.c @@ -48,9 +48,13 @@ static int zfs_prefetch_disable = B_FALSE; /* max # of streams per zfetch */ static unsigned int zfetch_max_streams = 8; /* min time before stream reclaim */ -static unsigned int zfetch_min_sec_reap = 2; -/* max bytes to prefetch per stream (default 8MB) */ -unsigned int zfetch_max_distance = 8 * 1024 * 1024; +static unsigned int zfetch_min_sec_reap = 1; +/* max time before stream delete */ +static unsigned int zfetch_max_sec_reap = 2; +/* min bytes to prefetch per stream (default 4MB) */ +static unsigned int zfetch_min_distance = 4 * 1024 * 1024; +/* max bytes to prefetch per stream (default 64MB) */ +unsigned int zfetch_max_distance = 64 * 1024 * 1024; /* max bytes to prefetch indirects for per stream (default 64MB) */ unsigned int zfetch_max_idistance = 64 * 1024 * 1024; /* max number of bytes in an array_read in which we allow prefetching (1MB) */ @@ -195,74 +199,99 @@ dmu_zfetch_fini(zfetch_t *zf) } /* - * If there aren't too many streams already, create a new stream. + * If there aren't too many active streams already, create one more. + * In process delete/reuse all streams without hits for zfetch_max_sec_reap. + * If needed, reuse oldest stream without hits for zfetch_min_sec_reap or ever. * The "blkid" argument is the next block that we expect this stream to access. - * While we're here, clean up old streams (which haven't been - * accessed for at least zfetch_min_sec_reap seconds). */ static void dmu_zfetch_stream_create(zfetch_t *zf, uint64_t blkid) { - zstream_t *zs_next; - hrtime_t now = gethrtime(); + zstream_t *zs, *zs_next, *zs_old = NULL; + hrtime_t now = gethrtime(), t; ASSERT(MUTEX_HELD(&zf->zf_lock)); /* - * Clean up old streams. + * Delete too old streams, reusing the first found one. */ - for (zstream_t *zs = list_head(&zf->zf_stream); - zs != NULL; zs = zs_next) { + t = now - SEC2NSEC(zfetch_max_sec_reap); + for (zs = list_head(&zf->zf_stream); zs != NULL; zs = zs_next) { zs_next = list_next(&zf->zf_stream, zs); /* * Skip if still active. 1 -- zf_stream reference. */ if (zfs_refcount_count(&zs->zs_refs) != 1) continue; - if (((now - zs->zs_atime) / NANOSEC) > - zfetch_min_sec_reap) + if (zs->zs_atime > t) + continue; + if (zs_old) dmu_zfetch_stream_remove(zf, zs); + else + zs_old = zs; + } + if (zs_old) { + zs = zs_old; + goto reuse; } /* * The maximum number of streams is normally zfetch_max_streams, * but for small files we lower it such that it's at least possible * for all the streams to be non-overlapping. - * - * If we are already at the maximum number of streams for this file, - * even after removing old streams, then don't create this stream. */ uint32_t max_streams = MAX(1, MIN(zfetch_max_streams, zf->zf_dnode->dn_maxblkid * zf->zf_dnode->dn_datablksz / zfetch_max_distance)); if (zf->zf_numstreams >= max_streams) { + t = now - SEC2NSEC(zfetch_min_sec_reap); + for (zs = list_head(&zf->zf_stream); zs != NULL; + zs = list_next(&zf->zf_stream, zs)) { + if (zfs_refcount_count(&zs->zs_refs) != 1) + continue; + if (zs->zs_atime > t) + continue; + if (zs_old == NULL || zs->zs_atime < zs_old->zs_atime) + zs_old = zs; + } + if (zs_old) { + zs = zs_old; + goto reuse; + } ZFETCHSTAT_BUMP(zfetchstat_max_streams); return; } - zstream_t *zs = kmem_zalloc(sizeof (*zs), KM_SLEEP); - zs->zs_blkid = blkid; - zs->zs_pf_blkid1 = blkid; - zs->zs_pf_blkid = blkid; - zs->zs_ipf_blkid1 = blkid; - zs->zs_ipf_blkid = blkid; - zs->zs_atime = now; + zs = kmem_zalloc(sizeof (*zs), KM_SLEEP); zs->zs_fetch = zf; - zs->zs_missed = B_FALSE; zfs_refcount_create(&zs->zs_callers); zfs_refcount_create(&zs->zs_refs); /* One reference for zf_stream. */ zfs_refcount_add(&zs->zs_refs, NULL); zf->zf_numstreams++; list_insert_head(&zf->zf_stream, zs); + +reuse: + zs->zs_blkid = blkid; + zs->zs_pf_dist = 0; + zs->zs_pf_start = blkid; + zs->zs_pf_end = blkid; + zs->zs_ipf_dist = 0; + zs->zs_ipf_start = blkid; + zs->zs_ipf_end = blkid; + /* Allow immediate stream reuse until first hit. */ + zs->zs_atime = now - SEC2NSEC(zfetch_min_sec_reap); + zs->zs_missed = B_FALSE; + zs->zs_more = B_FALSE; } static void -dmu_zfetch_stream_done(void *arg, boolean_t io_issued) +dmu_zfetch_done(void *arg, uint64_t level, uint64_t blkid, boolean_t io_issued) { - (void) io_issued; zstream_t *zs = arg; + if (io_issued && level == 0 && blkid < zs->zs_blkid) + zs->zs_more = B_TRUE; if (zfs_refcount_remove(&zs->zs_refs, NULL) == 0) dmu_zfetch_stream_fini(zs); } @@ -284,11 +313,6 @@ dmu_zfetch_prepare(zfetch_t *zf, uint64_t blkid, uint64_t nblks, boolean_t fetch_data, boolean_t have_lock) { zstream_t *zs; - int64_t pf_start, ipf_start; - int64_t pf_ahead_blks, max_blks; - int max_dist_blks, pf_nblks, ipf_nblks; - uint64_t end_of_access_blkid, maxblkid; - end_of_access_blkid = blkid + nblks; spa_t *spa = zf->zf_dnode->dn_objset->os_spa; if (zfs_prefetch_disable) @@ -317,7 +341,7 @@ dmu_zfetch_prepare(zfetch_t *zf, uint64_t blkid, uint64_t nblks, * A fast path for small files for which no prefetch will * happen. */ - maxblkid = zf->zf_dnode->dn_maxblkid; + uint64_t maxblkid = zf->zf_dnode->dn_maxblkid; if (maxblkid < 2) { if (!have_lock) rw_exit(&zf->zf_dnode->dn_struct_rwlock); @@ -345,6 +369,7 @@ dmu_zfetch_prepare(zfetch_t *zf, uint64_t blkid, uint64_t nblks, * If the file is ending, remove the matching stream if found. * If not found then it is too late to create a new one now. */ + uint64_t end_of_access_blkid = blkid + nblks; if (end_of_access_blkid >= maxblkid) { if (zs != NULL) dmu_zfetch_stream_remove(zf, zs); @@ -377,60 +402,48 @@ dmu_zfetch_prepare(zfetch_t *zf, uint64_t blkid, uint64_t nblks, /* * This access was to a block that we issued a prefetch for on - * behalf of this stream. Issue further prefetches for this stream. + * behalf of this stream. Calculate further prefetch distances. * - * Normally, we start prefetching where we stopped - * prefetching last (zs_pf_blkid). But when we get our first - * hit on this stream, zs_pf_blkid == zs_blkid, we don't - * want to prefetch the block we just accessed. In this case, - * start just after the block we just accessed. - */ - pf_start = MAX(zs->zs_pf_blkid, end_of_access_blkid); - if (zs->zs_pf_blkid1 < end_of_access_blkid) - zs->zs_pf_blkid1 = end_of_access_blkid; - if (zs->zs_ipf_blkid1 < end_of_access_blkid) - zs->zs_ipf_blkid1 = end_of_access_blkid; - - /* - * Double our amount of prefetched data, but don't let the - * prefetch get further ahead than zfetch_max_distance. + * Start prefetch from the demand access size (nblks). Double the + * distance every access up to zfetch_min_distance. After that only + * if needed increase the distance by 1/8 up to zfetch_max_distance. */ + unsigned int nbytes = nblks << zf->zf_dnode->dn_datablkshift; + unsigned int pf_nblks; if (fetch_data) { - max_dist_blks = - zfetch_max_distance >> zf->zf_dnode->dn_datablkshift; - /* - * Previously, we were (zs_pf_blkid - blkid) ahead. We - * want to now be double that, so read that amount again, - * plus the amount we are catching up by (i.e. the amount - * read just now). - */ - pf_ahead_blks = zs->zs_pf_blkid - blkid + nblks; - max_blks = max_dist_blks - (pf_start - end_of_access_blkid); - pf_nblks = MIN(pf_ahead_blks, max_blks); + if (unlikely(zs->zs_pf_dist < nbytes)) + zs->zs_pf_dist = nbytes; + else if (zs->zs_pf_dist < zfetch_min_distance) + zs->zs_pf_dist *= 2; + else if (zs->zs_more) + zs->zs_pf_dist += zs->zs_pf_dist / 8; + zs->zs_more = B_FALSE; + if (zs->zs_pf_dist > zfetch_max_distance) + zs->zs_pf_dist = zfetch_max_distance; + pf_nblks = zs->zs_pf_dist >> zf->zf_dnode->dn_datablkshift; } else { pf_nblks = 0; } + if (zs->zs_pf_start < end_of_access_blkid) + zs->zs_pf_start = end_of_access_blkid; + if (zs->zs_pf_end < end_of_access_blkid + pf_nblks) + zs->zs_pf_end = end_of_access_blkid + pf_nblks; - zs->zs_pf_blkid = pf_start + pf_nblks; - - /* - * Do the same for indirects, starting from where we stopped last, - * or where we will stop reading data blocks (and the indirects - * that point to them). - */ - ipf_start = MAX(zs->zs_ipf_blkid, zs->zs_pf_blkid); - max_dist_blks = zfetch_max_idistance >> zf->zf_dnode->dn_datablkshift; /* - * We want to double our distance ahead of the data prefetch - * (or reader, if we are not prefetching data). Previously, we - * were (zs_ipf_blkid - blkid) ahead. To double that, we read - * that amount again, plus the amount we are catching up by - * (i.e. the amount read now + the amount of data prefetched now). + * Do the same for indirects, starting where we will stop reading + * data blocks (and the indirects that point to them). */ - pf_ahead_blks = zs->zs_ipf_blkid - blkid + nblks + pf_nblks; - max_blks = max_dist_blks - (ipf_start - zs->zs_pf_blkid); - ipf_nblks = MIN(pf_ahead_blks, max_blks); - zs->zs_ipf_blkid = ipf_start + ipf_nblks; + if (unlikely(zs->zs_ipf_dist < nbytes)) + zs->zs_ipf_dist = nbytes; + else + zs->zs_ipf_dist *= 2; + if (zs->zs_ipf_dist > zfetch_max_idistance) + zs->zs_ipf_dist = zfetch_max_idistance; + pf_nblks = zs->zs_ipf_dist >> zf->zf_dnode->dn_datablkshift; + if (zs->zs_ipf_start < zs->zs_pf_end) + zs->zs_ipf_start = zs->zs_pf_end; + if (zs->zs_ipf_end < zs->zs_pf_end + pf_nblks) + zs->zs_ipf_end = zs->zs_pf_end + pf_nblks; zs->zs_blkid = end_of_access_blkid; /* Protect the stream from reclamation. */ @@ -471,13 +484,13 @@ dmu_zfetch_run(zstream_t *zs, boolean_t missed, boolean_t have_lock) mutex_enter(&zf->zf_lock); if (zs->zs_missed) { - pf_start = zs->zs_pf_blkid1; - pf_end = zs->zs_pf_blkid1 = zs->zs_pf_blkid; + pf_start = zs->zs_pf_start; + pf_end = zs->zs_pf_start = zs->zs_pf_end; } else { pf_start = pf_end = 0; } - ipf_start = MAX(zs->zs_pf_blkid1, zs->zs_ipf_blkid1); - ipf_end = zs->zs_ipf_blkid1 = zs->zs_ipf_blkid; + ipf_start = zs->zs_ipf_start; + ipf_end = zs->zs_ipf_start = zs->zs_ipf_end; mutex_exit(&zf->zf_lock); ASSERT3S(pf_start, <=, pf_end); ASSERT3S(ipf_start, <=, ipf_end); @@ -505,12 +518,12 @@ dmu_zfetch_run(zstream_t *zs, boolean_t missed, boolean_t have_lock) for (int64_t blk = pf_start; blk < pf_end; blk++) { issued += dbuf_prefetch_impl(zf->zf_dnode, 0, blk, ZIO_PRIORITY_ASYNC_READ, ARC_FLAG_PREDICTIVE_PREFETCH, - dmu_zfetch_stream_done, zs); + dmu_zfetch_done, zs); } for (int64_t iblk = ipf_start; iblk < ipf_end; iblk++) { issued += dbuf_prefetch_impl(zf->zf_dnode, 1, iblk, ZIO_PRIORITY_ASYNC_READ, ARC_FLAG_PREDICTIVE_PREFETCH, - dmu_zfetch_stream_done, zs); + dmu_zfetch_done, zs); } if (!have_lock) @@ -540,6 +553,12 @@ ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, max_streams, UINT, ZMOD_RW, ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, min_sec_reap, UINT, ZMOD_RW, "Min time before stream reclaim"); +ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, max_sec_reap, UINT, ZMOD_RW, + "Max time before stream delete"); + +ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, min_distance, UINT, ZMOD_RW, + "Min bytes to prefetch per stream"); + ZFS_MODULE_PARAM(zfs_prefetch, zfetch_, max_distance, UINT, ZMOD_RW, "Max bytes to prefetch per stream"); From b62829295e9529d1c321816a1027fac5afc7d6f5 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Wed, 25 May 2022 20:26:59 -0400 Subject: [PATCH 092/119] Silence unused-but-set-variable warning This was breaking the kmod port build on FreeBSD with Clang 13. Use the same trick as we do for ASSERT() to make DNODE_VERIFY() use its parameter at compile time without actually using it at run time in non-debug builds. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #13507 --- include/sys/dnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sys/dnode.h b/include/sys/dnode.h index 3f5fcc958c36..33d9389d5a38 100644 --- a/include/sys/dnode.h +++ b/include/sys/dnode.h @@ -616,7 +616,7 @@ extern dnode_stats_t dnode_stats; #else #define dprintf_dnode(db, fmt, ...) -#define DNODE_VERIFY(dn) +#define DNODE_VERIFY(dn) ((void) sizeof ((uintptr_t)(dn))) #define FREE_VERIFY(db, start, end, tx) #endif From d98a67a53a180bd88ec8d9aeea75d92e1c9968b5 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 26 May 2022 09:24:50 -0700 Subject: [PATCH 093/119] Replace EXTRA_DIST with dist_noinst_DATA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The EXTRA_DIST variable is ignored when used in the FALSE conditional of a Makefile.am. This results in the `make dist` target omitting these files from the generated tarball unless CONFIG_USER is defined. This issue can be avoided by switching to use the dist_noinst_DATA variable which is handled as expected by autoconf. This change also adds support for --with-config=dist as an alias for --with-config=srpm and updates the GitHub workflows to use it. Reviewed-by: Ahelenia Ziemiańska Signed-off-by: Brian Behlendorf Closes #13459 Closes #13505 --- .github/workflows/zfs-tests-functional.yml | 2 +- .github/workflows/zfs-tests-sanity.yml | 2 +- .github/workflows/zloop.yml | 2 +- Makefile.am | 38 +++++++++++----------- cmd/Makefile.am | 8 ++--- cmd/zed/Makefile.am | 2 +- cmd/zed/zed.d/Makefile.am | 2 +- cmd/zpool/Makefile.am | 2 +- config/Substfiles.am | 2 +- config/zfs-build.m4 | 1 + contrib/bpftrace/Makefile.am | 4 +-- contrib/dracut/Makefile.am | 2 +- contrib/initramfs/Makefile.am | 2 +- contrib/pyzfs/Makefile.am | 2 +- contrib/zcp/Makefile.am | 2 +- etc/Makefile.am | 4 +-- lib/libnvpair/Makefile.am | 2 +- lib/libuutil/Makefile.am | 2 +- lib/libzfs/Makefile.am | 4 +-- lib/libzfs_core/Makefile.am | 2 +- lib/libzfsbootenv/Makefile.am | 2 +- man/Makefile.am | 5 +-- rpm/Makefile.am | 2 +- scripts/Makefile.am | 9 +++-- tests/Makefile.am | 2 +- tests/zfs-tests/cmd/Makefile.am | 4 +-- tests/zfs-tests/tests/Makefile.am | 2 +- 27 files changed, 56 insertions(+), 57 deletions(-) diff --git a/.github/workflows/zfs-tests-functional.yml b/.github/workflows/zfs-tests-functional.yml index 0273610af045..328cb97f10e4 100644 --- a/.github/workflows/zfs-tests-functional.yml +++ b/.github/workflows/zfs-tests-functional.yml @@ -28,7 +28,7 @@ jobs: ./autogen.sh - name: Configure run: | - ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan + ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan --with-config=dist - name: Make run: | make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod diff --git a/.github/workflows/zfs-tests-sanity.yml b/.github/workflows/zfs-tests-sanity.yml index 73606f909e10..4c15cecf58d8 100644 --- a/.github/workflows/zfs-tests-sanity.yml +++ b/.github/workflows/zfs-tests-sanity.yml @@ -24,7 +24,7 @@ jobs: ./autogen.sh - name: Configure run: | - ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan + ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan --with-config=dist - name: Make run: | make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod diff --git a/.github/workflows/zloop.yml b/.github/workflows/zloop.yml index d49eeae1653c..64fe96a3ab6b 100644 --- a/.github/workflows/zloop.yml +++ b/.github/workflows/zloop.yml @@ -23,7 +23,7 @@ jobs: ./autogen.sh - name: Configure run: | - ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan + ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan --with-config=dist - name: Make run: | make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod diff --git a/Makefile.am b/Makefile.am index 0a73a63870bc..54d300e7d40b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ CLEANFILES = -EXTRA_DIST = +dist_noinst_DATA = INSTALL_DATA_HOOKS = ALL_LOCAL = CLEAN_LOCAL = @@ -37,26 +37,26 @@ extradir = $(prefix)/src/zfs-$(VERSION) extra_HEADERS = zfs.release.in zfs_config.h.in endif -EXTRA_DIST += autogen.sh copy-builtin -EXTRA_DIST += AUTHORS CODE_OF_CONDUCT.md COPYRIGHT LICENSE META NEWS NOTICE -EXTRA_DIST += README.md RELEASES.md -EXTRA_DIST += module/lua/README.zfs module/os/linux/spl/README.md +dist_noinst_DATA += autogen.sh copy-builtin +dist_noinst_DATA += AUTHORS CODE_OF_CONDUCT.md COPYRIGHT LICENSE META NEWS NOTICE +dist_noinst_DATA += README.md RELEASES.md +dist_noinst_DATA += module/lua/README.zfs module/os/linux/spl/README.md # Include all the extra licensing information for modules -EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE -EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE.descrip -EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman -EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip -EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl -EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip -EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams -EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams.descrip -EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl -EXTRA_DIST += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl.descrip -EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2 -EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip -EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash -EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip +dist_noinst_DATA += module/icp/algs/skein/THIRDPARTYLICENSE +dist_noinst_DATA += module/icp/algs/skein/THIRDPARTYLICENSE.descrip +dist_noinst_DATA += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman +dist_noinst_DATA += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip +dist_noinst_DATA += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl +dist_noinst_DATA += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip +dist_noinst_DATA += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams +dist_noinst_DATA += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.cryptogams.descrip +dist_noinst_DATA += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl +dist_noinst_DATA += module/icp/asm-x86_64/modes/THIRDPARTYLICENSE.openssl.descrip +dist_noinst_DATA += module/os/linux/spl/THIRDPARTYLICENSE.gplv2 +dist_noinst_DATA += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip +dist_noinst_DATA += module/zfs/THIRDPARTYLICENSE.cityhash +dist_noinst_DATA += module/zfs/THIRDPARTYLICENSE.cityhash.descrip @CODE_COVERAGE_RULES@ diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 9959760b523e..65de980da308 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -10,7 +10,7 @@ mounthelper_PROGRAMS = sbin_SCRIPTS += fsck.zfs SHELLCHECKSCRIPTS += fsck.zfs CLEANFILES += fsck.zfs -EXTRA_DIST += %D%/fsck.zfs.in +dist_noinst_DATA += %D%/fsck.zfs.in $(call SUBST,fsck.zfs,%D%/) @@ -100,9 +100,9 @@ endif if USING_PYTHON -bin_SCRIPTS += arc_summary arcstat dbufstat -CLEANFILES += arc_summary arcstat dbufstat -EXTRA_DIST += %D%/arc_summary %D%/arcstat.in %D%/dbufstat.in +bin_SCRIPTS += arc_summary arcstat dbufstat +CLEANFILES += arc_summary arcstat dbufstat +dist_noinst_DATA += %D%/arc_summary %D%/arcstat.in %D%/dbufstat.in $(call SUBST,arcstat,%D%/) $(call SUBST,dbufstat,%D%/) diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index 6eea1a135f56..c437ff51dd2b 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -43,4 +43,4 @@ zed_LDADD = \ zed_LDADD += -lrt $(LIBATOMIC_LIBS) $(LIBUDEV_LIBS) $(LIBUUID_LIBS) zed_LDFLAGS = -pthread -EXTRA_DIST += $(addprefix %D%/,agents/README.md) +dist_noinst_DATA += %D%/agents/README.md diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 122d2c0c51bc..c65b43fb027e 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am @@ -38,7 +38,7 @@ zedconfdefaults = \ vdev_attach-led.sh \ vdev_clear-led.sh -EXTRA_DIST += $(addprefix %D%/,README) +dist_noinst_DATA += %D%/README INSTALL_DATA_HOOKS += zed-install-data-hook zed-install-data-hook: diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 9ba72eadf3a7..3c7c8a9aebe2 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -38,7 +38,7 @@ zpool_LDADD += -lgeom endif zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS) -EXTRA_DIST += $(addprefix %D%/,zpool.d/README compatibility.d) +dist_noinst_DATA += %D%/zpool.d/README SHELLCHECKSCRIPTS += $(dist_zpoolexec_SCRIPTS) zpoolexecdir = $(zfsexecdir)/zpool.d diff --git a/config/Substfiles.am b/config/Substfiles.am index 733073dd20ca..38e870b2f501 100644 --- a/config/Substfiles.am +++ b/config/Substfiles.am @@ -41,6 +41,6 @@ endef SUBSTFILES = CLEANFILES += $(SUBSTFILES) -EXTRA_DIST += $(SUBSTFILES:=.in) +dist_noinst_DATA += $(SUBSTFILES:=.in) $(call SUBST,%,) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 582c479f5b5b..b40776da7a70 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -268,6 +268,7 @@ AC_DEFUN([ZFS_AC_CONFIG], [ user) ZFS_AC_CONFIG_USER ;; all) ZFS_AC_CONFIG_USER ZFS_AC_CONFIG_KERNEL ;; + dist) ;; srpm) ;; *) AC_MSG_RESULT([Error!]) diff --git a/contrib/bpftrace/Makefile.am b/contrib/bpftrace/Makefile.am index 5382f1e1de42..4f649cf5433e 100644 --- a/contrib/bpftrace/Makefile.am +++ b/contrib/bpftrace/Makefile.am @@ -1,5 +1,3 @@ -EXTRA_DIST += $(addprefix %D%/, \ - taskqlatency.bt \ - zfs-trace.sh) +dist_noinst_DATA += %D%/taskqlatency.bt %D%/zfs-trace.sh SHELLCHECKSCRIPTS += %D%/zfs-trace.sh diff --git a/contrib/dracut/Makefile.am b/contrib/dracut/Makefile.am index f0c103b0a4da..73ca52b66316 100644 --- a/contrib/dracut/Makefile.am +++ b/contrib/dracut/Makefile.am @@ -24,4 +24,4 @@ SHELLCHECKSCRIPTS += $(pkgdracut_02_SCRIPTS) $(pkgdracut_90_SCRIPTS) # Provided by /bin/sleep, and, again, every implementation of that supports this $(call SHELLCHECK_OPTS,$(pkgdracut_90_SCRIPTS)): CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.' -EXTRA_DIST += $(addprefix %D%/,README.md) +dist_noinst_DATA += %D%/README.md diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am index 6917b517f330..a583341ea2b1 100644 --- a/contrib/initramfs/Makefile.am +++ b/contrib/initramfs/Makefile.am @@ -36,4 +36,4 @@ SHELLCHECKSCRIPTS += $(i_t_check_scripts) $(call SHELLCHECK_OPTS,$(i_t_check_scripts)): SHELLCHECK_SHELL = sh -EXTRA_DIST += $(addprefix %D%/,README.md) +dist_noinst_DATA += %D%/README.md diff --git a/contrib/pyzfs/Makefile.am b/contrib/pyzfs/Makefile.am index 505cd3c8b355..06d9a09d7f1e 100644 --- a/contrib/pyzfs/Makefile.am +++ b/contrib/pyzfs/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST += $(addprefix %D%/,libzfs_core README LICENSE docs) +dist_noinst_DATA += %D%/libzfs_core %D%/README %D%/LICENSE %D%/docs SUBSTFILES += %D%/setup.py if PYZFS_ENABLED diff --git a/contrib/zcp/Makefile.am b/contrib/zcp/Makefile.am index 759a9d529dc8..fc3f01a233cb 100644 --- a/contrib/zcp/Makefile.am +++ b/contrib/zcp/Makefile.am @@ -1 +1 @@ -EXTRA_DIST += $(addprefix %D%/,autosnap.lua) +dist_noinst_DATA += %D%/autosnap.lua diff --git a/etc/Makefile.am b/etc/Makefile.am index a41f04c90420..53064eb6f6ea 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -2,7 +2,7 @@ sudoersddir = $(sysconfdir)/sudoers.d sudoersd_DATA = \ %D%/sudoers.d/zfs -EXTRA_DIST += $(sudoersd_DATA) +dist_noinst_DATA += $(sudoersd_DATA) sysconf_zfsdir = $(sysconfdir)/zfs @@ -32,7 +32,7 @@ $(call SHELLCHECK_OPTS,$(initconf_DATA)): SHELLCHECK_SHELL = sh if INIT_SYSV -EXTRA_DIST += $(addprefix %D%/,init.d/README.md) +dist_noinst_DATA += %D%/init.d/README.md init_SCRIPTS = \ %D%/init.d/zfs-import \ diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am index 6d9345f5289e..87b8d32aa175 100644 --- a/lib/libnvpair/Makefile.am +++ b/lib/libnvpair/Makefile.am @@ -32,4 +32,4 @@ endif libnvpair_la_LDFLAGS += -version-info 3:0:0 -EXTRA_DIST += $(addprefix %D%/,libnvpair.abi libnvpair.suppr) +dist_noinst_DATA += %D%/libnvpair.abi %D%/libnvpair.suppr diff --git a/lib/libuutil/Makefile.am b/lib/libuutil/Makefile.am index cb89d423dc48..339f9a064745 100644 --- a/lib/libuutil/Makefile.am +++ b/lib/libuutil/Makefile.am @@ -26,4 +26,4 @@ endif libuutil_la_LDFLAGS += -version-info 3:0:0 -EXTRA_DIST += $(addprefix %D%/,libuutil.abi libuutil.suppr) +dist_noinst_DATA += %D%/libuutil.abi %D%/libuutil.suppr diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 07414c4a308b..f5eb84679204 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -76,5 +76,5 @@ libzfs_la_LDFLAGS += -version-info 5:0:1 pkgconfig_DATA += %D%/libzfs.pc -EXTRA_DIST += $(addprefix %D%/,libzfs.abi libzfs.suppr) -EXTRA_DIST += $(addprefix %D%/,THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip) +dist_noinst_DATA += %D%/libzfs.abi %D%/libzfs.suppr +dist_noinst_DATA += %D%/THIRDPARTYLICENSE.openssl %D%/THIRDPARTYLICENSE.openssl.descrip diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am index 9370da4e3e74..d1c6fb86d186 100644 --- a/lib/libzfs_core/Makefile.am +++ b/lib/libzfs_core/Makefile.am @@ -43,4 +43,4 @@ libzfs_core_la_LDFLAGS += -version-info 3:0:0 pkgconfig_DATA += %D%/libzfs_core.pc -EXTRA_DIST += $(addprefix %D%/,libzfs_core.abi libzfs_core.suppr) +dist_noinst_DATA += %D%/libzfs_core.abi %D%/libzfs_core.suppr diff --git a/lib/libzfsbootenv/Makefile.am b/lib/libzfsbootenv/Makefile.am index 7b87bfe6786b..118f154821fc 100644 --- a/lib/libzfsbootenv/Makefile.am +++ b/lib/libzfsbootenv/Makefile.am @@ -26,4 +26,4 @@ libzfsbootenv_la_LDFLAGS += -version-info 1:0:0 pkgconfig_DATA += %D%/libzfsbootenv.pc -EXTRA_DIST += $(addprefix %D%/,libzfsbootenv.abi libzfsbootenv.suppr) +dist_noinst_DATA += %D%/libzfsbootenv.abi %D%/libzfsbootenv.suppr diff --git a/man/Makefile.am b/man/Makefile.am index 362ee9b7e149..8fa21d2fd23e 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST += \ +dist_noinst_man_MANS = \ %D%/man1/cstyle.1 dist_man_MANS = \ @@ -105,8 +105,9 @@ nodist_man_MANS = \ %D%/man8/zed.8 \ %D%/man8/zfs-mount-generator.8 -SUBSTFILES += $(nodist_man_MANS) +dist_noinst_DATA += $(dist_noinst_man_MANS) $(dist_man_MANS) +SUBSTFILES += $(nodist_man_MANS) CHECKS += mancheck mancheck: diff --git a/rpm/Makefile.am b/rpm/Makefile.am index 216cb731fea9..af7b25021eac 100644 --- a/rpm/Makefile.am +++ b/rpm/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST += \ +dist_noinst_DATA += \ %D%/generic/zfs-dkms.spec.in \ %D%/generic/zfs-kmod.spec.in \ %D%/generic/zfs.spec.in \ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 6f1dc9ccdba5..79719e621b69 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -6,7 +6,7 @@ dist_scripts_SCRIPTS = \ %D%/zimport.sh \ %D%/zloop.sh -EXTRA_SCRIPTS = \ +dist_noinst_SCRIPTS = \ %D%/commitcheck.sh \ %D%/common.sh.in \ %D%/dkms.mkconf \ @@ -18,14 +18,13 @@ EXTRA_SCRIPTS = \ %D%/paxcheck.sh \ %D%/zfs-tests-color.sh -EXTRA_DIST += \ +dist_noinst_DATA += \ %D%/cstyle.pl \ %D%/enum-extract.pl \ %D%/zfs2zol-patch.sed \ - %D%/zol2zfs-patch.sed \ - $(EXTRA_SCRIPTS) + %D%/zol2zfs-patch.sed -SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) $(EXTRA_SCRIPTS) +SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) $(dist_noinst_SCRIPTS) define SCRIPTS_EXTRA_ENVIRONMENT diff --git a/tests/Makefile.am b/tests/Makefile.am index d6ca957eccc8..2e633041ab59 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -25,6 +25,6 @@ dist_scripts_runfiles_DATA = \ %D%/runfiles/sunos.run -EXTRA_DIST += $(addprefix %D%/,README.md) +dist_noinst_DATA += %D%/README.md SHELLCHECKSCRIPTS += $(shell find $(srcdir)/%D% -name '*.sh') diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am index 71edd4939424..e3c9874dcd54 100644 --- a/tests/zfs-tests/cmd/Makefile.am +++ b/tests/zfs-tests/cmd/Makefile.am @@ -41,7 +41,7 @@ scripts_zfs_tests_bin_PROGRAMS += %D%/draid libnvpair.la %C%_draid_LDADD += $(ZLIB_LIBS) -EXTRA_DIST += $(addprefix %D%/,file/file_common.h) +dist_noinst_DATA += %D%/file/file_common.h scripts_zfs_tests_bin_PROGRAMS += %D%/file_append %D%/file_check %D%/file_trunc %D%/file_write %D%/largest_file %D%/randwritecomp %C%_file_append_SOURCES = %D%/file/file_append.c %C%_file_check_SOURCES = %D%/file/file_check.c @@ -116,7 +116,7 @@ scripts_zfs_tests_bin_PROGRAMS += %D%/xattrtest scripts_zfs_tests_bin_PROGRAMS += %D%/zed_fd_spill-zedlet -EXTRA_DIST += $(addprefix %D%/,linux_dos_attributes/dos_attributes.h) +dist_noinst_DATA += %D%/linux_dos_attributes/dos_attributes.h scripts_zfs_tests_bin_PROGRAMS += %D%/read_dos_attributes %D%/write_dos_attributes %C%_read_dos_attributes_SOURCES = %D%/linux_dos_attributes/read_dos_attributes.c %C%_write_dos_attributes_SOURCES = %D%/linux_dos_attributes/write_dos_attributes.c diff --git a/tests/zfs-tests/tests/Makefile.am b/tests/zfs-tests/tests/Makefile.am index 49f9f3aaa7d6..a91a24d16680 100644 --- a/tests/zfs-tests/tests/Makefile.am +++ b/tests/zfs-tests/tests/Makefile.am @@ -1,5 +1,5 @@ CLEANFILES = -EXTRA_DIST = +dist_noinst_DATA = include $(top_srcdir)/config/Substfiles.am From 152d6fda54e61042a70059c95c44b364aea0bbd8 Mon Sep 17 00:00:00 2001 From: Kevin Jin <33590050+jxdking@users.noreply.github.com> Date: Thu, 26 May 2022 12:36:14 -0400 Subject: [PATCH 094/119] Fix inflated quiesce time caused by lwb_tx during zil_commit() In current zil_commit() process, transaction lwb_tx is assigned in zil_lwb_write_issue(), and is committed in zil_lwb_flush_vdevs_done(). Thus, during lwb write out process, the txg is held in open or quiesing state, until zil_lwb_flush_vdevs_done() is called. If the zil's zio latency is high, it will cause txg_sync_thread() to starve. The goal here is to defer waiting for zil_lwb_flush_vdevs_done to the 'syncing' txg state. That is, in zil_sync(). In this patch, it achieves the goal without holding transaction. A new function zil_lwb_flush_wait_all() is introduced. It waits for the completion of all the zil_lwb_flush_vdevs_done() by given txg. Reviewed-by: Alexander Motin Reviewed-by: Brian Behlendorf Reviewed-by: Prakash Surya Signed-off-by: jxdking Closes #12321 --- include/sys/zil_impl.h | 8 +++- module/zfs/zil.c | 89 ++++++++++++++++++++++++++++++++---------- 2 files changed, 76 insertions(+), 21 deletions(-) diff --git a/include/sys/zil_impl.h b/include/sys/zil_impl.h index d2f4018653a6..8409ce864e90 100644 --- a/include/sys/zil_impl.h +++ b/include/sys/zil_impl.h @@ -99,7 +99,7 @@ typedef struct lwb { char *lwb_buf; /* log write buffer */ zio_t *lwb_write_zio; /* zio for the lwb buffer */ zio_t *lwb_root_zio; /* root zio for lwb write and flushes */ - dmu_tx_t *lwb_tx; /* tx for log block allocation */ + uint64_t lwb_issued_txg; /* the txg when the write is issued */ uint64_t lwb_max_txg; /* highest txg in this lwb */ list_node_t lwb_node; /* zilog->zl_lwb_list linkage */ list_t lwb_itxs; /* list of itx's */ @@ -209,6 +209,12 @@ struct zilog { uint_t zl_prev_rotor; /* rotor for zl_prev[] */ txg_node_t zl_dirty_link; /* protected by dp_dirty_zilogs list */ uint64_t zl_dirty_max_txg; /* highest txg used to dirty zilog */ + + kmutex_t zl_lwb_io_lock; /* protect following members */ + uint64_t zl_lwb_inflight[TXG_SIZE]; /* io issued, but not done */ + kcondvar_t zl_lwb_io_cv; /* signal when the flush is done */ + uint64_t zl_lwb_max_issued_txg; /* max txg when lwb io issued */ + /* * Max block size for this ZIL. Note that this can not be changed * while the ZIL is in use because consumers (ZPL/zvol) need to take diff --git a/module/zfs/zil.c b/module/zfs/zil.c index 161ce3c97e71..ec09691b241b 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -559,8 +559,8 @@ zil_alloc_lwb(zilog_t *zilog, blkptr_t *bp, boolean_t slog, uint64_t txg, lwb->lwb_max_txg = txg; lwb->lwb_write_zio = NULL; lwb->lwb_root_zio = NULL; - lwb->lwb_tx = NULL; lwb->lwb_issued_timestamp = 0; + lwb->lwb_issued_txg = 0; if (BP_GET_CHECKSUM(bp) == ZIO_CHECKSUM_ZILOG2) { lwb->lwb_nused = sizeof (zil_chain_t); lwb->lwb_sz = BP_GET_LSIZE(bp); @@ -1183,9 +1183,9 @@ zil_lwb_flush_vdevs_done(zio_t *zio) { lwb_t *lwb = zio->io_private; zilog_t *zilog = lwb->lwb_zilog; - dmu_tx_t *tx = lwb->lwb_tx; zil_commit_waiter_t *zcw; itx_t *itx; + uint64_t txg; spa_config_exit(zilog->zl_spa, SCL_STATE, lwb); @@ -1194,15 +1194,13 @@ zil_lwb_flush_vdevs_done(zio_t *zio) mutex_enter(&zilog->zl_lock); /* - * Ensure the lwb buffer pointer is cleared before releasing the - * txg. If we have had an allocation failure and the txg is + * If we have had an allocation failure and the txg is * waiting to sync then we want zil_sync() to remove the lwb so * that it's not picked up as the next new one in * zil_process_commit_list(). zil_sync() will only remove the * lwb if lwb_buf is null. */ lwb->lwb_buf = NULL; - lwb->lwb_tx = NULL; ASSERT3U(lwb->lwb_issued_timestamp, >, 0); zilog->zl_last_lwb_latency = gethrtime() - lwb->lwb_issued_timestamp; @@ -1261,12 +1259,47 @@ zil_lwb_flush_vdevs_done(zio_t *zio) mutex_exit(&zilog->zl_lock); - /* - * Now that we've written this log block, we have a stable pointer - * to the next block in the chain, so it's OK to let the txg in - * which we allocated the next block sync. - */ - dmu_tx_commit(tx); + mutex_enter(&zilog->zl_lwb_io_lock); + txg = lwb->lwb_issued_txg; + ASSERT3U(zilog->zl_lwb_inflight[txg & TXG_MASK], >, 0); + zilog->zl_lwb_inflight[txg & TXG_MASK]--; + if (zilog->zl_lwb_inflight[txg & TXG_MASK] == 0) + cv_broadcast(&zilog->zl_lwb_io_cv); + mutex_exit(&zilog->zl_lwb_io_lock); +} + +/* + * Wait for the completion of all issued write/flush of that txg provided. + * It guarantees zil_lwb_flush_vdevs_done() is called and returned. + */ +static void +zil_lwb_flush_wait_all(zilog_t *zilog, uint64_t txg) +{ + ASSERT3U(txg, ==, spa_syncing_txg(zilog->zl_spa)); + + mutex_enter(&zilog->zl_lwb_io_lock); + while (zilog->zl_lwb_inflight[txg & TXG_MASK] > 0) + cv_wait(&zilog->zl_lwb_io_cv, &zilog->zl_lwb_io_lock); + mutex_exit(&zilog->zl_lwb_io_lock); + +#ifdef ZFS_DEBUG + mutex_enter(&zilog->zl_lock); + mutex_enter(&zilog->zl_lwb_io_lock); + lwb_t *lwb = list_head(&zilog->zl_lwb_list); + while (lwb != NULL && lwb->lwb_max_txg <= txg) { + if (lwb->lwb_issued_txg <= txg) { + ASSERT(lwb->lwb_state != LWB_STATE_ISSUED); + ASSERT(lwb->lwb_state != LWB_STATE_WRITE_DONE); + IMPLY(lwb->lwb_issued_txg > 0, + lwb->lwb_state == LWB_STATE_FLUSH_DONE); + } + IMPLY(lwb->lwb_state == LWB_STATE_FLUSH_DONE, + lwb->lwb_buf == NULL); + lwb = list_next(&zilog->zl_lwb_list, lwb); + } + mutex_exit(&zilog->zl_lwb_io_lock); + mutex_exit(&zilog->zl_lock); +#endif } /* @@ -1562,11 +1595,6 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) /* * Allocate the next block and save its address in this block * before writing it in order to establish the log chain. - * Note that if the allocation of nlwb synced before we wrote - * the block that points at it (lwb), we'd leak it if we crashed. - * Therefore, we don't do dmu_tx_commit() until zil_lwb_write_done(). - * We dirty the dataset to ensure that zil_sync() will be called - * to clean up in the event of allocation failure or I/O failure. */ tx = dmu_tx_create(zilog->zl_os); @@ -1582,7 +1610,11 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx); txg = dmu_tx_get_txg(tx); - lwb->lwb_tx = tx; + mutex_enter(&zilog->zl_lwb_io_lock); + lwb->lwb_issued_txg = txg; + zilog->zl_lwb_inflight[txg & TXG_MASK]++; + zilog->zl_lwb_max_issued_txg = MAX(txg, zilog->zl_lwb_max_issued_txg); + mutex_exit(&zilog->zl_lwb_io_lock); /* * Log blocks are pre-allocated. Here we select the size of the next @@ -1657,6 +1689,8 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *lwb) zio_nowait(lwb->lwb_root_zio); zio_nowait(lwb->lwb_write_zio); + dmu_tx_commit(tx); + /* * If there was an allocation failure then nlwb will be null which * forces a txg_wait_synced(). @@ -3124,6 +3158,8 @@ zil_sync(zilog_t *zilog, dmu_tx_t *tx) if (spa_sync_pass(spa) != 1) return; + zil_lwb_flush_wait_all(zilog, txg); + mutex_enter(&zilog->zl_lock); ASSERT(zilog->zl_stop_sync == 0); @@ -3290,6 +3326,7 @@ zil_alloc(objset_t *os, zil_header_t *zh_phys) mutex_init(&zilog->zl_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&zilog->zl_issuer_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&zilog->zl_lwb_io_lock, NULL, MUTEX_DEFAULT, NULL); for (int i = 0; i < TXG_SIZE; i++) { mutex_init(&zilog->zl_itxg[i].itxg_lock, NULL, @@ -3303,6 +3340,7 @@ zil_alloc(objset_t *os, zil_header_t *zh_phys) offsetof(itx_t, itx_node)); cv_init(&zilog->zl_cv_suspend, NULL, CV_DEFAULT, NULL); + cv_init(&zilog->zl_lwb_io_cv, NULL, CV_DEFAULT, NULL); return (zilog); } @@ -3338,8 +3376,10 @@ zil_free(zilog_t *zilog) mutex_destroy(&zilog->zl_issuer_lock); mutex_destroy(&zilog->zl_lock); + mutex_destroy(&zilog->zl_lwb_io_lock); cv_destroy(&zilog->zl_cv_suspend); + cv_destroy(&zilog->zl_lwb_io_cv); kmem_free(zilog, sizeof (zilog_t)); } @@ -3387,9 +3427,18 @@ zil_close(zilog_t *zilog) mutex_exit(&zilog->zl_lock); /* - * We need to use txg_wait_synced() to wait long enough for the - * ZIL to be clean, and to wait for all pending lwbs to be - * written out. + * zl_lwb_max_issued_txg may be larger than lwb_max_txg. It depends + * on the time when the dmu_tx transaction is assigned in + * zil_lwb_write_issue(). + */ + mutex_enter(&zilog->zl_lwb_io_lock); + txg = MAX(zilog->zl_lwb_max_issued_txg, txg); + mutex_exit(&zilog->zl_lwb_io_lock); + + /* + * We need to use txg_wait_synced() to wait until that txg is synced. + * zil_sync() will guarantee all lwbs up to that txg have been + * written out, flushed, and cleaned. */ if (txg != 0) txg_wait_synced(zilog->zl_dmu_pool, txg); From 5f264996f4dc2d5279afe96698688a20c281c473 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 27 May 2022 20:28:51 +0000 Subject: [PATCH 095/119] Linux 5.18 compat: bio_alloc() As for the Linux 5.18 kernel bio_alloc() expects a block_device struct as an argument. This removes the need for the bio_set_dev() compatibility code for 5.18 and newer kernels. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13515 --- module/os/linux/zfs/vdev_disk.c | 53 ++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index 235cd1691c14..cf2d7386b952 100644 --- a/module/os/linux/zfs/vdev_disk.c +++ b/module/os/linux/zfs/vdev_disk.c @@ -460,6 +460,13 @@ vdev_submit_bio_impl(struct bio *bio) #define preempt_schedule_notrace(x) preempt_schedule(x) #endif +/* + * As for the Linux 5.18 kernel bio_alloc() expects a block_device struct + * as an argument removing the need to set it with bio_set_dev(). This + * removes the need for all of the following compatibility code. + */ +#if !defined(HAVE_BIO_ALLOC_4ARG) + #ifdef HAVE_BIO_SET_DEV #if defined(CONFIG_BLK_CGROUP) && defined(HAVE_BIO_SET_DEV_GPL_ONLY) /* @@ -556,6 +563,7 @@ bio_set_dev(struct bio *bio, struct block_device *bdev) bio->bi_bdev = bdev; } #endif /* HAVE_BIO_SET_DEV */ +#endif /* !HAVE_BIO_ALLOC_4ARG */ static inline void vdev_submit_bio(struct bio *bio) @@ -566,10 +574,36 @@ vdev_submit_bio(struct bio *bio) current->bio_list = bio_list; } +static inline struct bio * +vdev_bio_alloc(struct block_device *bdev, gfp_t gfp_mask, + unsigned short nr_vecs) +{ + struct bio *bio; + #ifdef HAVE_BIO_ALLOC_4ARG -#define bio_alloc(gfp_mask, nr_iovecs) bio_alloc(NULL, nr_iovecs, 0, gfp_mask) + bio = bio_alloc(bdev, nr_vecs, 0, gfp_mask); +#else + bio = bio_alloc(gfp_mask, nr_vecs); + if (likely(bio != NULL)) + bio_set_dev(bio, bdev); #endif + return (bio); +} + +static inline unsigned int +vdev_bio_max_segs(zio_t *zio, int bio_size, uint64_t abd_offset) +{ + unsigned long nr_segs = abd_nr_pages_off(zio->io_abd, + bio_size, abd_offset); + +#ifdef HAVE_BIO_MAX_SEGS + return (bio_max_segs(nr_segs)); +#else + return (MIN(nr_segs, BIO_MAX_PAGES)); +#endif +} + static int __vdev_disk_physio(struct block_device *bdev, zio_t *zio, size_t io_size, uint64_t io_offset, int rw, int flags) @@ -581,6 +615,7 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio, int bio_count = 16; int error = 0; struct blk_plug plug; + unsigned short nr_vecs; /* * Accessing outside the block device is never allowed. @@ -632,15 +667,8 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio, goto retry; } - /* bio_alloc() with __GFP_WAIT never returns NULL */ -#ifdef HAVE_BIO_MAX_SEGS - dr->dr_bio[i] = bio_alloc(GFP_NOIO, bio_max_segs( - abd_nr_pages_off(zio->io_abd, bio_size, abd_offset))); -#else - dr->dr_bio[i] = bio_alloc(GFP_NOIO, - MIN(abd_nr_pages_off(zio->io_abd, bio_size, abd_offset), - BIO_MAX_PAGES)); -#endif + nr_vecs = vdev_bio_max_segs(zio, bio_size, abd_offset); + dr->dr_bio[i] = vdev_bio_alloc(bdev, GFP_NOIO, nr_vecs); if (unlikely(dr->dr_bio[i] == NULL)) { vdev_disk_dio_free(dr); return (SET_ERROR(ENOMEM)); @@ -649,7 +677,6 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio, /* Matching put called by vdev_disk_physio_completion */ vdev_disk_dio_get(dr); - bio_set_dev(dr->dr_bio[i], bdev); BIO_BI_SECTOR(dr->dr_bio[i]) = bio_offset >> 9; dr->dr_bio[i]->bi_end_io = vdev_disk_physio_completion; dr->dr_bio[i]->bi_private = dr; @@ -713,14 +740,12 @@ vdev_disk_io_flush(struct block_device *bdev, zio_t *zio) if (!q) return (SET_ERROR(ENXIO)); - bio = bio_alloc(GFP_NOIO, 0); - /* bio_alloc() with __GFP_WAIT never returns NULL */ + bio = vdev_bio_alloc(bdev, GFP_NOIO, 0); if (unlikely(bio == NULL)) return (SET_ERROR(ENOMEM)); bio->bi_end_io = vdev_disk_io_flush_completion; bio->bi_private = zio; - bio_set_dev(bio, bdev); bio_set_flush(bio); vdev_submit_bio(bio); invalidate_bdev(bdev); From 5e4aedaca7cee981ed21ac856fd27b4682bb7888 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 27 May 2022 17:51:55 +0000 Subject: [PATCH 096/119] Linux 5.19 compat: bdev_max_discard_sectors() Linux 5.19 commit torvalds/linux@70200574cc removed the blk_queue_discard() helper function. The preferred interface is to now use the bdev_max_discard_sectors() function to check for discard support. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13515 --- config/kernel-blk-queue.m4 | 32 ++++++++++++++++--- config/kernel-vfs-iov_iter.m4 | 2 ++ include/os/linux/kernel/linux/blkdev_compat.h | 19 +++++++++++ module/os/linux/zfs/vdev_disk.c | 2 +- module/os/linux/zfs/zvol_os.c | 2 ++ 5 files changed, 51 insertions(+), 6 deletions(-) diff --git a/config/kernel-blk-queue.m4 b/config/kernel-blk-queue.m4 index 2472c49dda4b..c6021de2e6c7 100644 --- a/config/kernel-blk-queue.m4 +++ b/config/kernel-blk-queue.m4 @@ -74,6 +74,8 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD], [ AC_DEFINE(HAVE_BLK_QUEUE_UPDATE_READAHEAD, 1, [blk_queue_update_readahead() exists]) ],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING([whether disk_update_readahead() exists]) ZFS_LINUX_TEST_RESULT([disk_update_readahead], [ AC_MSG_RESULT(yes) @@ -86,10 +88,19 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD], [ ]) dnl # -dnl # 2.6.32 API, -dnl # blk_queue_discard() +dnl # 5.19: bdev_max_discard_sectors() available +dnl # 2.6.32: blk_queue_discard() available dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ + ZFS_LINUX_TEST_SRC([bdev_max_discard_sectors], [ + #include + ],[ + struct block_device *bdev __attribute__ ((unused)) = NULL; + unsigned int error __attribute__ ((unused)); + + error = bdev_max_discard_sectors(bdev); + ]) + ZFS_LINUX_TEST_SRC([blk_queue_discard], [ #include ],[ @@ -102,11 +113,22 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ ]) AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ - AC_MSG_CHECKING([whether blk_queue_discard() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_discard], [ + AC_MSG_CHECKING([whether bdev_max_discard_sectors() is available]) + ZFS_LINUX_TEST_RESULT([bdev_max_discard_sectors], [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BDEV_MAX_DISCARD_SECTORS, 1, + [bdev_max_discard_sectors() is available]) ],[ - ZFS_LINUX_TEST_ERROR([blk_queue_discard]) + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether blk_queue_discard() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_discard], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1, + [blk_queue_discard() is available]) + ],[ + ZFS_LINUX_TEST_ERROR([blk_queue_discard]) + ]) ]) ]) diff --git a/config/kernel-vfs-iov_iter.m4 b/config/kernel-vfs-iov_iter.m4 index 57f78745a24b..e0617faab02c 100644 --- a/config/kernel-vfs-iov_iter.m4 +++ b/config/kernel-vfs-iov_iter.m4 @@ -134,6 +134,8 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [ AC_DEFINE(HAVE_IOV_ITER_FAULT_IN_READABLE, 1, [iov_iter_fault_in_readable() is available]) ],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available]) ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [ AC_MSG_RESULT(yes) diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index 9fa8884bb7a1..084d48c876d5 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -494,6 +494,25 @@ blk_queue_discard_granularity(struct request_queue *q, unsigned int dg) q->limits.discard_granularity = dg; } +/* + * 5.19 API, + * bdev_max_discard_sectors() + * + * 2.6.32 API, + * blk_queue_discard() + */ +static inline boolean_t +bdev_discard_supported(struct block_device *bdev) +{ +#if defined(HAVE_BDEV_MAX_DISCARD_SECTORS) + return (!!bdev_max_discard_sectors(bdev)); +#elif defined(HAVE_BLK_QUEUE_DISCARD) + return (!!blk_queue_discard(bdev_get_queue(bdev))); +#else +#error "Unsupported kernel" +#endif +} + /* * 4.8 API, * blk_queue_secure_erase() diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index cf2d7386b952..90930b83f881 100644 --- a/module/os/linux/zfs/vdev_disk.c +++ b/module/os/linux/zfs/vdev_disk.c @@ -316,7 +316,7 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, v->vdev_nowritecache = B_FALSE; /* Set when device reports it supports TRIM. */ - v->vdev_has_trim = !!blk_queue_discard(q); + v->vdev_has_trim = bdev_discard_supported(vd->vd_bdev); /* Set when device reports it supports secure TRIM. */ v->vdev_has_securetrim = !!blk_queue_discard_secure(q); diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 4ebdf8331695..39441700ae8c 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -1053,7 +1053,9 @@ zvol_os_create_minor(const char *name) (zvol_max_discard_blocks * zv->zv_volblocksize) >> 9); blk_queue_discard_granularity(zv->zv_zso->zvo_queue, zv->zv_volblocksize); +#ifdef QUEUE_FLAG_DISCARD blk_queue_flag_set(QUEUE_FLAG_DISCARD, zv->zv_zso->zvo_queue); +#endif #ifdef QUEUE_FLAG_NONROT blk_queue_flag_set(QUEUE_FLAG_NONROT, zv->zv_zso->zvo_queue); #endif From e2c31f2bc7d190fbd8fc5c13bac23daffc5d7b56 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 27 May 2022 18:20:04 +0000 Subject: [PATCH 097/119] Linux 5.19 compat: bdev_max_secure_erase_sectors() Linux 5.19 commit torvalds/linux@44abff2c0 removed the blk_queue_secure_erase() helper function. The preferred interface is to now use the bdev_max_secure_erase_sectors() function to check for discard support. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13515 --- config/kernel-blk-queue.m4 | 44 +++++++++++++------ include/os/linux/kernel/linux/blkdev_compat.h | 17 ++++--- module/os/linux/zfs/vdev_disk.c | 6 +-- 3 files changed, 43 insertions(+), 24 deletions(-) diff --git a/config/kernel-blk-queue.m4 b/config/kernel-blk-queue.m4 index c6021de2e6c7..6f42b98125cd 100644 --- a/config/kernel-blk-queue.m4 +++ b/config/kernel-blk-queue.m4 @@ -133,13 +133,20 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ ]) dnl # -dnl # 4.8 API, -dnl # blk_queue_secure_erase() -dnl # -dnl # 2.6.36 - 4.7 API, -dnl # blk_queue_secdiscard() +dnl # 5.19: bdev_max_secure_erase_sectors() available +dnl # 4.8: blk_queue_secure_erase() available +dnl # 2.6.36: blk_queue_secdiscard() available dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ + ZFS_LINUX_TEST_SRC([bdev_max_secure_erase_sectors], [ + #include + ],[ + struct block_device *bdev __attribute__ ((unused)) = NULL; + unsigned int error __attribute__ ((unused)); + + error = bdev_max_secure_erase_sectors(bdev); + ]) + ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ #include ],[ @@ -162,21 +169,30 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ ]) AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [ - AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ + AC_MSG_CHECKING([whether bdev_max_secure_erase_sectors() is available]) + ZFS_LINUX_TEST_RESULT([bdev_max_secure_erase_sectors], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, - [blk_queue_secure_erase() is available]) + AC_DEFINE(HAVE_BDEV_MAX_SECURE_ERASE_SECTORS, 1, + [bdev_max_secure_erase_sectors() is available]) ],[ AC_MSG_RESULT(no) - AC_MSG_CHECKING([whether blk_queue_secdiscard() is available]) - ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [ + AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1, - [blk_queue_secdiscard() is available]) + AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, + [blk_queue_secure_erase() is available]) ],[ - ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase]) + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether blk_queue_secdiscard() is available]) + ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1, + [blk_queue_secdiscard() is available]) + ],[ + ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase]) + ]) ]) ]) ]) diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index 084d48c876d5..da188b4eaf89 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -514,21 +514,26 @@ bdev_discard_supported(struct block_device *bdev) } /* + * 5.19 API, + * bdev_max_secure_erase_sectors() + * * 4.8 API, * blk_queue_secure_erase() * * 2.6.36 - 4.7 API, * blk_queue_secdiscard() */ -static inline int -blk_queue_discard_secure(struct request_queue *q) +static inline boolean_t +bdev_secure_discard_supported(struct block_device *bdev) { -#if defined(HAVE_BLK_QUEUE_SECURE_ERASE) - return (blk_queue_secure_erase(q)); +#if defined(HAVE_BDEV_MAX_SECURE_ERASE_SECTORS) + return (!!bdev_max_secure_erase_sectors(bdev)); +#elif defined(HAVE_BLK_QUEUE_SECURE_ERASE) + return (!!blk_queue_secure_erase(bdev_get_queue(bdev))); #elif defined(HAVE_BLK_QUEUE_SECDISCARD) - return (blk_queue_secdiscard(q)); + return (!!blk_queue_secdiscard(bdev_get_queue(bdev))); #else - return (0); +#error "Unsupported kernel" #endif } diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index 90930b83f881..5d87e92118e5 100644 --- a/module/os/linux/zfs/vdev_disk.c +++ b/module/os/linux/zfs/vdev_disk.c @@ -304,8 +304,6 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, rw_exit(&vd->vd_lock); } - struct request_queue *q = bdev_get_queue(vd->vd_bdev); - /* Determine the physical block size */ int physical_block_size = bdev_physical_block_size(vd->vd_bdev); @@ -319,10 +317,10 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize, v->vdev_has_trim = bdev_discard_supported(vd->vd_bdev); /* Set when device reports it supports secure TRIM. */ - v->vdev_has_securetrim = !!blk_queue_discard_secure(q); + v->vdev_has_securetrim = bdev_secure_discard_supported(vd->vd_bdev); /* Inform the ZIO pipeline that we are non-rotational */ - v->vdev_nonrot = blk_queue_nonrot(q); + v->vdev_nonrot = blk_queue_nonrot(bdev_get_queue(vd->vd_bdev)); /* Physical volume size in bytes for the partition */ *psize = bdev_capacity(vd->vd_bdev); From a12a5cb5b821f24f26d388094cdac79deb0e879f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 27 May 2022 19:40:22 +0000 Subject: [PATCH 098/119] Linux 5.19 compat: blkdev_issue_secure_erase() Linux 5.19 commit torvalds/linux@44abff2c0 splits the secure erase functionality from the blkdev_issue_discard() function. The blkdev_issue_secure_erase() must now be issued to issue a secure erase. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13515 --- config/kernel-blkdev.m4 | 53 +++++++++++++++++++++++++++++++++ module/os/linux/zfs/vdev_disk.c | 37 +++++++++++++++++------ 2 files changed, 81 insertions(+), 9 deletions(-) diff --git a/config/kernel-blkdev.m4 b/config/kernel-blkdev.m4 index 9c60e5dd4210..fb7b1a458638 100644 --- a/config/kernel-blkdev.m4 +++ b/config/kernel-blkdev.m4 @@ -294,6 +294,57 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE], [ ]) ]) +dnl # +dnl # 5.19 API: blkdev_issue_secure_erase() +dnl # 3.10 API: blkdev_issue_discard(..., BLKDEV_DISCARD_SECURE) +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_ISSUE_SECURE_ERASE], [ + ZFS_LINUX_TEST_SRC([blkdev_issue_secure_erase], [ + #include + ],[ + struct block_device *bdev = NULL; + sector_t sector = 0; + sector_t nr_sects = 0; + int error __attribute__ ((unused)); + + error = blkdev_issue_secure_erase(bdev, + sector, nr_sects, GFP_KERNEL); + ]) + + ZFS_LINUX_TEST_SRC([blkdev_issue_discard_flags], [ + #include + ],[ + struct block_device *bdev = NULL; + sector_t sector = 0; + sector_t nr_sects = 0; + unsigned long flags = 0; + int error __attribute__ ((unused)); + + error = blkdev_issue_discard(bdev, + sector, nr_sects, GFP_KERNEL, flags); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_ISSUE_SECURE_ERASE], [ + AC_MSG_CHECKING([whether blkdev_issue_secure_erase() is available]) + ZFS_LINUX_TEST_RESULT([blkdev_issue_secure_erase], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLKDEV_ISSUE_SECURE_ERASE, 1, + [blkdev_issue_secure_erase() is available]) + ],[ + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether blkdev_issue_discard() is available]) + ZFS_LINUX_TEST_RESULT([blkdev_issue_discard_flags], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BLKDEV_ISSUE_DISCARD, 1, + [blkdev_issue_discard() is available]) + ],[ + ZFS_LINUX_TEST_ERROR([blkdev_issue_discard()]) + ]) + ]) +]) + dnl # dnl # 5.13 API change dnl # blkdev_get_by_path() no longer handles ERESTARTSYS @@ -326,6 +377,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [ ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE + ZFS_AC_KERNEL_SRC_BLKDEV_ISSUE_SECURE_ERASE ]) AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [ @@ -340,4 +392,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [ ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE ZFS_AC_KERNEL_BLKDEV_GET_ERESTARTSYS + ZFS_AC_KERNEL_BLKDEV_ISSUE_SECURE_ERASE ]) diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index 5d87e92118e5..9a382261df73 100644 --- a/module/os/linux/zfs/vdev_disk.c +++ b/module/os/linux/zfs/vdev_disk.c @@ -751,12 +751,38 @@ vdev_disk_io_flush(struct block_device *bdev, zio_t *zio) return (0); } +static int +vdev_disk_io_trim(zio_t *zio) +{ + vdev_t *v = zio->io_vd; + vdev_disk_t *vd = v->vdev_tsd; + +#if defined(HAVE_BLKDEV_ISSUE_SECURE_ERASE) + if (zio->io_trim_flags & ZIO_TRIM_SECURE) { + return (-blkdev_issue_secure_erase(vd->vd_bdev, + zio->io_offset >> 9, zio->io_size >> 9, GFP_NOFS)); + } else { + return (-blkdev_issue_discard(vd->vd_bdev, + zio->io_offset >> 9, zio->io_size >> 9, GFP_NOFS)); + } +#elif defined(HAVE_BLKDEV_ISSUE_DISCARD) + unsigned long trim_flags = 0; +#if defined(BLKDEV_DISCARD_SECURE) + if (zio->io_trim_flags & ZIO_TRIM_SECURE) + trim_flags |= BLKDEV_DISCARD_SECURE; +#endif + return (-blkdev_issue_discard(vd->vd_bdev, + zio->io_offset >> 9, zio->io_size >> 9, GFP_NOFS, trim_flags)); +#else +#error "Unsupported kernel" +#endif +} + static void vdev_disk_io_start(zio_t *zio) { vdev_t *v = zio->io_vd; vdev_disk_t *vd = v->vdev_tsd; - unsigned long trim_flags = 0; int rw, error; /* @@ -829,14 +855,7 @@ vdev_disk_io_start(zio_t *zio) break; case ZIO_TYPE_TRIM: -#if defined(BLKDEV_DISCARD_SECURE) - if (zio->io_trim_flags & ZIO_TRIM_SECURE) - trim_flags |= BLKDEV_DISCARD_SECURE; -#endif - zio->io_error = -blkdev_issue_discard(vd->vd_bdev, - zio->io_offset >> 9, zio->io_size >> 9, GFP_NOFS, - trim_flags); - + zio->io_error = vdev_disk_io_trim(zio); rw_exit(&vd->vd_lock); zio_interrupt(zio); return; From c2c2e7bb8b7c269904777b61f4b0a678f1ffb9a3 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 27 May 2022 20:44:43 +0000 Subject: [PATCH 099/119] Linux 5.19 compat: aops->read_folio() As of the Linux 5.19 kernel the readpage() address space operation has been replaced by read_folio(). Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13515 --- config/kernel-vfs-read_folio.m4 | 32 ++++++++++++++++++++++++++++++++ config/kernel.m4 | 2 ++ module/os/linux/zfs/zpl_file.c | 12 ++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 config/kernel-vfs-read_folio.m4 diff --git a/config/kernel-vfs-read_folio.m4 b/config/kernel-vfs-read_folio.m4 new file mode 100644 index 000000000000..234d1212ab98 --- /dev/null +++ b/config/kernel-vfs-read_folio.m4 @@ -0,0 +1,32 @@ +dnl # +dnl # Linux 5.19 uses read_folio in lieu of readpage +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_READ_FOLIO], [ + ZFS_LINUX_TEST_SRC([vfs_has_read_folio], [ + #include + + static int + test_read_folio(struct file *file, struct folio *folio) { + (void) file; (void) folio; + return (0); + } + + static const struct address_space_operations + aops __attribute__ ((unused)) = { + .read_folio = test_read_folio, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_VFS_READ_FOLIO], [ + dnl # + dnl # Linux 5.19 uses read_folio in lieu of readpage + dnl # + AC_MSG_CHECKING([read_folio exists]) + ZFS_LINUX_TEST_RESULT([vfs_has_read_folio], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_VFS_READ_FOLIO, 1, [read_folio exists]) + ],[ + AC_MSG_RESULT([no]) + ]) +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index a70db91a8364..eba3c066993d 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -102,6 +102,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_SGET ZFS_AC_KERNEL_SRC_LSEEK_EXECUTE ZFS_AC_KERNEL_SRC_VFS_FILEMAP_DIRTY_FOLIO + ZFS_AC_KERNEL_SRC_VFS_READ_FOLIO ZFS_AC_KERNEL_SRC_VFS_GETATTR ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS ZFS_AC_KERNEL_SRC_VFS_ITERATE @@ -219,6 +220,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_SGET ZFS_AC_KERNEL_LSEEK_EXECUTE ZFS_AC_KERNEL_VFS_FILEMAP_DIRTY_FOLIO + ZFS_AC_KERNEL_VFS_READ_FOLIO ZFS_AC_KERNEL_VFS_GETATTR ZFS_AC_KERNEL_VFS_FSYNC_2ARGS ZFS_AC_KERNEL_VFS_ITERATE diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c index 8b84eb795fc3..9a640fb40b67 100644 --- a/module/os/linux/zfs/zpl_file.c +++ b/module/os/linux/zfs/zpl_file.c @@ -674,11 +674,19 @@ zpl_readpage_common(struct page *pp) return (error); } +#ifdef HAVE_VFS_READ_FOLIO +static int +zpl_read_folio(struct file *filp, struct folio *folio) +{ + return (zpl_readpage_common(&folio->page)); +} +#else static int zpl_readpage(struct file *filp, struct page *pp) { return (zpl_readpage_common(pp)); } +#endif static int zpl_readpage_filler(void *data, struct page *pp) @@ -1208,7 +1216,11 @@ const struct address_space_operations zpl_address_space_operations = { #else .readahead = zpl_readahead, #endif +#ifdef HAVE_VFS_READ_FOLIO + .read_folio = zpl_read_folio, +#else .readpage = zpl_readpage, +#endif .writepage = zpl_writepage, .writepages = zpl_writepages, .direct_IO = zpl_direct_IO, From d41e864181e4544eca08332b31f85318a3b0e3b3 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 27 May 2022 21:31:03 +0000 Subject: [PATCH 100/119] Linux 5.19 compat: bdev_start_io_acct() / bdev_end_io_acct() As of the Linux 5.19 kernel the disk_*_io_acct() helper functions have been replaced by the bdev_*_io_acct() functions. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13515 --- config/kernel-generic_io_acct.m4 | 83 ++++++++++++------- include/os/linux/kernel/linux/blkdev_compat.h | 9 +- 2 files changed, 62 insertions(+), 30 deletions(-) diff --git a/config/kernel-generic_io_acct.m4 b/config/kernel-generic_io_acct.m4 index 0f4381db4c5e..a8a448c6fe96 100644 --- a/config/kernel-generic_io_acct.m4 +++ b/config/kernel-generic_io_acct.m4 @@ -2,6 +2,19 @@ dnl # dnl # Check for generic io accounting interface. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ + ZFS_LINUX_TEST_SRC([bdev_io_acct], [ + #include + ], [ + struct block_device *bdev = NULL; + struct bio *bio = NULL; + unsigned long passed_time = 0; + unsigned long start_time; + + start_time = bdev_start_io_acct(bdev, bio_sectors(bio), + bio_op(bio), passed_time); + bdev_end_io_acct(bdev, bio_op(bio), start_time); + ]) + ZFS_LINUX_TEST_SRC([disk_io_acct], [ #include ], [ @@ -50,61 +63,75 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ dnl # - dnl # 5.12 API, + dnl # 5.19 API, dnl # - dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported - dnl # so use disk_start_io_acct() and disk_end_io_acct() instead + dnl # disk_start_io_acct() and disk_end_io_acct() have been replaced by + dnl # bdev_start_io_acct() and bdev_end_io_acct(). dnl # - AC_MSG_CHECKING([whether generic disk_*_io_acct() are available]) - ZFS_LINUX_TEST_RESULT([disk_io_acct], [ + AC_MSG_CHECKING([whether generic bdev_*_io_acct() are available]) + ZFS_LINUX_TEST_RESULT([bdev_io_acct], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available]) + AC_DEFINE(HAVE_BDEV_IO_ACCT, 1, [bdev_*_io_acct() available]) ], [ AC_MSG_RESULT(no) dnl # - dnl # 5.7 API, + dnl # 5.12 API, dnl # - dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers. + dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported + dnl # so use disk_start_io_acct() and disk_end_io_acct() instead dnl # - AC_MSG_CHECKING([whether generic bio_*_io_acct() are available]) - ZFS_LINUX_TEST_RESULT([bio_io_acct], [ + AC_MSG_CHECKING([whether generic disk_*_io_acct() are available]) + ZFS_LINUX_TEST_RESULT([disk_io_acct], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available]) + AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available]) ], [ AC_MSG_RESULT(no) dnl # - dnl # 4.14 API, + dnl # 5.7 API, dnl # - dnl # generic_start_io_acct/generic_end_io_acct now require - dnl # request_queue to be provided. No functional changes, - dnl # but preparation for inflight accounting. + dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers. dnl # - AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args]) - ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args], - [generic_start_io_acct], [block/bio.c], [ + AC_MSG_CHECKING([whether generic bio_*_io_acct() are available]) + ZFS_LINUX_TEST_RESULT([bio_io_acct], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1, - [generic_*_io_acct() 4 arg available]) + AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available]) ], [ AC_MSG_RESULT(no) dnl # - dnl # 3.19 API addition + dnl # 4.14 API, dnl # - dnl # torvalds/linux@394ffa50 allows us to increment - dnl # iostat counters without generic_make_request(). + dnl # generic_start_io_acct/generic_end_io_acct now require + dnl # request_queue to be provided. No functional changes, + dnl # but preparation for inflight accounting. dnl # - AC_MSG_CHECKING( - [whether generic_*_io_acct wants 3 args]) - ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args], + AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args]) + ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args], [generic_start_io_acct], [block/bio.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1, - [generic_*_io_acct() 3 arg available]) + AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1, + [generic_*_io_acct() 4 arg available]) ], [ AC_MSG_RESULT(no) + + dnl # + dnl # 3.19 API addition + dnl # + dnl # torvalds/linux@394ffa50 allows us to increment + dnl # iostat counters without generic_make_request(). + dnl # + AC_MSG_CHECKING( + [whether generic_*_io_acct wants 3 args]) + ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args], + [generic_start_io_acct], [block/bio.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1, + [generic_*_io_acct() 3 arg available]) + ], [ + AC_MSG_RESULT(no) + ]) ]) ]) ]) diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index da188b4eaf89..fd91560a3cc4 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -551,7 +551,10 @@ blk_generic_start_io_acct(struct request_queue *q __attribute__((unused)), struct gendisk *disk __attribute__((unused)), int rw __attribute__((unused)), struct bio *bio) { -#if defined(HAVE_DISK_IO_ACCT) +#if defined(HAVE_BDEV_IO_ACCT) + return (bdev_start_io_acct(bio->bi_bdev, bio_sectors(bio), + bio_op(bio), jiffies)); +#elif defined(HAVE_DISK_IO_ACCT) return (disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio))); #elif defined(HAVE_BIO_IO_ACCT) return (bio_start_io_acct(bio)); @@ -574,7 +577,9 @@ blk_generic_end_io_acct(struct request_queue *q __attribute__((unused)), struct gendisk *disk __attribute__((unused)), int rw __attribute__((unused)), struct bio *bio, unsigned long start_time) { -#if defined(HAVE_DISK_IO_ACCT) +#if defined(HAVE_BDEV_IO_ACCT) + bdev_end_io_acct(bio->bi_bdev, bio_op(bio), start_time); +#elif defined(HAVE_DISK_IO_ACCT) disk_end_io_acct(disk, bio_op(bio), start_time); #elif defined(HAVE_BIO_IO_ACCT) bio_end_io_acct(bio, start_time); From 91350681b8c8b3f0a9b04e6ab3b8931406e87355 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 27 May 2022 15:56:05 -0700 Subject: [PATCH 101/119] Linux 5.19 compat: zap_flags_t conflict As of the Linux 5.19 kernel an identically named zap_flags_t typedef is declared in the include/linux/mm_types.h linux header. Sadly, the inclusion of this header cannot be easily avoided. To resolve the conflict a #define is used to remap the name in the OpenZFS sources when building against the Linux kernel. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13515 --- include/sys/zap.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/sys/zap.h b/include/sys/zap.h index b19b4643879c..fd7a3a1599bc 100644 --- a/include/sys/zap.h +++ b/include/sys/zap.h @@ -110,7 +110,12 @@ typedef enum zap_flags { * already randomly distributed. */ ZAP_FLAG_PRE_HASHED_KEY = 1 << 2, +#if defined(__linux__) && defined(_KERNEL) +} zfs_zap_flags_t; +#define zap_flags_t zfs_zap_flags_t +#else } zap_flags_t; +#endif /* * Create a new zapobj with no attributes and return its object number. From a70e613070a8ca96f8214ba1ff61549cbbad0a2f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 31 May 2022 14:38:00 -0700 Subject: [PATCH 102/119] Linux 5.18 compat: META Update the META file to reflect compatibility with the 5.18 kernel. Reviewed-by: George Melikov Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13527 --- META | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META b/META index e95803505873..f16f7972575f 100644 --- a/META +++ b/META @@ -6,5 +6,5 @@ Release: 1 Release-Tags: relext License: CDDL Author: OpenZFS -Linux-Maximum: 5.17 +Linux-Maximum: 5.18 Linux-Minimum: 3.10 From 2310dba9ebf6259515b63fda3202199831669271 Mon Sep 17 00:00:00 2001 From: Allan Jude Date: Tue, 31 May 2022 18:37:46 -0400 Subject: [PATCH 103/119] Fix typo in zil_commit() comment block Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Allan Jude Closes #13518 --- module/zfs/zil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/zil.c b/module/zfs/zil.c index ec09691b241b..9adf815517ac 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -2965,7 +2965,7 @@ zil_commit_itx_assign(zilog_t *zilog, zil_commit_waiter_t *zcw) * queue prior to zil_commit() having been called, and which itxs were * added after zil_commit() was called. * - * The commit it is special; it doesn't have any on-disk representation. + * The commit itx is special; it doesn't have any on-disk representation. * When a commit itx is "committed" to an lwb, the waiter associated * with it is linked onto the lwb's list of waiters. Then, when that lwb * completes, each waiter on the lwb's list is marked done and signaled From bc8192cd5b14cf4182bd2b19a6a8ed4f0bbed12b Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Tue, 31 May 2022 18:41:33 -0400 Subject: [PATCH 104/119] Corrected parameters for zstd early abort That'll teach me to try and recall them from the definition. Reviewed-by: Brian Behlendorf Signed-off-by: Rich Ercolani Closes #13519 --- man/man4/zfs.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man4/zfs.4 b/man/man4/zfs.4 index fa3159ab82ca..a086e1a5d56c 100644 --- a/man/man4/zfs.4 +++ b/man/man4/zfs.4 @@ -2139,11 +2139,11 @@ However, if there are fewer than metaslabs in the vdev, this functionality is disabled. This ensures that we don't set aside an unreasonable amount of space for the ZIL. . -.It Sy zfs_zstd_earlyabort_pass Ns = Ns Sy 1 Pq int +.It Sy zstd_earlyabort_pass Ns = Ns Sy 1 Pq int Whether heuristic for detection of incompressible data with zstd levels >= 3 using LZ4 and zstd-1 passes is enabled. . -.It Sy zfs_zstd_abort_size Ns = Ns Sy 131072 Pq int +.It Sy zstd_abort_size Ns = Ns Sy 131072 Pq int Minimal uncompressed size (inclusive) of a record before the early abort heuristic will be attempted. . From 42cf2ad0e4e2adfa232f42e4254693467a4cc08c Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 1 Jun 2022 12:54:35 -0400 Subject: [PATCH 105/119] Remove wrong assertion in log spacemap It is typical, but not generally true that if log summary has more blocks it must also have unflushed metaslabs. Normally with metaslabs flushed in order it works, but there are known exceptions, such as device removal or metaslab being loaded during its flush attempt. Before 600a02b8844 if spa_flush_metaslabs() hit loading metaslab it usually stopped (unless memlimit is also exceeded), but now it may flush more metaslabs, just skipping that particular one. This increased chances of assertion to fire when the skipped metaslab is flushed on next iteration if all other metaslabs in that summary entry are already flushed out of order. Reviewed-by: Brian Behlendorf Signed-off-by: Alexander Motin Sponsored-By: iXsystems, Inc. Closes #13486 Closes #13513 --- module/zfs/spa_log_spacemap.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/module/zfs/spa_log_spacemap.c b/module/zfs/spa_log_spacemap.c index f831509a4247..c5a1039bd838 100644 --- a/module/zfs/spa_log_spacemap.c +++ b/module/zfs/spa_log_spacemap.c @@ -511,12 +511,6 @@ spa_log_summary_decrement_blkcount(spa_t *spa, uint64_t blocks_gone) e->lse_txgcount--; for (; e != NULL; e = list_head(&spa->spa_log_summary)) { if (e->lse_blkcount > blocks_gone) { - /* - * Assert that we stopped at an entry that is not - * obsolete. - */ - ASSERT(e->lse_mscount != 0); - e->lse_blkcount -= blocks_gone; blocks_gone = 0; break; From 4c6526208db0d3d5abf44664e74d1e28156a3db7 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 31 May 2022 16:30:59 -0700 Subject: [PATCH 106/119] Linux 5.19 compat: asm/fpu/internal.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of the Linux 5.19 kernel the asm/fpu/internal.h header was entirely removed. It has been effectively empty since the 5.16 kernel and provides no required functionality. Reviewed-by: Tony Hutter Reviewed-by: Attila Fülöp Signed-off-by: Brian Behlendorf Closes #13529 --- config/kernel-fpu.m4 | 23 +++++++++++++++++++++-- include/os/linux/kernel/linux/simd_x86.h | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/config/kernel-fpu.m4 b/config/kernel-fpu.m4 index eb9520c60a7c..c6efebd8cf61 100644 --- a/config/kernel-fpu.m4 +++ b/config/kernel-fpu.m4 @@ -2,6 +2,9 @@ dnl # dnl # Handle differences in kernel FPU code. dnl # dnl # Kernel +dnl # 5.19: The asm/fpu/internal.h header was removed, it has been +dnl # effectively empty since the 5.16 kernel. +dnl # dnl # 5.11: kernel_fpu_begin() is an inlined function now, so don't check dnl # for it inside the kernel symbols. dnl # @@ -27,10 +30,22 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU_HEADER], [ ],[ AC_DEFINE(HAVE_KERNEL_FPU_API_HEADER, 1, [kernel has asm/fpu/api.h]) - AC_MSG_RESULT(asm/fpu/api.h) + + ZFS_LINUX_TRY_COMPILE([ + #include + #include + ],[ + ],[ + AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL_HEADER, 1, + [kernel has asm/fpu/internal.h]) + AC_MSG_RESULT([asm/fpu/api.h asm/fpu/internal.h]) + ],[ + AC_MSG_RESULT([asm/fpu/api.h]) + ]) ],[ - AC_MSG_RESULT(i387.h) + AC_MSG_RESULT([i387.h]) ]) + ]) AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [ @@ -38,7 +53,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [ #include #ifdef HAVE_KERNEL_FPU_API_HEADER #include + #ifdef HAVE_KERNEL_FPU_INTERNAL_HEADER #include + #endif #else #include #endif @@ -51,7 +68,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [ #include #ifdef HAVE_KERNEL_FPU_API_HEADER #include + #ifdef HAVE_KERNEL_FPU_INTERNAL_HEADER #include + #endif #else #include #endif diff --git a/include/os/linux/kernel/linux/simd_x86.h b/include/os/linux/kernel/linux/simd_x86.h index 0fc4168b74e0..3564ea7f1391 100644 --- a/include/os/linux/kernel/linux/simd_x86.h +++ b/include/os/linux/kernel/linux/simd_x86.h @@ -93,7 +93,9 @@ #if defined(HAVE_KERNEL_FPU_API_HEADER) #include +#if defined(HAVE_KERNEL_FPU_INTERNAL_HEADER) #include +#endif #else #include #endif From b9d98453f9387c413f91d1d9cdb0cba8e04dbd95 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 31 May 2022 16:42:49 -0700 Subject: [PATCH 107/119] autoconf: AC_MSG_CHECKING consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the wording more consistent for the kernel AC_MSG_CHECKING output (e.g. "checking whether ...".). Additionally, group some of the VFS interface checks with the others. No functional change. Reviewed-by: Tony Hutter Reviewed-by: Attila Fülöp Signed-off-by: Brian Behlendorf Closes #13529 --- config/kernel-bio.m4 | 4 ++-- config/kernel-pagemap-folio_wait_bit.m4 | 2 +- config/kernel-readpages.m4 | 2 +- config/kernel-shrink.m4 | 10 +++++----- config/kernel-sysfs.m4 | 2 +- config/kernel-vfs-filemap_dirty_folio.m4 | 2 +- config/kernel-vfs-read_folio.m4 | 2 +- config/kernel-vfs-set_page_dirty.m4 | 2 +- config/kernel.m4 | 8 ++++---- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/config/kernel-bio.m4 b/config/kernel-bio.m4 index b5d25448155f..18620ca5b7e4 100644 --- a/config/kernel-bio.m4 +++ b/config/kernel-bio.m4 @@ -464,7 +464,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_CGROUP_HEADER], [ ]) AC_DEFUN([ZFS_AC_KERNEL_BLK_CGROUP_HEADER], [ - AC_MSG_CHECKING([for existence of linux/blk-cgroup.h]) + AC_MSG_CHECKING([whether linux/blk-cgroup.h exists]) ZFS_LINUX_TEST_RESULT([blk_cgroup_header],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_LINUX_BLK_CGROUP_HEADER, 1, @@ -500,7 +500,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_ALLOC_4ARG], [ ]) AC_DEFUN([ZFS_AC_KERNEL_BIO_ALLOC_4ARG], [ - AC_MSG_CHECKING([for 4-argument bio_alloc()]) + AC_MSG_CHECKING([whether bio_alloc() wants 4 args]) ZFS_LINUX_TEST_RESULT([bio_alloc_4arg],[ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_BIO_ALLOC_4ARG], 1, [bio_alloc() takes 4 arguments]) diff --git a/config/kernel-pagemap-folio_wait_bit.m4 b/config/kernel-pagemap-folio_wait_bit.m4 index e0aaa4a57411..12d8841f51e6 100644 --- a/config/kernel-pagemap-folio_wait_bit.m4 +++ b/config/kernel-pagemap-folio_wait_bit.m4 @@ -15,7 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT], [ ]) AC_DEFUN([ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT], [ - AC_MSG_CHECKING([folio_wait_bit() exists]) + AC_MSG_CHECKING([whether folio_wait_bit() exists]) ZFS_LINUX_TEST_RESULT([pagemap_has_folio_wait_bit], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_PAGEMAP_FOLIO_WAIT_BIT, 1, diff --git a/config/kernel-readpages.m4 b/config/kernel-readpages.m4 index 0bf67ffd933d..be65a0d5e4b4 100644 --- a/config/kernel-readpages.m4 +++ b/config/kernel-readpages.m4 @@ -14,7 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_READPAGES], [ ]) AC_DEFUN([ZFS_AC_KERNEL_VFS_READPAGES], [ - AC_MSG_CHECKING([address_space_operations->readpages exists]) + AC_MSG_CHECKING([whether aops->readpages exists]) ZFS_LINUX_TEST_RESULT([vfs_has_readpages], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_VFS_READPAGES, 1, diff --git a/config/kernel-shrink.m4 b/config/kernel-shrink.m4 index a40c86d5c57f..8cf0f2761bde 100644 --- a/config/kernel-shrink.m4 +++ b/config/kernel-shrink.m4 @@ -84,7 +84,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [ AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[ dnl # dnl # 3.0 - 3.11 API change - dnl # ->shrink(struct shrinker *, struct shrink_control *sc) + dnl # cs->shrink(struct shrinker *, struct shrink_control *sc) dnl # AC_MSG_CHECKING([whether new 2-argument shrinker exists]) ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control], [ @@ -96,14 +96,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[ dnl # dnl # 3.12 API change, - dnl # ->shrink() is logically split in to - dnl # ->count_objects() and ->scan_objects() + dnl # cs->shrink() is logically split in to + dnl # cs->count_objects() and cs->scan_objects() dnl # - AC_MSG_CHECKING([whether ->count_objects callback exists]) + AC_MSG_CHECKING([whether cs->count_objects callback exists]) ZFS_LINUX_TEST_RESULT([shrinker_cb_shrink_control_split], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK, 1, - [->count_objects exists]) + [cs->count_objects exists]) ],[ ZFS_LINUX_TEST_ERROR([shrinker]) ]) diff --git a/config/kernel-sysfs.m4 b/config/kernel-sysfs.m4 index 668def5fe6bf..bbc77c8fc5c0 100644 --- a/config/kernel-sysfs.m4 +++ b/config/kernel-sysfs.m4 @@ -19,7 +19,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SYSFS_DEFAULT_GROUPS], [ ]) AC_DEFUN([ZFS_AC_KERNEL_SYSFS_DEFAULT_GROUPS], [ - AC_MSG_CHECKING([for struct kobj_type.default_groups]) + AC_MSG_CHECKING([whether struct kobj_type.default_groups exists]) ZFS_LINUX_TEST_RESULT([sysfs_default_groups],[ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_SYSFS_DEFAULT_GROUPS], 1, [struct kobj_type has default_groups]) diff --git a/config/kernel-vfs-filemap_dirty_folio.m4 b/config/kernel-vfs-filemap_dirty_folio.m4 index 872879002928..729ca670da03 100644 --- a/config/kernel-vfs-filemap_dirty_folio.m4 +++ b/config/kernel-vfs-filemap_dirty_folio.m4 @@ -19,7 +19,7 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_FILEMAP_DIRTY_FOLIO], [ dnl # Linux 5.18 uses filemap_dirty_folio in lieu of dnl # ___set_page_dirty_nobuffers dnl # - AC_MSG_CHECKING([filemap_dirty_folio exists]) + AC_MSG_CHECKING([whether filemap_dirty_folio exists]) ZFS_LINUX_TEST_RESULT([vfs_has_filemap_dirty_folio], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_VFS_FILEMAP_DIRTY_FOLIO, 1, diff --git a/config/kernel-vfs-read_folio.m4 b/config/kernel-vfs-read_folio.m4 index 234d1212ab98..9ca0faff218d 100644 --- a/config/kernel-vfs-read_folio.m4 +++ b/config/kernel-vfs-read_folio.m4 @@ -22,7 +22,7 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_READ_FOLIO], [ dnl # dnl # Linux 5.19 uses read_folio in lieu of readpage dnl # - AC_MSG_CHECKING([read_folio exists]) + AC_MSG_CHECKING([whether read_folio exists]) ZFS_LINUX_TEST_RESULT([vfs_has_read_folio], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_VFS_READ_FOLIO, 1, [read_folio exists]) diff --git a/config/kernel-vfs-set_page_dirty.m4 b/config/kernel-vfs-set_page_dirty.m4 index a9d252e4e01e..90cb28f3682c 100644 --- a/config/kernel-vfs-set_page_dirty.m4 +++ b/config/kernel-vfs-set_page_dirty.m4 @@ -23,7 +23,7 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS], [ dnl # Linux 5.14 change requires set_page_dirty() to be assigned dnl # in address_space_operations() dnl # - AC_MSG_CHECKING([__set_page_dirty_nobuffers exists]) + AC_MSG_CHECKING([whether __set_page_dirty_nobuffers exists]) ZFS_LINUX_TEST_RESULT([vfs_has_set_page_dirty_nobuffers], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS, 1, diff --git a/config/kernel.m4 b/config/kernel.m4 index eba3c066993d..9530367507d6 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -107,6 +107,8 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS ZFS_AC_KERNEL_SRC_VFS_ITERATE ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO + ZFS_AC_KERNEL_SRC_VFS_READPAGES + ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE ZFS_AC_KERNEL_SRC_VFS_GENERIC_WRITE_CHECKS ZFS_AC_KERNEL_SRC_VFS_IOV_ITER @@ -137,8 +139,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_SIGINFO ZFS_AC_KERNEL_SRC_SYSFS ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE - ZFS_AC_KERNEL_SRC_VFS_READPAGES - ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT ZFS_AC_KERNEL_SRC_ADD_DISK @@ -225,6 +225,8 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_VFS_FSYNC_2ARGS ZFS_AC_KERNEL_VFS_ITERATE ZFS_AC_KERNEL_VFS_DIRECT_IO + ZFS_AC_KERNEL_VFS_READPAGES + ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS ZFS_AC_KERNEL_VFS_RW_ITERATE ZFS_AC_KERNEL_VFS_GENERIC_WRITE_CHECKS ZFS_AC_KERNEL_VFS_IOV_ITER @@ -255,8 +257,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_SIGINFO ZFS_AC_KERNEL_SYSFS ZFS_AC_KERNEL_SET_SPECIAL_STATE - ZFS_AC_KERNEL_VFS_READPAGES - ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT ZFS_AC_KERNEL_ADD_DISK From 50ab6e17263bec842fcbebba8677ccfc0eefde78 Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Mon, 6 Jun 2022 10:41:59 -0700 Subject: [PATCH 108/119] Only read block devices during cache discovery (#469) --- cmd/zfs_object_agent/zettacache/src/open.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/zfs_object_agent/zettacache/src/open.rs b/cmd/zfs_object_agent/zettacache/src/open.rs index 9ada49a018ee..92aa51ade934 100644 --- a/cmd/zfs_object_agent/zettacache/src/open.rs +++ b/cmd/zfs_object_agent/zettacache/src/open.rs @@ -1,6 +1,7 @@ use std::collections::BTreeMap; use std::collections::HashMap; use std::collections::HashSet; +use std::os::unix::fs::FileTypeExt; use std::path::Path; use std::path::PathBuf; @@ -56,6 +57,12 @@ impl DiscoveredDevice { let mut file = File::open(&path) .await .with_context(|| format!("open {path:?}"))?; + + let filetype = file.metadata().await?.file_type(); + if !filetype.is_block_device() && !filetype.is_file() { + return Err(anyhow!("{path:?} is not a file nor a block device")); + } + let mut buf = vec![0u8; SUPERBLOCK_SIZE]; file.read_exact(&mut buf) .await From d768a75587017cffd951a18d47e1707e7c9f853a Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Mon, 6 Jun 2022 10:42:42 -0700 Subject: [PATCH 109/119] Use "-d" when ZETTACACHE_DEVICES is empty (#465) --- cmd/zfs_object_agent/scripts/start_zoa | 23 ++++++++++++++++++++++- etc/zfs/zoa.conf | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/cmd/zfs_object_agent/scripts/start_zoa b/cmd/zfs_object_agent/scripts/start_zoa index 5a64d256bb71..0681b4cc6578 100755 --- a/cmd/zfs_object_agent/scripts/start_zoa +++ b/cmd/zfs_object_agent/scripts/start_zoa @@ -7,6 +7,7 @@ # - ZOA_CONFIG: Configuration file to set tunables (toml/json/yaml) # - ZOA_LOG_CONFIG : log4rs configuration # - ZETTACACHE_DEVICES: File[s]/device[s] to use for ZettaCache +# - ZETTACACHE_DIRECTORY: Directory to use for ZettaCache device discovery. # DEV_WAIT=300 @@ -40,7 +41,27 @@ if [[ ! -z $ZOA_CONFIG ]]; then PARAMS="${PARAMS} -t ${ZOA_CONFIG}" fi -if [[ ! -z $ZETTACACHE_DEVICES ]]; then +# +# The "-c" and "-d" options are mutually exclusive. Thus, if both +# ZETTACACHE_DEVICES and ZETTACACHE_DIRECTORY are provided, we could +# wind up in a situation where starting the agent fails (e.g. if we +# naively used both "-c" and "-d" simultaneously). +# +# Rather than failing, if ZETTACACHE_DEVICES is supplied, we prioritize +# that over ZETTACACHE_DIRECTORY. This way, we prefer to not fail, and +# prefer the more user supplied configuraiton that specifies exactly +# which devices to use. +# +# Additionally, if neither ZETTACACHE_DEVICES nor ZETTACACHE_DIRECTORY +# is supplied, we use "-d" but with a default value. This way, if the +# agent/service is being used, and disks were dynamically added (e.g. +# via "zcache add"), those devices should be automatically discovered +# after an agent/service restart, rather than restarting without any +# cache (which would effectively undo any prior "zcache add"). +# +if [[ -z $ZETTACACHE_DEVICES ]]; then + PARAMS="$PARAMS -d ${ZETTACACHE_DIRECTORY:-/dev}" +else echo "ZettaCache: ${ZETTACACHE_DEVICES}" ZETTACACHE_DEVICES=(${ZETTACACHE_DEVICES//,/\ }) for dev in "${ZETTACACHE_DEVICES[@]}"; do diff --git a/etc/zfs/zoa.conf b/etc/zfs/zoa.conf index c137bba655d0..cbac2e2a482a 100644 --- a/etc/zfs/zoa.conf +++ b/etc/zfs/zoa.conf @@ -1,3 +1,4 @@ ZOA_CONFIG=/etc/zfs/zoa_config.toml ZOA_LOG_CONFIG=/etc/zfs/zoa_log4rs.yml ZETTACACHE_DEVICES= +ZETTACACHE_DIRECTORY= From 63ae49c39e187ea72e8dabdd277103a0845b6fe7 Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Mon, 6 Jun 2022 10:58:26 -0700 Subject: [PATCH 110/119] Use "exec" to replace "start_zoa" with agent process (#470) The "start_zoa" script calls the agent as the last thing it does, and that agent process runs indefinitely. We can slightly optimize things by using "exec" to start the agent, such that the "start_zoa" process can be killed, since it's no longer needed at that point. --- cmd/zfs_object_agent/scripts/start_zoa | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zfs_object_agent/scripts/start_zoa b/cmd/zfs_object_agent/scripts/start_zoa index 0681b4cc6578..ce906c2a937f 100755 --- a/cmd/zfs_object_agent/scripts/start_zoa +++ b/cmd/zfs_object_agent/scripts/start_zoa @@ -70,4 +70,4 @@ else done fi -/sbin/zfs_object_agent ${PARAMS} +exec /sbin/zfs_object_agent ${PARAMS} From aac2d41deaa651373c7cb4a5aed5b733df93e5dd Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Wed, 8 Jun 2022 09:20:31 -0700 Subject: [PATCH 111/119] move zettacache merge logic to its own module (#472) Pure code reorganization, no change in behavior. `struct Progress` is moved out of `fn merge_task`, its new full name is `::zettacache::zettacache::merge::Progress`. --- cmd/zfs_object_agent/Cargo.lock | 20 + .../zettacache/src/checkpoint.rs | 2 +- .../zettacache/src/zettacache/merge.rs | 614 +++++++++++++++ .../zettacache/src/zettacache/mod.rs | 744 ++---------------- .../zettacache/src/zettacache/remap.rs | 101 +++ 5 files changed, 780 insertions(+), 701 deletions(-) create mode 100644 cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs create mode 100644 cmd/zfs_object_agent/zettacache/src/zettacache/remap.rs diff --git a/cmd/zfs_object_agent/Cargo.lock b/cmd/zfs_object_agent/Cargo.lock index 7e3be71ceb20..59a71ffe70c0 100644 --- a/cmd/zfs_object_agent/Cargo.lock +++ b/cmd/zfs_object_agent/Cargo.lock @@ -1971,6 +1971,26 @@ dependencies = [ "sha-1", ] +[[package]] +name = "pin-project" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.9" diff --git a/cmd/zfs_object_agent/zettacache/src/checkpoint.rs b/cmd/zfs_object_agent/zettacache/src/checkpoint.rs index 2634c8c5a51a..2ab6164d4e20 100644 --- a/cmd/zfs_object_agent/zettacache/src/checkpoint.rs +++ b/cmd/zfs_object_agent/zettacache/src/checkpoint.rs @@ -23,7 +23,7 @@ use crate::size_histogram::SizeHistogramPhys; use crate::slab_allocator::SlabAllocator; use crate::slab_allocator::SlabAllocatorBuilder; use crate::slab_allocator::SlabAllocatorPhys; -use crate::zettacache::MergeProgressPhys; +use crate::zettacache::merge::MergeProgressPhys; use crate::zettacache::OperationLogEntry; #[derive(Serialize, Deserialize, Default, Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd)] diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs new file mode 100644 index 000000000000..1a125b041767 --- /dev/null +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs @@ -0,0 +1,614 @@ +use std::cmp::Ordering; +use std::fmt::Debug; +use std::mem; +use std::ops::Bound::Excluded; +use std::ops::Bound::Unbounded; +use std::sync::Arc; +use std::time::Instant; + +use conv::ConvUtil; +use futures::StreamExt; +use log::*; +use more_asserts::*; +use serde::Deserialize; +use serde::Serialize; +use tokio::sync::mpsc; +use util::measure; +use util::nice_p2size; +use util::super_trace; +use util::tunable; +use util::zettacache_stats::CacheStatCounter::*; +use util::zettacache_stats::CacheStats; +use util::zettacache_stats::DiskIoType; + +use super::remap::RemapLogEntry; +use super::remap::RemapState; +use super::OperationLogEntry; +use super::PendingChange; +use super::PendingChanges; +use super::UpdateAtime; +use crate::atime_histogram::AtimeHistogramPhys; +use crate::base_types::Atime; +use crate::base_types::Extent; +use crate::block_access::BlockAccess; +use crate::block_access::DISK_READ_MAX_QUEUE_DEPTH; +use crate::block_based_log::BlockBasedLogPhys; +use crate::index::IndexEntry; +use crate::index::IndexFlushDelta; +use crate::index::IndexKey; +use crate::index::IndexRun; +use crate::index::IndexRunPhys; +use crate::index::IndexValue; +use crate::slab_allocator::SlabAllocatorBuilder; + +tunable! { + // Limit this to half the read queue depth (per disk) so that we don't crowd + // out normal reads too much. Note that since writes aggregate, they + // typically won't be the io bottleneck. + static ref CACHE_REBALANCE_CONCURRENCY_LIMIT: usize = *DISK_READ_MAX_QUEUE_DEPTH / 2; + + static ref MERGE_PROGRESS_CHUNK: usize = 1_000_000; +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct MergeProgressPhys { + pub(super) rebalance_log: Option>, + pub(super) operation_log: BlockBasedLogPhys, + pub(super) new_index: IndexRunPhys, +} + +impl MergeProgressPhys { + pub fn claim(&self, builder: &mut SlabAllocatorBuilder) { + self.operation_log.claim(builder); + self.new_index.claim(builder); + if let Some(remap_log) = self.rebalance_log.as_ref() { + remap_log.claim(builder); + } + } +} + +#[derive(Debug)] +struct IndexMessage { + last_key: IndexKey, + entries: Vec, + entries_atimes: AtimeHistogramPhys, + frees: Vec, + cache_updates: Vec, + obsoleted_atimes: AtimeHistogramPhys, +} + +#[derive(Debug)] +pub(super) struct MergeProgress { + pub(super) new_index: IndexRunPhys, + pub(super) obsoleted: AtimeHistogramPhys, + pub(super) index_delta: IndexFlushDelta, + pub(super) frees: Vec, + pub(super) cache_updates: Vec, +} + +#[allow(clippy::large_enum_variant)] +pub(super) enum MergeMessage { + Progress(MergeProgress), + Complete(IndexRun), +} + +impl MergeMessage { + /// Compose a progress update to send to the checkpoint task. + async fn new_progress( + next_index: &mut IndexRun, + frees: Vec, + cache_updates: Vec, + obsoleted: AtimeHistogramPhys, + ) -> Self { + let timer = Instant::now(); + let free_count = frees.len(); + let cache_updates_count = cache_updates.len(); + let (new_index, index_delta) = next_index.flush().await; + let message = MergeProgress { + new_index, + index_delta, + obsoleted, + frees, + cache_updates, + }; + debug!("sending progress: index with {} entries ({}) last is {:?} flushed in {}ms, and {} frees, and {} cache_updates.", + next_index.len(), + nice_p2size(next_index.num_bytes()), + next_index.last_key(), timer.elapsed().as_millis(), + free_count, + cache_updates_count); + Self::Progress(message) + } +} + +/// The merge task sends incremental progress messages to the checkpoint task so that the +/// progress can be persisted (and restarted if the agent dies) and also so that space from +/// evicted blocks can become available without needing to wait for merge completion. Buffers for +/// accumulated work are pre-allocated to avoid the cost of growing those buffers during the +/// merge. +struct Progress { + chunk_len: usize, + tx: mpsc::Sender, + last_key: Option, + entries: Vec, + entries_atimes: AtimeHistogramPhys, + frees: Vec, + // This contains a list of entries that will be used to update the index cache. These may + // originate from new updates (i.e. from the pending changes list), or from disk location + // changes (i.e. from a block allocator rebalance operation). + cache_updates: Vec, + obsoleted: AtimeHistogramPhys, + timer: Instant, +} + +enum IngestSource { + Index, + PendingChange, +} + +impl Progress { + fn new( + tx: mpsc::Sender, + first_ghost: Atime, + first_live: Atime, + histogram_len: usize, + ) -> Self { + let chunk_len = *MERGE_PROGRESS_CHUNK; + Self { + chunk_len, + tx, + last_key: None, + entries: Vec::with_capacity(chunk_len), + entries_atimes: AtimeHistogramPhys::with_capacity( + first_ghost, + first_live, + histogram_len, + ), + frees: Vec::with_capacity(chunk_len), + cache_updates: Vec::with_capacity(chunk_len), + obsoleted: AtimeHistogramPhys::with_capacity(first_ghost, first_live, histogram_len), + timer: Instant::now(), + } + } + + /// As entries from the old index are processed (possibly added to the new index), they are + /// now "obsolete" in the old index, so need to be removed from the atime histogram. + fn obsolete(&mut self, entry: IndexEntry) { + self.obsoleted.insert_unchecked(entry.value); + } + + /// When an old index entry already exists for a newly inserted key, the new entry will + /// replace the old, so "evict" the old entry: if the entry is a ghost, then there is nothing + /// to do, otherwise, add the entry to the free list. + fn evict(&mut self, state: &MergeState, entry: IndexEntry) { + if let Some(extent) = entry.value.extent() { + match &state.remap { + Some(remap) => { + // If remap() is None, the data was evicted by the rebalance, so there's + // nothing to free here. + if let Some(location) = remap.remap(extent) { + self.frees.push(Extent { + location, + size: extent.size, + }); + } + } + None => self.frees.push(extent), + } + } + } + + /// Like `ingest()`. Returns true if `report().await` is needed. + fn ingest_pc(&mut self, state: &MergeState, key: IndexKey, value: IndexValue) -> bool { + self.ingest( + state, + IndexEntry::new(key, value), + IngestSource::PendingChange, + ) + } + + /// The provided index entry is either: + /// 1. Added to the list of entries to be part of the new index, or + /// 2. Added to the list of entries to be evicted from the cache, or + /// 3. Dropped because it is an already evicted entry that is no longer being tracked. + /// Returns true if report() is needed. Note that we don't want to do the `report.await()` + /// here because that would require instantiating a Future in the common case where we don't + /// need to report(), which impacts performance because this is called very frequently. + fn ingest(&mut self, state: &MergeState, mut entry: IndexEntry, source: IngestSource) -> bool { + if let Some(extent) = entry.value.extent() { + if let Some(remap) = &state.remap { + let remapped_location = remap.remap(extent); + if entry.value.location() != remapped_location { + // The data for this entry has been moved due to a cache remap + // operation. Update the entry using the new location for the data. + // Note: if remap was unable to move the data (evicting the entry + // instead) the new location will be None. + entry.value.set_location(remapped_location); + self.cache_updates.push(entry); + } + } + } + // We use `.0` so that the primitive u32 comparison is used, which the compiler can + // better optimize compared to calling `::ge()`. + if entry.value.atime().0 >= state.eviction_cutoff.0 { + // If this entry was evicted during remap, don't put it in the new index + if entry.value.location().is_some() { + self.entries_atimes.insert_unchecked(entry.value); + self.entries.push(entry); + + if matches!(source, IngestSource::PendingChange) { + self.cache_updates.push(entry); + } + } + } else { + if let Some(extent) = entry.value.extent() { + // This is a new ghost entry, free and strip old location infomation + self.frees.push(extent); + entry.value.set_location(None); + state.stats.track_count(Evictions); + } + if entry.value.atime() >= state.ghost_cutoff { + // Preserve ghost entry for our ghost history + self.entries_atimes.insert_unchecked(entry.value); + self.entries.push(entry); + } + } + self.last_key = Some(entry.key); + + self.entries.len() >= self.chunk_len + || self.frees.len() >= self.chunk_len + || self.cache_updates.len() >= self.chunk_len + } + + /// Send a message to the next_index_task, with the current set of index entries to add and + /// the current set of freed entries. Note: if we don't have a "last_key" then there is + /// nothing to send. + async fn report(&mut self) { + if let Some(last_key) = self.last_key { + measure!("Progress::report() tx.send(IndexMessage)") + .fut_timed(self.tx.send(IndexMessage { + last_key, + entries: mem::replace(&mut self.entries, Vec::with_capacity(self.chunk_len)), + entries_atimes: self.entries_atimes.take(), + frees: mem::replace(&mut self.frees, Vec::with_capacity(self.chunk_len)), + cache_updates: mem::replace( + &mut self.cache_updates, + Vec::with_capacity(self.chunk_len), + ), + obsoleted_atimes: self.obsoleted.take(), + })) + .await + .unwrap_or_else(|e| panic!("couldn't send: {e}")); + trace!( + "Collected and sent {} entries and {} frees to next_index_task in {}ms", + self.entries.len(), + self.frees.len(), + self.timer.elapsed().as_millis() + ); + self.timer = Instant::now(); + } else { + assert!( + self.entries.is_empty(), + "found {} entries, expected 0", + self.entries.len() + ); + assert!( + self.frees.is_empty(), + "found {} frees, expected 0", + self.frees.len() + ); + } + } +} + +#[derive(Debug)] +pub(super) struct MergeState { + pub(super) remap: Option, + pub(super) old_pending_changes: PendingChanges, + pub(super) old_operation_log_phys: BlockBasedLogPhys, + pub(super) eviction_cutoff: Atime, // lowest atime of live entries to keep in the new index + pub(super) ghost_cutoff: Atime, // lowest atime of ghost entries to keep in the new index + pub(super) last_atime: Atime, // highest atime that could be in the old or new index + pub(super) stats: Arc, +} + +impl MergeState { + /// This task offloads the task of writing out the next index from the merge task. This + /// allows the merge to proceed in parallel with the writes to disk. Relatively large chunks + /// of the new index are provided to make the IO as efficient as possible. + async fn next_index_task( + &self, + mut merge_rx: mpsc::Receiver, + checkpoint_tx: mpsc::Sender, + next_index: &mut IndexRun, + ) { + let begin = Instant::now(); + while let Some(message) = merge_rx.recv().await { + next_index.append(message.entries, &message.entries_atimes); + // The "last key" from the appended entries may not be the last key we actually + // processed in the merge (e.g, we may have evicted some entries later) + next_index.update_last_key(message.last_key); + checkpoint_tx + .send( + MergeMessage::new_progress( + next_index, + message.frees, + message.cache_updates, + message.obsoleted_atimes, + ) + .await, + ) + .await + .unwrap_or_else(|e| panic!("couldn't send: {}", e)); + } + + info!( + "wrote next index with {} entries ({}) in {:.1}s ({:.1}MB/s)", + next_index.len(), + nice_p2size(next_index.num_bytes()), + begin.elapsed().as_secs_f64(), + (next_index.num_bytes() as f64 / 1024f64 / 1024f64) / begin.elapsed().as_secs_f64(), + ); + } + + /// This function runs in an async task to merge a set of pending changes with the current + /// on-disk index in order to produce a new up-to-date on-disk index. It sends periodic + /// "progress updates" (including block frees) to the checkpoint task. + async fn merge_task( + &self, + tx: mpsc::Sender, + old_index_lock: Arc>, + start_key: Option, + block_access: &BlockAccess, + ) { + // We don't currently support concurrent free()'s while the remap is in-progress. + // Thus, we need to do the remap first, prior to moving forward with the merge. + self.remap(block_access).await; + + let begin = Instant::now(); + + debug!("using {start_key:?} as start key for merge"); + let mut index_stream; + let mut progress; + { + let old_index = old_index_lock.read().await; + info!( + "writing new index to merge {} pending changes into index of {} entries ({}), eviction cutoff {:?}, ghost cutoff {:?}", + self.old_pending_changes.len(), + old_index.len(), + nice_p2size(old_index.num_bytes()), + self.eviction_cutoff, + self.ghost_cutoff, + ); + index_stream = old_index.iter_chunks(); + progress = Progress::new( + tx, + old_index.first_ghost_atime(), + old_index.first_live_atime(), + self.last_atime - old_index.first_ghost_atime() + 1, + ); + } + let mut pending_changes_iter = self + .old_pending_changes + .range((start_key.map_or(Unbounded, Excluded), Unbounded)) + .peekable(); + + while let Some(chunk) = measure!("MergeState::merge_task index_stream.next()") + .fut_timed(index_stream.next()) + .await + { + let mut entries = chunk.entries(); + // If the next index is already "started", advance the old index to the start point. + // The index_stream excludes the trimmed chunks, so this only happens within the + // first chunk. This could be done using `binary_search_by_key()`, but in the common + // case (not the first chunk), this is faster because only a single check is needed. + if let Some(start_key) = start_key { + while !entries.is_empty() && entries[0].key <= start_key { + super_trace!("skipping index entry: {:?}", entries[0].key); + entries = &entries[1..]; + } + } + loop { + // Process run of entries that do not involve pending changes. This is the most + // common and performance-critical path. + let contiguous = match pending_changes_iter.peek() { + Some((&pc_key, _)) => { + match entries.binary_search_by_key(&pc_key, |entry| entry.key) { + Ok(index) | Err(index) => index, + } + } + None => entries.len(), + }; + let (contiguous, remainder) = entries.split_at(contiguous); + entries = remainder; + for &entry in contiguous { + progress.obsolete(entry); + if progress.ingest(self, entry, IngestSource::Index) { + progress.report().await; + } + } + + let entry = match entries.first() { + Some(&entry) => entry, + None => break, + }; + + while let Some((&pc_key, &pc)) = pending_changes_iter.peek() { + match pc_key.cmp(&entry.key) { + Ordering::Less => { + // Add this new entry to the index. It must be an Insert, because an + // UpdateAtime applies to an existing entry. + if let PendingChange::Insert(pc_value) = pc { + if progress.ingest_pc(self, pc_key, pc_value) { + progress.report().await; + } + } else { + panic!( + "{pc_key:?} {pc:?} has no corresponding entry in the index run" + ); + } + pending_changes_iter.next(); + } + Ordering::Equal => { + // Note, obsolete() needs to be called before ingest_pc(), because we + // need to count its obsolescence before reporting. + progress.obsolete(entry); + match pc { + PendingChange::Insert(pc_value) => { + // We are replacing an entry. This may be a ghost entry being + // re-cached or a heal() of a bad entry. + if entry.value.location().is_some() { + debug!("Insert of {pc_value:?} replaces {entry:?}"); + } + progress.evict(self, entry); + if progress.ingest_pc(self, pc_key, pc_value) { + progress.report().await; + } + } + PendingChange::UpdateAtime(UpdateAtime(pc_value, _)) => { + // Replace this entry with the pending change entry that + // updates the atime. + assert_eq!(pc_value.extent(), entry.value.extent()); + assert_ge!(pc_value.atime(), entry.value.atime()); + if progress.ingest_pc(self, pc_key, pc_value) { + progress.report().await; + } + } + } + // Both the pending change and the index run entry are consumed. + pending_changes_iter.next(); + entries = &entries[1..]; + break; + } + Ordering::Greater => break, // process entry next + } + } + } + } + while let Some((&pc_key, &PendingChange::Insert(pc_value))) = pending_changes_iter.peek() { + // Add this new entry to the index + if progress.ingest_pc(self, pc_key, pc_value) { + progress.report().await; + } + // Consume pending change. We don't do that in the `while let` because we want to + // leave any unmatched items in the iterator so that we can print them out when + // failing below. + pending_changes_iter.next(); + } + // Other pending changes refer to existing index entries and therefore should have been + // processed above + assert!( + pending_changes_iter.peek().is_none(), + "next={:?}", + pending_changes_iter.peek().unwrap() + ); + + // Send final progress message with final list content + progress.report().await; + + info!( + "merge task completed in {:.1}s", + begin.elapsed().as_secs_f64(), + ); + } + + async fn remap(&self, block_access: &BlockAccess) { + let map = match self.remap.as_ref() { + None => return, + Some(remap) => &remap.map, + }; + + let begin = Instant::now(); + + info!("starting rebalance with {} entries", map.len()); + + futures::stream::iter(map) + .for_each_concurrent( + *CACHE_REBALANCE_CONCURRENCY_LIMIT * block_access.disks().count(), + |(old, maybe_new)| async move { + if let Some(new) = maybe_new { + let bytes = block_access + .read_raw(*old, DiskIoType::MaintenanceRead) + .await; + block_access + .write_raw(*new, bytes, DiskIoType::MaintenanceWrite) + .await; + } + }, + ) + .await; + + let mut copied_extents = 0; + let mut copied_bytes = 0; + let mut evicted_extents = 0; + let mut evicted_bytes = 0; + for (old, maybe_new) in map.iter() { + match maybe_new { + Some(_) => { + copied_extents += 1; + copied_bytes += old.size; + } + None => { + evicted_extents += 1; + evicted_bytes += old.size; + } + } + } + + info!( + "took {}ms to rebalance; copied {} ({} entries) ({}/s), evicted {} ({} entries)", + begin.elapsed().as_millis(), + nice_p2size(copied_bytes), + copied_extents, + nice_p2size( + (copied_bytes as f64 / begin.elapsed().as_secs_f64()) + .approx_as::() + .unwrap() + ), + nice_p2size(evicted_bytes), + evicted_extents, + ); + } + + pub(super) fn spawn_tasks( + self: Arc, + block_access: Arc, + old_index: Arc>, + mut next_index: IndexRun, + ) -> mpsc::Receiver { + // The checkpoint task will be constantly reading from the channel, so we don't really + // need much of a buffer here. We use 100 because we might accumulate some messages while + // actually flushing out the checkpoint. + let (index_tx, checkpoint_rx) = mpsc::channel(100); + let (merge_tx, index_rx) = mpsc::channel(100); + + let start_key = next_index.last_key(); + + let spawn_merge = self.clone(); + measure!("MergeState::merge_task()").spawn(async move { + spawn_merge + .merge_task(merge_tx, old_index, start_key, &block_access) + .await; + }); + + measure!("MergeState::next_index_task()").spawn(async move { + self.next_index_task(index_rx, index_tx.clone(), &mut next_index) + .await; + + // We drop this before sending the Complete message, so that rotate_index() can + // unwrap the Arc. + drop(self); + // XXX - wait for the merge_task to complete as well? + + // send the now complete next_index as the final message + index_tx + .send(MergeMessage::Complete(next_index)) + .await + .unwrap_or_else(|e| panic!("couldn't send: {}", e)); + + trace!("sent final checkpoint message"); + }); + + checkpoint_rx + } +} diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs index 0d7388c47eea..2c26e4bf4c53 100644 --- a/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs @@ -1,6 +1,7 @@ +pub mod merge; +pub mod remap; pub mod zcdb; -use std::cmp::Ordering; use std::collections::btree_map; use std::collections::BTreeMap; use std::collections::HashMap; @@ -10,9 +11,6 @@ use std::fmt::Display; use std::fmt::Formatter; use std::mem; use std::mem::size_of; -use std::ops::Bound::Excluded; -use std::ops::Bound::Included; -use std::ops::Bound::Unbounded; use std::path::Path; use std::path::PathBuf; use std::sync::Arc; @@ -25,7 +23,6 @@ use arc_swap::ArcSwapAny; use arc_swap::ArcSwapOption; use bytes::Bytes; use bytesize::ByteSize; -use conv::ConvUtil; use either::Either; use futures::future; use futures::stream::FuturesUnordered; @@ -67,6 +64,10 @@ use util::LockSet; use util::LockedItem; use uuid::Uuid; +use self::merge::MergeMessage; +use self::merge::MergeProgressPhys; +use self::merge::MergeState; +use self::remap::RemapState; use crate::atime_histogram::AtimeHistogram; use crate::atime_histogram::AtimeHistogramPhys; use crate::base_types::*; @@ -116,8 +117,6 @@ tunable! { static ref CHECKPOINT_INTERVAL: Duration = Duration::from_secs(60); - static ref MERGE_PROGRESS_CHUNK: usize = 1_000_000; - static ref QUANTILES_IN_SIZE_HISTOGRAM: usize = 100; // Buffers for incomming data blocks: the "demand" buffer is for read-miss blocks. The @@ -129,11 +128,6 @@ tunable! { static ref CACHE_INSERT_SPECULATIVE_BUFFER_SIZE: ByteSize = ByteSize::mib(256); static ref CACHE_WAIT_INSERT: bool = false; - // Limit this to half the read queue depth (per disk) so that we don't crowd - // out normal reads too much. Note that since writes aggregate, they - // typically won't be the io bottleneck. - static ref CACHE_REBALANCE_CONCURRENCY_LIMIT: usize = *DISK_READ_MAX_QUEUE_DEPTH / 2; - // If non-zero, the lookup() function will fail randomly every specified number of requests static ref LOOKUP_FAIL_RANDOM: u32 = 0; @@ -154,23 +148,6 @@ tunable! { static ref CORRUPTION_FILL: u8 = 0x31; // fill blocks with '1' } -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct MergeProgressPhys { - rebalance_log: Option>, - operation_log: BlockBasedLogPhys, - new_index: IndexRunPhys, -} - -impl MergeProgressPhys { - pub fn claim(&self, builder: &mut SlabAllocatorBuilder) { - self.operation_log.claim(builder); - self.new_index.claim(builder); - if let Some(rebalance_log) = self.rebalance_log.as_ref() { - rebalance_log.claim(builder); - } - } -} - /// A PendingChange is the in-core data structure for tracking changes to the index between merges. /// Two types of events are tracked: insertions and lookup hits (atime update). Note that there is /// no removal event here because we do not allow removes in general. Cache content is only removed @@ -226,582 +203,6 @@ pub enum OperationLogEntry { } impl BlockBasedLogEntry for OperationLogEntry {} -#[derive(Debug, Serialize, Deserialize, Copy, Clone)] -struct RebalanceLogEntry { - old: Extent, - new: Option, -} -impl BlockBasedLogEntry for RebalanceLogEntry {} - -#[derive(Debug)] -struct IndexMessage { - last_key: IndexKey, - entries: Vec, - entries_atimes: AtimeHistogramPhys, - frees: Vec, - cache_updates: Vec, - // entries obsoleted from old index, since last MergeProgress - obsoleted_atimes: AtimeHistogramPhys, -} - -#[derive(Debug)] -struct MergeProgress { - new_index: IndexRunPhys, - obsoleted: AtimeHistogramPhys, - index_delta: IndexFlushDelta, - frees: Vec, - cache_updates: Vec, -} - -#[allow(clippy::large_enum_variant)] -enum MergeMessage { - Progress(MergeProgress), - Complete(IndexRun), -} - -impl MergeMessage { - /// Compose a progress update to send to the checkpoint task. - async fn new_progress( - next_index: &mut IndexRun, - frees: Vec, - cache_updates: Vec, - obsoleted: AtimeHistogramPhys, - ) -> Self { - let timer = Instant::now(); - let free_count = frees.len(); - let cache_updates_count = cache_updates.len(); - let (new_index, index_delta) = next_index.flush().await; - let message = MergeProgress { - new_index, - index_delta, - obsoleted, - frees, - cache_updates, - }; - debug!("sending progress: index with {} entries ({}) last is {:?} flushed in {}ms, and {} frees, and {} cache_updates.", - next_index.len(), - nice_p2size(next_index.num_bytes()), - next_index.last_key(), timer.elapsed().as_millis(), - free_count, - cache_updates_count); - Self::Progress(message) - } -} - -#[derive(Debug)] -struct RebalanceState { - map: BTreeMap>, - log_phys: BlockBasedLogPhys, -} - -impl RebalanceState { - fn remap(&self, extent: Extent) -> Option { - if let Some((old, new)) = self - .map - .range((Unbounded, Included(extent.location))) - .next_back() - { - if old.contains(&extent) { - match new { - Some(new_location) => { - // This represents the offset of the passed in extent, into the extent - // that was moved as part of the rebalance operation. For example, - // multiple contiguously allocated blocks maybe have been moved via a - // single extent. Thus, to remap one of those blocks' to it's new - // location on disk, we need this offset (this offset is maintained when - // the blocks are copied). - let offset = extent.location - old.location; - - return Some(DiskLocation::new( - new_location.disk(), - new_location.offset() + offset, - )); - } - None => { - // This means the extent was part of a rebalance operation, but when - // attempting to remap the old location to a new location, the allocation - // failed. Thus, the old extent does not have new location, and it will - // be invalid after the rebalance completes. - return None; - } - } - } - } - - // If we reach this point, we didn't find an extent in the mapping that contains the passed - // in extent, which means the passed in extent was not remapped; thus, we simply - // return the old extent's location. - Some(extent.location) - } -} - -#[derive(Debug)] -struct MergeState { - rebalance: Option, - old_pending_changes: PendingChanges, - old_operation_log_phys: BlockBasedLogPhys, - eviction_cutoff: Atime, // lowest atime of live entries to keep in the new index - ghost_cutoff: Atime, // lowest atime of ghost entries to keep in the new index - last_atime: Atime, // highest atime that could be in the old or new index - stats: Arc, -} - -impl MergeState { - /// This task offloads the task of writing out the next index from the merge task. - /// This allows the merge to proceed in parallel with the writes to disk. Relatively - /// large chunks of the new index are provided to make the IO as efficient as possible. - async fn next_index_task( - &self, - mut merge_rx: mpsc::Receiver, - checkpoint_tx: mpsc::Sender, - next_index: &mut IndexRun, - ) { - let begin = Instant::now(); - while let Some(message) = merge_rx.recv().await { - next_index.append(message.entries, &message.entries_atimes); - // The "last key" from the appended entries may not be the last key we actually - // processed in the merge (e.g, we may have evicted some entries later) - next_index.update_last_key(message.last_key); - checkpoint_tx - .send( - MergeMessage::new_progress( - next_index, - message.frees, - message.cache_updates, - message.obsoleted_atimes, - ) - .await, - ) - .await - .unwrap_or_else(|e| panic!("couldn't send: {}", e)); - } - - info!( - "wrote next index with {} entries ({}) in {:.1}s ({:.1}MB/s)", - next_index.len(), - nice_p2size(next_index.num_bytes()), - begin.elapsed().as_secs_f64(), - (next_index.num_bytes() as f64 / 1024f64 / 1024f64) / begin.elapsed().as_secs_f64(), - ); - } - - /// This function runs in an async task to merge a set of pending changes with the current - /// on-disk index in order to produce a new up-to-date on-disk index. It sends periodic - /// "progress updates" (including block frees) to the checkpoint task. - async fn merge_task( - &self, - tx: mpsc::Sender, - old_index_lock: Arc>, - start_key: Option, - block_access: &BlockAccess, - ) { - // We don't currently support concurrent free()'s while the rebalance is in-progress. Thus, - // we need to do the rebalance first, prior to moving forward with the merge. - self.rebalance(block_access).await; - - let begin = Instant::now(); - - /// The merge task sends incremental progress messages to the checkpoint task - /// so that the progress can be persisted (and restarted if the agent dies) and - /// also so that space from evicted blocks can become available without needing - /// to wait for merge completion. Buffers for accumulated work are pre-allocated - /// to avoid the cost of growing those buffers during the merge. - struct Progress { - chunk_len: usize, - tx: mpsc::Sender, - last_key: Option, - entries: Vec, - entries_atimes: AtimeHistogramPhys, - frees: Vec, - // This contains a list of entries that will be used to update the index cache. These - // may originate from new updates (i.e. from the pending changes list), or from disk - // location changes (i.e. from a block allocator rebalance operation). - cache_updates: Vec, - obsoleted: AtimeHistogramPhys, - timer: Instant, - } - - enum IngestSource { - Index, - PendingChange, - } - - impl Progress { - fn new( - tx: mpsc::Sender, - first_ghost: Atime, - first_live: Atime, - histogram_len: usize, - ) -> Self { - let chunk_len = *MERGE_PROGRESS_CHUNK; - Self { - chunk_len, - tx, - last_key: None, - entries: Vec::with_capacity(chunk_len), - entries_atimes: AtimeHistogramPhys::with_capacity( - first_ghost, - first_live, - histogram_len, - ), - frees: Vec::with_capacity(chunk_len), - cache_updates: Vec::with_capacity(chunk_len), - obsoleted: AtimeHistogramPhys::with_capacity( - first_ghost, - first_live, - histogram_len, - ), - timer: Instant::now(), - } - } - - /// As entries from the old index are processed (possibly added to the new index), - /// they are now "obsolete" in the old index, so need to be removed from the atime - /// histogram. - fn obsolete(&mut self, entry: IndexEntry) { - self.obsoleted.insert_unchecked(entry.value); - } - - /// When an old index entry already exists for a newly inserted key, the new entry will - /// replace the old, so "evict" the old entry: if the entry is a ghost, then there is - /// nothing to do, otherwise, add the entry to the free list. - fn evict(&mut self, state: &MergeState, entry: IndexEntry) { - if let Some(extent) = entry.value.extent() { - match &state.rebalance { - Some(rebalance) => { - // If remap() is None, the data was evicted by the rebalance, so there's - // nothing to free here. - if let Some(location) = rebalance.remap(extent) { - self.frees.push(Extent { - location, - size: extent.size, - }); - } - } - None => self.frees.push(extent), - } - } - } - - /// Like `ingest()`. Returns true if `report().await` is needed. - fn ingest_pc(&mut self, state: &MergeState, key: IndexKey, value: IndexValue) -> bool { - self.ingest( - state, - IndexEntry::new(key, value), - IngestSource::PendingChange, - ) - } - - /// The provided index entry is either: - /// 1. Added to the list of entries to be part of the new index, or - /// 2. Added to the list of entries to be evicted from the cache, or - /// 3. Dropped because it is an already evicted entry that is no longer being tracked. - /// Returns true if report() is needed. Note that we don't want to do the - /// `report.await()` here because that would require instantiating a Future in the - /// common case where we don't need to report(), which impacts performance because - /// this is called very frequently. - fn ingest( - &mut self, - state: &MergeState, - mut entry: IndexEntry, - source: IngestSource, - ) -> bool { - if let Some(extent) = entry.value.extent() { - if let Some(rebalance) = &state.rebalance { - let remapped_location = rebalance.remap(extent); - if entry.value.location() != remapped_location { - // The data for this entry has been moved due to a cache rebalance - // operation. Update the entry using the new location for the data. - // Note: if rebalance was unable to move the data (evicting the entry - // instead) the new location will be None. - entry.value.set_location(remapped_location); - self.cache_updates.push(entry); - } - } - } - // We use `.0` so that the primitive u32 comparison is used, which the compiler - // can better optimize compared to calling `::ge()`. - if entry.value.atime().0 >= state.eviction_cutoff.0 { - // If this entry was evicted during rebalance, don't put it in the new index - if entry.value.location().is_some() { - self.entries_atimes.insert_unchecked(entry.value); - self.entries.push(entry); - - if matches!(source, IngestSource::PendingChange) { - self.cache_updates.push(entry); - } - } - } else { - if let Some(extent) = entry.value.extent() { - // This is a new ghost entry, free and strip old location infomation - self.frees.push(extent); - entry.value.set_location(None); - state.stats.track_count(Evictions); - } - if entry.value.atime() >= state.ghost_cutoff { - // Preserve ghost entry for our ghost history - self.entries_atimes.insert_unchecked(entry.value); - self.entries.push(entry); - } - } - self.last_key = Some(entry.key); - - self.entries.len() >= self.chunk_len - || self.frees.len() >= self.chunk_len - || self.cache_updates.len() >= self.chunk_len - } - - /// Send a message to the next_index_task, with the current set of index entries to - /// add and the current set of freed entries. Note: if we don't have a "last_key" - /// then there is nothing to send. - async fn report(&mut self) { - if let Some(last_key) = self.last_key { - measure!("MergeState::merge_task::Progress::report() tx.send(IndexMessage)") - .fut_timed(self.tx.send(IndexMessage { - last_key, - entries: mem::replace( - &mut self.entries, - Vec::with_capacity(self.chunk_len), - ), - entries_atimes: self.entries_atimes.take(), - frees: mem::replace( - &mut self.frees, - Vec::with_capacity(self.chunk_len), - ), - cache_updates: mem::replace( - &mut self.cache_updates, - Vec::with_capacity(self.chunk_len), - ), - obsoleted_atimes: self.obsoleted.take(), - })) - .await - .unwrap_or_else(|e| panic!("couldn't send: {e}")); - trace!( - "Collected and sent {} entries and {} frees to next_index_task in {}ms", - self.entries.len(), - self.frees.len(), - self.timer.elapsed().as_millis() - ); - self.timer = Instant::now(); - } else { - assert!( - self.entries.is_empty(), - "found {} entries, expected 0", - self.entries.len() - ); - assert!( - self.frees.is_empty(), - "found {} frees, expected 0", - self.frees.len() - ); - } - } - } - - debug!("using {start_key:?} as start key for merge"); - let mut index_stream; - let mut progress; - { - let old_index = old_index_lock.read().await; - info!( - "writing new index to merge {} pending changes into index of {} entries ({}), eviction cutoff {:?}, ghost cutoff {:?}", - self.old_pending_changes.len(), - old_index.len(), - nice_p2size(old_index.num_bytes()), - self.eviction_cutoff, - self.ghost_cutoff, - ); - index_stream = old_index.iter_chunks(); - progress = Progress::new( - tx, - old_index.first_ghost_atime(), - old_index.first_live_atime(), - self.last_atime - old_index.first_ghost_atime() + 1, - ); - } - let mut pending_changes_iter = self - .old_pending_changes - .range((start_key.map_or(Unbounded, Excluded), Unbounded)) - .peekable(); - - while let Some(chunk) = measure!("MergeState::merge_task index_stream.next()") - .fut_timed(index_stream.next()) - .await - { - let mut entries = chunk.entries(); - // If the next index is already "started", advance the old index to the start point. - // The index_stream excludes the trimmed chunks, so this only happens within the - // first chunk. This could be done using `binary_search_by_key()`, but in the common - // case (not the first chunk), this is faster because only a single check is needed. - if let Some(start_key) = start_key { - while !entries.is_empty() && entries[0].key <= start_key { - super_trace!("skipping index entry: {:?}", entries[0].key); - entries = &entries[1..]; - } - } - loop { - // Process run of entries that do not involve pending changes. This is the most - // common and performance-critical path. - let contiguous = match pending_changes_iter.peek() { - Some((&pc_key, _)) => { - match entries.binary_search_by_key(&pc_key, |entry| entry.key) { - Ok(index) | Err(index) => index, - } - } - None => entries.len(), - }; - let (contiguous, remainder) = entries.split_at(contiguous); - entries = remainder; - for &entry in contiguous { - progress.obsolete(entry); - if progress.ingest(self, entry, IngestSource::Index) { - progress.report().await; - } - } - - let entry = match entries.first() { - Some(&entry) => entry, - None => break, - }; - - while let Some((&pc_key, &pc)) = pending_changes_iter.peek() { - match pc_key.cmp(&entry.key) { - Ordering::Less => { - // Add this new entry to the index. It must be an Insert, because an - // UpdateAtime applies to an existing entry. - if let PendingChange::Insert(pc_value) = pc { - if progress.ingest_pc(self, pc_key, pc_value) { - progress.report().await; - } - } else { - panic!( - "{pc_key:?} {pc:?} has no corresponding entry in the index run" - ); - } - pending_changes_iter.next(); - } - Ordering::Equal => { - // Note, obsolete() needs to be called before ingest_pc(), because we - // need to count its obsolescence before reporting. - progress.obsolete(entry); - match pc { - PendingChange::Insert(pc_value) => { - // We are replacing an entry. This may be a ghost entry being - // re-cached or a heal() of a bad entry. - if entry.value.location().is_some() { - debug!("Insert of {pc_value:?} replaces {entry:?}"); - } - progress.evict(self, entry); - if progress.ingest_pc(self, pc_key, pc_value) { - progress.report().await; - } - } - PendingChange::UpdateAtime(UpdateAtime(pc_value, _)) => { - // Replace this entry with the pending change entry that - // updates the atime. - assert_eq!(pc_value.extent(), entry.value.extent()); - assert_ge!(pc_value.atime(), entry.value.atime()); - if progress.ingest_pc(self, pc_key, pc_value) { - progress.report().await; - } - } - } - // Both the pending change and the index run entry are consumed. - pending_changes_iter.next(); - entries = &entries[1..]; - break; - } - Ordering::Greater => break, // process entry next - } - } - } - } - while let Some((&pc_key, &PendingChange::Insert(pc_value))) = pending_changes_iter.peek() { - // Add this new entry to the index - if progress.ingest_pc(self, pc_key, pc_value) { - progress.report().await; - } - // Consume pending change. We don't do that in the `while let` - // because we want to leave any unmatched items in the iterator so - // that we can print them out when failing below. - pending_changes_iter.next(); - } - // Other pending changes refer to existing index entries and therefore should have been - // processed above - assert!( - pending_changes_iter.peek().is_none(), - "next={:?}", - pending_changes_iter.peek().unwrap() - ); - - // Send final progress message with final list content - progress.report().await; - - info!( - "merge task completed in {:.1}s", - begin.elapsed().as_secs_f64(), - ); - } - - async fn rebalance(&self, block_access: &BlockAccess) { - let map = match self.rebalance.as_ref() { - None => return, - Some(rebalance) => &rebalance.map, - }; - - let begin = Instant::now(); - - info!("starting rebalance with {} entries", map.len()); - - futures::stream::iter(map) - .for_each_concurrent( - *CACHE_REBALANCE_CONCURRENCY_LIMIT * block_access.disks().count(), - |(old, maybe_new)| async move { - if let Some(new) = maybe_new { - let bytes = block_access - .read_raw(*old, DiskIoType::MaintenanceRead) - .await; - block_access - .write_raw(*new, bytes, DiskIoType::MaintenanceWrite) - .await; - } - }, - ) - .await; - - let mut copied_extents = 0; - let mut copied_bytes = 0; - let mut evicted_extents = 0; - let mut evicted_bytes = 0; - for (old, maybe_new) in map.iter() { - match maybe_new { - Some(_) => { - copied_extents += 1; - copied_bytes += old.size; - } - None => { - evicted_extents += 1; - evicted_bytes += old.size; - } - } - } - - info!( - "took {}ms to rebalance; copied {} ({} entries) ({}/s), evicted {} ({} entries)", - begin.elapsed().as_millis(), - nice_p2size(copied_bytes), - copied_extents, - nice_p2size( - (copied_bytes as f64 / begin.elapsed().as_secs_f64()) - .approx_as::() - .unwrap() - ), - nice_p2size(evicted_bytes), - evicted_extents, - ); - } -} - type PendingChanges = BTreeMap; /// The locked portion of the zettacache state. These fields need to change in coordination with @@ -888,6 +289,20 @@ impl From for CacheOpenError { } } +#[derive(Debug)] +pub struct ValidIndexValue(IndexValue); + +impl ValidIndexValue { + pub fn extent(&self) -> Extent { + self.0.extent().unwrap() + } +} + +enum InsertError { + Allocation, + PendingChanges, +} + impl ZettaCache { pub async fn open(mode: CacheOpenMode) -> Result { let inner = match Inner::open(mode).await { @@ -2128,20 +1543,6 @@ impl Inner { } } -#[derive(Debug)] -pub struct ValidIndexValue(IndexValue); - -impl ValidIndexValue { - pub fn extent(&self) -> Extent { - self.0.extent().unwrap() - } -} - -enum InsertError { - Allocation, - PendingChanges, -} - impl Locked { const PENDING_CHANGES_TAG: &'static str = "Locked.pending_changes"; /// Validates the passed in index value; returns the value back if it's still valid, or None. @@ -2408,10 +1809,7 @@ impl Locked { let merge_progress_phys = match (self.merge.as_ref(), new_index) { (None, None) => None, (Some(ms), Some(new_index_phys)) => Some(MergeProgressPhys { - rebalance_log: ms - .rebalance - .as_ref() - .map(|rebalance| rebalance.log_phys.clone()), + rebalance_log: ms.remap.as_ref().map(|remap| remap.log_phys.clone()), operation_log: ms.old_operation_log_phys.clone(), new_index: new_index_phys, }), @@ -2463,50 +1861,6 @@ impl Locked { ); } - fn spawn_merge_task( - &self, - merge: Arc, - old_index: Arc>, - mut next_index: IndexRun, - ) -> mpsc::Receiver { - // The checkpoint task will be constantly reading from the channel, so we don't really need - // much of a buffer here. We use 100 because we might accumulate some messages while - // actually flushing out the checkpoint. - let (index_tx, checkpoint_rx) = mpsc::channel(100); - let (merge_tx, index_rx) = mpsc::channel(100); - - let block_access = self.block_access.clone(); - let spawn_merge = merge.clone(); - let start_key = next_index.last_key(); - - measure!("MergeState::merge_task()").spawn(async move { - spawn_merge - .merge_task(merge_tx, old_index, start_key, &block_access) - .await; - }); - - measure!("MergeState::next_index_task()").spawn(async move { - merge - .next_index_task(index_rx, index_tx.clone(), &mut next_index) - .await; - - // We drop this before sending the Complete message, so that rotate_index() can unwrap - // the Arc. - drop(merge); - // XXX - wait for the merge_task to complete as well? - - // send the now complete next_index as the final message - index_tx - .send(MergeMessage::Complete(next_index)) - .await - .unwrap_or_else(|e| panic!("couldn't send: {}", e)); - - trace!("sent final checkpoint message"); - }); - - checkpoint_rx - } - /// Restart a merge task from the saved checkpoint state async fn resume_merge_task( &mut self, @@ -2526,17 +1880,16 @@ impl Locked { next_index.first_ghost_atime(), ); - let rebalance = match progress.rebalance_log { + let remap = match progress.rebalance_log { None => None, - Some(log_phys) => { - let map: BTreeMap> = log_phys - .iter(self.block_access.clone(), self.slab_allocator.access()) - .map(|entry| (entry.old, entry.new)) - .collect() - .await; - - Some(RebalanceState { log_phys, map }) - } + Some(log_phys) => Some( + RemapState::open( + self.block_access.clone(), + self.slab_allocator.access(), + log_phys, + ) + .await, + ), }; let merge = Arc::new(MergeState { @@ -2545,13 +1898,13 @@ impl Locked { eviction_cutoff: next_index.first_live_atime(), last_atime: self.atime, old_pending_changes, - rebalance, + remap, stats: self.stats.clone(), }); self.merge = Some(merge.clone()); ( - self.spawn_merge_task(merge, old_index, next_index), + merge.spawn_tasks(self.block_access.clone(), old_index, next_index), progress.new_index, ) } @@ -2659,21 +2012,9 @@ impl Locked { ) .await; - let rebalance = match self.block_allocator.rebalance_init() { + let remap = match self.block_allocator.rebalance_init() { None => None, Some(map) => { - let mut log = BlockBasedLog::::open( - self.block_access.clone(), - self.slab_allocator.clone(), - Default::default(), - ); - - for (&old, &new) in map.iter() { - log.push(RebalanceLogEntry { old, new }); - } - - let log_phys = log.flush().await; - // We need to ensure that rebalance() won't copy from blocks that we're still in // the middle of writing. To solve a similar problem, we use the LockedKey to // ensure that the reads from lookup() see new writes from insert(). We can't @@ -2687,7 +2028,10 @@ impl Locked { begin.elapsed().as_millis() ); - Some(RebalanceState { map, log_phys }) + Some( + RemapState::create(self.block_access.clone(), self.slab_allocator.clone(), map) + .await, + ) } }; @@ -2700,13 +2044,13 @@ impl Locked { last_atime: self.atime, old_pending_changes: std::mem::take(&mut self.pending_changes), old_operation_log_phys, - rebalance, + remap, stats: self.stats.clone(), }); self.merge = Some(merge.clone()); Some(( - self.spawn_merge_task(merge, old_index, next_index), + merge.spawn_tasks(self.block_access.clone(), old_index, next_index), next_index_phys, )) } @@ -2720,7 +2064,7 @@ impl Locked { // Free up the extents that have been allocated for the merge pending state merge.old_operation_log_phys.clear(&self.slab_allocator); - if let Some(rebalance) = &merge.rebalance { + if let Some(remap) = &merge.remap { let begin = Instant::now(); let mut evicted_keys = Vec::new(); @@ -2730,7 +2074,7 @@ impl Locked { // Inserts in the "pending changes" list will never be moved as part of a // rebalance. let extent = value.extent().unwrap(); - assert_eq!(rebalance.remap(extent).unwrap(), extent.location); + assert_eq!(remap.remap(extent).unwrap(), extent.location); } PendingChange::UpdateAtime(UpdateAtime(value, _)) => { // If a lookup occurs on a block that is being moved as part of @@ -2741,7 +2085,7 @@ impl Locked { // rebalanced locations, or 2) remove the UpdateAtime due to rebalancing // having had to evict the entry from the cache (i.e. due to an // allocation failure when attempting to allocate the new disk location). - match rebalance.remap(value.extent().unwrap()) { + match remap.remap(value.extent().unwrap()) { Some(location) => { value.set_location(Some(location)); } @@ -2770,9 +2114,9 @@ impl Locked { ); self.atime_histogram.reset_first_live(merge.eviction_cutoff); - if let Some(mut rebalance) = merge.rebalance { + if let Some(mut remap) = merge.remap { // Free up the extents that have been allocated for the cache rebalancing - rebalance.log_phys.clear(&self.slab_allocator); + remap.log_phys.clear(&self.slab_allocator); } // Free up the space used by the old index and rotate in the new index. diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/remap.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/remap.rs new file mode 100644 index 000000000000..d261c06cece5 --- /dev/null +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/remap.rs @@ -0,0 +1,101 @@ +use std::collections::BTreeMap; +use std::fmt::Debug; +use std::ops::Bound::Included; +use std::ops::Bound::Unbounded; +use std::sync::Arc; + +use futures::StreamExt; +use serde::Deserialize; +use serde::Serialize; + +use crate::base_types::DiskLocation; +use crate::base_types::Extent; +use crate::block_access::BlockAccess; +use crate::block_based_log::BlockBasedLog; +use crate::block_based_log::BlockBasedLogEntry; +use crate::block_based_log::BlockBasedLogPhys; +use crate::slab_allocator::SlabAccess; +use crate::slab_allocator::SlabAllocator; + +#[derive(Debug, Serialize, Deserialize, Copy, Clone)] +pub(super) struct RemapLogEntry { + old: Extent, + new: Option, +} +impl BlockBasedLogEntry for RemapLogEntry {} + +#[derive(Debug)] +pub(super) struct RemapState { + pub(super) map: BTreeMap>, + pub(super) log_phys: BlockBasedLogPhys, +} + +impl RemapState { + pub(super) async fn open( + block_access: Arc, + slab_access: &SlabAccess, + log_phys: BlockBasedLogPhys, + ) -> Self { + Self { + map: log_phys + .iter(block_access, slab_access) + .map(|entry| (entry.old, entry.new)) + .collect() + .await, + log_phys, + } + } + + pub(super) async fn create( + block_access: Arc, + slab_allocator: Arc, + map: BTreeMap>, + ) -> Self { + let mut log = + BlockBasedLog::::open(block_access, slab_allocator, Default::default()); + for (&old, &new) in map.iter() { + log.push(RemapLogEntry { old, new }); + } + let log_phys = log.flush().await; + Self { map, log_phys } + } + + pub(super) fn remap(&self, extent: Extent) -> Option { + if let Some((old, new)) = self + .map + .range((Unbounded, Included(extent.location))) + .next_back() + { + if old.contains(&extent) { + match new { + Some(new_location) => { + // This represents the offset of the passed in extent, into the extent + // that was moved as part of the rebalance operation. For example, + // multiple contiguously allocated blocks maybe have been moved via a + // single extent. Thus, to remap one of those blocks' to it's new + // location on disk, we need this offset (this offset is maintained when + // the blocks are copied). + let offset = extent.location - old.location; + + return Some(DiskLocation::new( + new_location.disk(), + new_location.offset() + offset, + )); + } + None => { + // This means the extent was part of a rebalance operation, but when + // attempting to remap the old location to a new location, the allocation + // failed. Thus, the old extent does not have new location, and it will + // be invalid after the rebalance completes. + return None; + } + } + } + } + + // If we reach this point, we didn't find an extent in the mapping that contains the passed + // in extent, which means the passed in extent was not remapped; thus, we simply + // return the old extent's location. + Some(extent.location) + } +} From b8b19dbc31af27903c8735a5ae07a5765b5a63c3 Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Wed, 8 Jun 2022 12:20:55 -0700 Subject: [PATCH 112/119] discovery: don't bail on fs::canonicalize() errors (#473) --- cmd/zfs_object_agent/zettacache/src/open.rs | 39 ++++++++++++++------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/cmd/zfs_object_agent/zettacache/src/open.rs b/cmd/zfs_object_agent/zettacache/src/open.rs index 92aa51ade934..39a968ac9537 100644 --- a/cmd/zfs_object_agent/zettacache/src/open.rs +++ b/cmd/zfs_object_agent/zettacache/src/open.rs @@ -80,8 +80,16 @@ async fn discover_devices(dir_path: &Path, target_guid: Option) -> Result { + if meta.is_dir() { + continue; + } + } + Err(why) => { + debug!("discovery: {entry:?}.metadata() failed. error: {why:?}"); + continue; + } } // In certain directories under /dev we've come across device symlinks @@ -90,18 +98,25 @@ async fn discover_devices(dir_path: &Path, target_guid: Option) -> Result { + if !canonical_entries.contains(&canonical_path) { + canonical_entries.insert(canonical_path); - // We use the original directory path here instead of the - // resolved/canonical path to avoid surprising the user. E.g. `zcache - // list -f` should show device paths from the discovery directory - // supplied by the user instead of the resolved device paths. - discovery.push(DiscoveredDevice::from_path(path)) + // We use the original directory path here instead of the + // resolved/canonical path to avoid surprising the user. E.g. `zcache + // list -f` should show device paths from the discovery directory + // supplied by the user instead of the resolved device paths. + discovery.push(DiscoveredDevice::from_path(path)) + } + } + Err(why) => { + debug!("discovery: fs::canonicalize({path:?}) failed. error: {why:?}"); + continue; + } + } } + while let Some(result) = discovery.next().await { match result { Ok(device) => { From 4fb53e7ea664caa89be24afd61dfe82ae24a4809 Mon Sep 17 00:00:00 2001 From: Manoj Joseph Date: Wed, 8 Jun 2022 12:45:12 -0700 Subject: [PATCH 113/119] DLPX-80445 DOSE-Azure: Support streaming list operation (#462) --- cmd/zfs_object_agent/client/src/main.rs | 45 ++++--- .../zettaobject/src/object_access/blob.rs | 125 ++++++++++-------- 2 files changed, 99 insertions(+), 71 deletions(-) diff --git a/cmd/zfs_object_agent/client/src/main.rs b/cmd/zfs_object_agent/client/src/main.rs index 8ed3b0444957..a1bd32f37da6 100644 --- a/cmd/zfs_object_agent/client/src/main.rs +++ b/cmd/zfs_object_agent/client/src/main.rs @@ -9,6 +9,7 @@ use std::fs; use std::fs::File; use std::io::prelude::*; use std::io::Read; +use std::num::NonZeroU32; use std::sync::Arc; use std::thread; use std::time::Duration; @@ -456,8 +457,7 @@ async fn get_object_access(cli_params: CliParams) -> Arc { .unwrap() } -async fn do_blob(cli_params: CliParams) -> Result<(), Box> { - let key = "blob2.txt".to_string(); +async fn do_blob(cli_params: CliParams, count: NonZeroU32) -> Result<(), Box> { let bucket_access = BucketAccess::new(cli_params.oa_protocol.clone()).await?; let buckets = bucket_access.list_buckets().await; println!("List containers {:?}", buckets); @@ -468,21 +468,24 @@ async fn do_blob(cli_params: CliParams) -> Result<(), Box> { let object_access = ObjectAccess::new(cli_params.oa_protocol, cli_params.bucket, false).await?; let content = "I want to go to azure".as_bytes().to_vec(); - object_access - .put_object_stream( - key.clone(), - || (ByteStream::from(content.clone()), content.len()), - ObjectAccessOpType::MetadataPut, - ) - .await; + for n in 0..count.get() { + let key = format!("blob_{}.txt", n); + object_access + .put_object_stream( + key.clone(), + || (ByteStream::from(content.clone()), content.len()), + ObjectAccessOpType::MetadataPut, + ) + .await; - let bytes = object_access - .get_object(key.clone(), ObjectAccessOpType::ReadsGet) - .await?; - println!("Get blob data [{}]: {:?}", key, bytes); + let bytes = object_access + .get_object(key.clone(), ObjectAccessOpType::ReadsGet) + .await?; + println!("Get blob data [{}]: {:?}", key, bytes); - let stat = object_access.stat_object(key.clone()).await; - println!("Last modified: [{}]: {:?}", key, stat); + let stat = object_access.stat_object(key.clone()).await; + println!("Last modified: [{}]: {:?}", key, stat); + } println!( "List blobs {:?}", @@ -492,7 +495,10 @@ async fn do_blob(cli_params: CliParams) -> Result<(), Box> { .await ); - object_access.delete_object(key).await; + for n in 0..count.get() { + let key = format!("blob_{}.txt", n); + object_access.delete_object(key).await; + } Ok(()) } @@ -563,7 +569,10 @@ struct Cli { #[derive(Clone, Subcommand)] enum Commands { S3Rusoto, - Blob, + Blob { + #[clap(short = 'c', long, default_value = "10")] + count: NonZeroU32, + }, BlobLoop { #[clap( short = 's', @@ -736,7 +745,7 @@ async fn main() -> Result<(), Box> { match cli.command { Commands::S3Rusoto => do_s3_rusoto().await?, - Commands::Blob => do_blob(cli_params).await?, + Commands::Blob { count } => do_blob(cli_params, count).await?, Commands::BlobLoop { seconds } => do_blob_loop(&object_access, seconds).await?, Commands::Create => do_create().await?, Commands::Write => do_write().await?, diff --git a/cmd/zfs_object_agent/zettaobject/src/object_access/blob.rs b/cmd/zfs_object_agent/zettaobject/src/object_access/blob.rs index 04f12e11bfec..9f4532144725 100644 --- a/cmd/zfs_object_agent/zettaobject/src/object_access/blob.rs +++ b/cmd/zfs_object_agent/zettaobject/src/object_access/blob.rs @@ -14,6 +14,7 @@ use anyhow::Context; use anyhow::Result; use async_stream::try_stream; use async_trait::async_trait; +use azure_core::prelude::NextMarker; use azure_core::HttpError; use azure_identity::ImdsManagedIdentityCredential; use azure_identity::TokenCredential; @@ -259,28 +260,34 @@ impl BlobBucketAccess { impl BucketAccessTrait for BlobBucketAccess { async fn list_buckets(&self) -> Vec { let msg = "list_buckets"; - let list_output = retry(msg, None, || async { - let result = self - .get_bucket_client() - .await - .list_containers() - .execute() - .await - .map_err(|e| { + let mut next_marker: Option = None; + let mut buckets = Vec::new(); + + loop { + let list_output = retry(msg, None, || async { + let bucket_client = self.get_bucket_client().await; + let list_containers_builder = bucket_client.list_containers(); + let list_containers_builder = if let Some(nm) = next_marker.as_ref() { + list_containers_builder.next_marker(nm.clone()) + } else { + list_containers_builder + }; + + list_containers_builder.execute().await.map_err(|e| { debug!("{}: {}", msg, e); Self::convert_error::(e) - }); + }) + }) + .await + .unwrap(); - result - }) - .await; + buckets.extend(list_output.incomplete_vector.iter().map(|c| c.name.clone())); - list_output - .unwrap() - .incomplete_vector - .iter() - .map(|c| c.name.clone()) - .collect() + next_marker = list_output.incomplete_vector.next_marker().cloned(); + if next_marker.is_none() { + return buckets; + } + } } } @@ -608,48 +615,60 @@ impl ObjectAccessTrait for BlobObjectAccess { ) -> Pin> + Send + '_>> { let msg = format!("list {} (after {:?})", prefix, start_after); let list_prefix = prefix; + let mut next_marker: Option = None; Box::pin(try_stream! { - let output = retry(&msg, None, || async { - let container_client = self.get_container_client().await; - let list_builder = match use_delimiter { - true => - container_client - .list_blobs() - .prefix(list_prefix.as_str()) - .delimiter("/"), - false => - container_client - .list_blobs() - .prefix(list_prefix.as_str()) - }; - match list_builder.execute().await - { - Err(e) => { - debug!("{}: {}", &msg, e); - Err(Self::convert_error::(e)) + loop { + let output = retry(&msg, None, || async { + let container_client = self.get_container_client().await; + let list_builder = match use_delimiter { + true => + container_client + .list_blobs() + .prefix(list_prefix.as_str()) + .delimiter("/"), + false => + container_client + .list_blobs() + .prefix(list_prefix.as_str()) + }; + let list_builder = if let Some(nm) = next_marker.as_ref() { + list_builder.next_marker(nm.clone()) + } else { + list_builder + }; + match list_builder.execute().await + { + Err(e) => { + debug!("{}: {}", &msg, e); + Err(Self::convert_error::(e)) + } + Ok(res) => Ok(res), } - Ok(res) => Ok(res), - } - }) - .await?; - - // XXX The performance of this is likely to be quite bad. We need a better solution. DOSE-1215 - let initial = start_after.unwrap_or("".to_string()); - if list_prefixes { - if let Some(prefixes) = output.blobs.blob_prefix { - for blob_prefix in prefixes { - if initial < blob_prefix.name { - yield blob_prefix.name; + }) + .await?; + + // XXX The performance of this is likely to be quite bad. We need a better solution. DOSE-1215 + let initial = start_after.clone().unwrap_or_default(); + if list_prefixes { + if let Some(prefixes) = output.blobs.blob_prefix { + for blob_prefix in prefixes { + if initial < blob_prefix.name { + yield blob_prefix.name; + } } } - } - } else { - for blob in output.blobs.blobs { - if initial < blob.name { - yield blob.name; + } else { + for blob in output.blobs.blobs { + if initial < blob.name { + yield blob.name; + } } } + next_marker = output.next_marker.clone(); + if (next_marker.is_none()) { + break; + } } }) } From 2a65d441ee63fe3531f0e685d870600f0b4ca936 Mon Sep 17 00:00:00 2001 From: Paul Dagnelie Date: Fri, 10 Jun 2022 11:47:14 -0700 Subject: [PATCH 114/119] DLPX-81523 test_repeated_reboots failed with core.zcachedb (#477) Signed-off-by: Paul Dagnelie --- cmd/zfs_object_agent/zettacache/src/checkpoint.rs | 7 ++++--- cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs | 3 +-- cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/zfs_object_agent/zettacache/src/checkpoint.rs b/cmd/zfs_object_agent/zettacache/src/checkpoint.rs index 2ab6164d4e20..e51714d2618f 100644 --- a/cmd/zfs_object_agent/zettacache/src/checkpoint.rs +++ b/cmd/zfs_object_agent/zettacache/src/checkpoint.rs @@ -1,5 +1,6 @@ use std::time::Instant; +use anyhow::Result; use futures::future; use futures::stream::FuturesOrdered; use futures::stream::StreamExt; @@ -48,7 +49,7 @@ pub struct CheckpointPhys { } impl CheckpointPhys { - pub async fn read(block_access: &BlockAccess, extents: &[Extent]) -> Self { + pub async fn read(block_access: &BlockAccess, extents: &[Extent]) -> Result { let raw = extents .iter() .map(|&extent| block_access.read_raw(extent, DiskIoType::MaintenanceRead)) @@ -58,9 +59,9 @@ impl CheckpointPhys { future::ready(vec) }) .await; - let (this, _): (Self, usize) = block_access.chunk_from_raw(&raw).unwrap(); + let (this, _) = block_access.chunk_from_raw(&raw)?; debug!("got {:#?}", this); - this + Ok(this) } pub async fn write( diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs index 2c26e4bf4c53..add876f312d7 100644 --- a/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs @@ -551,8 +551,7 @@ impl Inner { let (mut primary, primary_disk, guid, extra_disks) = PrimaryPhys::read(&block_access).await.unwrap(); - // XXX proper error handling - let mut checkpoint = CheckpointPhys::read(&block_access, &primary.checkpoint).await; + let mut checkpoint = CheckpointPhys::read(&block_access, &primary.checkpoint).await?; assert_eq!(checkpoint.id, primary.checkpoint_id); let mut size_changed = false; diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs index 90ee08b03f49..1128a460d8f0 100644 --- a/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs @@ -54,7 +54,7 @@ impl ZCacheDBHandle { let block_access = Arc::new(BlockAccess::new(disks, true)); let (primary, primary_disk, guid, _extra_disks) = PrimaryPhys::read(&block_access).await?; - let checkpoint = Arc::new(CheckpointPhys::read(&block_access, &primary.checkpoint).await); + let checkpoint = Arc::new(CheckpointPhys::read(&block_access, &primary.checkpoint).await?); let mut slab_builder = SlabAllocatorBuilder::new(checkpoint.slab_allocator.clone()); // We should be able to get away without claiming the metadata space, From e234ba72a1cd28b6d08dd95e6aac6faacb474cdc Mon Sep 17 00:00:00 2001 From: Paul Dagnelie Date: Fri, 10 Jun 2022 13:48:38 -0700 Subject: [PATCH 115/119] DLPX-81521 Don't retry pool scan 15 times during import (#475) Signed-off-by: Paul Dagnelie --- .../zettaobject/src/public_connection.rs | 23 +++++++++++++++++-- lib/libzutil/zutil_import.c | 7 ++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/cmd/zfs_object_agent/zettaobject/src/public_connection.rs b/cmd/zfs_object_agent/zettaobject/src/public_connection.rs index d8a591f1e004..39d32b43936b 100644 --- a/cmd/zfs_object_agent/zettaobject/src/public_connection.rs +++ b/cmd/zfs_object_agent/zettaobject/src/public_connection.rs @@ -3,6 +3,7 @@ use std::path::Path; use std::sync::Arc; use std::sync::Mutex; +use anyhow::Context; use futures::stream::StreamExt; use log::*; use nvpair::NvList; @@ -23,7 +24,9 @@ use crate::pool::*; use crate::pool_destroy; use crate::pool_destroy::DestroyingPool; use crate::server::return_ok; +use crate::server::return_result; use crate::server::ConnectionState; +use crate::server::FailureMessage; use crate::server::HandlerReturn; use crate::server::Server; @@ -99,8 +102,24 @@ impl PublicConnectionState { bucket: Option, guid: Option, } - let request: GetPoolsRequest = nvpair::from_nvlist(&nvl)?; - let bucket_access = BucketAccess::new(request.protocol.clone()).await?; + let request: GetPoolsRequest = + match nvpair::from_nvlist(&nvl).context("bad or insufficient parameters") { + Ok(request) => request, + Err(e) => { + let result = Err::<(), _>(FailureMessage::new(e)); + return return_result((), result, true); + } + }; + let bucket_access = match BucketAccess::new(request.protocol.clone()) + .await + .context("connection error") + { + Ok(bucket_access) => bucket_access, + Err(e) => { + let result = Err::<(), _>(FailureMessage::new(e)); + return return_result((), result, true); + } + }; let buckets = if let Some(bucket) = request.bucket { vec![bucket] } else { diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c index 6626691da586..3729710b030d 100644 --- a/lib/libzutil/zutil_import.c +++ b/lib/libzutil/zutil_import.c @@ -1901,6 +1901,13 @@ zpool_find_import_agent(libpc_handle_t *hdl, importargs_t *iarg, nvlist_t *resp = zoa_send_recv_msg(hdl, msg, AGENT_PUBLIC_PROTOCOL_VERSION, ZFS_PUBLIC_SOCKET, NULL); + char *err; + if (nvlist_lookup_string(resp, "errstr", &err) == 0) { + fprintf(stderr, "Agent pool scan failed: %s\n", err); + fnvlist_free(resp); + return; + } + nvlist_t *pools = NULL; (void) nvlist_lookup_nvlist(resp, "pools", &pools); From 7a5dae7e7344199db170a5abc901d545e83c9d2b Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Sat, 11 Jun 2022 17:05:05 -0700 Subject: [PATCH 116/119] measure zettacache::Locked acquisition and hold times (#478) Add 2 new macros to the `measure` infrastructure: `lock_measured!(&tokio::sync::Mutex)` and `lock_non_send_measured!(&tokio::sync::Mutex)`. These macros measure the lock acquision time, count, and number of in-flight waiters; as well as the lock hold time and number of in-flight holders (which is at most one). Use this infrastructure to measure the `zettacache::Locked` lock for all acquirers. Remove the now-unused `lock_non_send()` function in favor of `lock_non_send_measured!()`. --- cmd/zfs_object_agent/util/src/lib.rs | 2 - cmd/zfs_object_agent/util/src/measure/lock.rs | 79 +++++++++++++++++++ .../util/src/measure/lock_non_send.rs | 75 ++++++++++++++++++ .../util/src/{measure.rs => measure/mod.rs} | 42 +++++++--- cmd/zfs_object_agent/util/src/mutex_ext.rs | 36 --------- .../zettacache/src/zettacache/merge.rs | 10 ++- .../zettacache/src/zettacache/mod.rs | 45 ++++++----- 7 files changed, 214 insertions(+), 75 deletions(-) create mode 100644 cmd/zfs_object_agent/util/src/measure/lock.rs create mode 100644 cmd/zfs_object_agent/util/src/measure/lock_non_send.rs rename cmd/zfs_object_agent/util/src/{measure.rs => measure/mod.rs} (93%) delete mode 100644 cmd/zfs_object_agent/util/src/mutex_ext.rs diff --git a/cmd/zfs_object_agent/util/src/lib.rs b/cmd/zfs_object_agent/util/src/lib.rs index cd192f481db5..f7305e7aca29 100644 --- a/cmd/zfs_object_agent/util/src/lib.rs +++ b/cmd/zfs_object_agent/util/src/lib.rs @@ -17,7 +17,6 @@ mod lock_set; mod logging; pub mod measure; pub mod message; -mod mutex_ext; mod nicenum; mod range_tree; pub mod serde; @@ -48,7 +47,6 @@ pub use logging::log; pub use logging::register_siguser1_to_dump_tracing; pub use logging::setup_logging; pub use logging::SUPER_EXPENSIVE_TRACE; -pub use mutex_ext::lock_non_send; pub use nicenum::nice_number_count; pub use nicenum::nice_number_time; pub use nicenum::nice_p2size; diff --git a/cmd/zfs_object_agent/util/src/measure/lock.rs b/cmd/zfs_object_agent/util/src/measure/lock.rs new file mode 100644 index 000000000000..4246a72454a3 --- /dev/null +++ b/cmd/zfs_object_agent/util/src/measure/lock.rs @@ -0,0 +1,79 @@ +use std::ops::Deref; +use std::ops::DerefMut; +use std::time::Instant; + +use super::Measurement; + +pub struct MeasuredMutexGuard<'a, T> { + inner: tokio::sync::MutexGuard<'a, T>, + begin: Instant, + hold: &'static Measurement, +} + +impl<'a, T> Drop for MeasuredMutexGuard<'a, T> { + fn drop(&mut self) { + self.hold.end_timed(self.begin); + } +} + +impl<'a, T> Deref for MeasuredMutexGuard<'a, T> { + type Target = T; + fn deref(&self) -> &Self::Target { + &self.inner + } +} + +impl<'a, T> DerefMut for MeasuredMutexGuard<'a, T> { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.inner + } +} + +pub async fn lock<'a, T>( + mutex: &'a tokio::sync::Mutex, + acquire: &'static Measurement, + hold: &'static Measurement, +) -> MeasuredMutexGuard<'a, T> { + MeasuredMutexGuard { + inner: acquire.fut_timed(mutex.lock()).await, + hold, + begin: hold.begin_timed(), + } +} + +/// This locks the mutex like `Mutex::lock()`, but measures the time spent waiting for the lock, +/// and the time spent holding the lock. +#[macro_export] +macro_rules! lock_measured { + ($lock:expr, $tag:literal) => {{ + static ACQUIRE: $crate::measure::Measurement = $crate::measure::Measurement::new(concat!( + "acquire lock ", + $tag, + " (", + file!(), + ":", + line!(), + ":", + column!(), + ")" + )); + ACQUIRE.register(); + static HOLD: $crate::measure::Measurement = $crate::measure::Measurement::new(concat!( + "hold lock ", + $tag, + " (", + file!(), + ":", + line!(), + ":", + column!(), + ")" + )); + HOLD.register(); + + $crate::measure::lock::lock($lock, &ACQUIRE, &HOLD) + }}; + ($lock:expr) => { + $crate::lock_measured!($lock, "") + }; +} diff --git a/cmd/zfs_object_agent/util/src/measure/lock_non_send.rs b/cmd/zfs_object_agent/util/src/measure/lock_non_send.rs new file mode 100644 index 000000000000..788ef10e8c35 --- /dev/null +++ b/cmd/zfs_object_agent/util/src/measure/lock_non_send.rs @@ -0,0 +1,75 @@ +use std::marker::PhantomData; +use std::ops::Deref; +use std::ops::DerefMut; + +use super::lock::MeasuredMutexGuard; +use super::Measurement; + +pub struct NonSendMeasuredMutexGuard<'a, T> { + inner: MeasuredMutexGuard<'a, T>, + _marker: PhantomData<*const ()>, +} + +impl<'a, T> Deref for NonSendMeasuredMutexGuard<'a, T> { + type Target = T; + fn deref(&self) -> &Self::Target { + &self.inner + } +} + +impl<'a, T> DerefMut for NonSendMeasuredMutexGuard<'a, T> { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.inner + } +} + +pub async fn lock_non_send<'a, T>( + mutex: &'a tokio::sync::Mutex, + acquire: &'static Measurement, + hold: &'static Measurement, +) -> NonSendMeasuredMutexGuard<'a, T> { + NonSendMeasuredMutexGuard { + inner: super::lock::lock(mutex, acquire, hold).await, + _marker: PhantomData, + } +} + +/// This locks the mutex like `Mutex::lock()`, but measures it (like `lock_measured!`), and +/// returns a new kind of guard which can not be sent between threads. This is useful if you +/// want to ensure that .await is not used while the mutex is locked by some callers, but .await +/// can be used from other callers (that use `lock_measured!` or `tokio::sync::Mutex::lock()` +/// directly). +#[macro_export] +macro_rules! lock_non_send_measured { + ($lock:expr, $tag:literal) => {{ + static ACQUIRE: $crate::measure::Measurement = $crate::measure::Measurement::new(concat!( + "acquire lock non send", + $tag, + " (", + file!(), + ":", + line!(), + ":", + column!(), + ")" + )); + ACQUIRE.register(); + static HOLD: $crate::measure::Measurement = $crate::measure::Measurement::new(concat!( + "hold lock non send", + $tag, + " (", + file!(), + ":", + line!(), + ":", + column!(), + ")" + )); + HOLD.register(); + + $crate::measure::lock_non_send::lock_non_send($lock, &ACQUIRE, &HOLD) + }}; + ($lock:expr) => { + $crate::lock_non_send_measured!($lock, "") + }; +} diff --git a/cmd/zfs_object_agent/util/src/measure.rs b/cmd/zfs_object_agent/util/src/measure/mod.rs similarity index 93% rename from cmd/zfs_object_agent/util/src/measure.rs rename to cmd/zfs_object_agent/util/src/measure/mod.rs index cdaf230bbe38..8661b93e2742 100644 --- a/cmd/zfs_object_agent/util/src/measure.rs +++ b/cmd/zfs_object_agent/util/src/measure/mod.rs @@ -1,3 +1,6 @@ +pub mod lock; +pub mod lock_non_send; + use core::fmt; use std::fmt::Display; use std::future::Future; @@ -49,6 +52,27 @@ impl Measurement { }); } + fn begin(&self) { + self.count.fetch_add(1, Ordering::Relaxed); + self.inflight.fetch_add(1, Ordering::Relaxed); + } + + fn end(&self) { + self.inflight.fetch_sub(1, Ordering::Relaxed); + } + + fn begin_timed(&self) -> Instant { + self.begin(); + Instant::now() + } + + fn end_timed(&self, begin: Instant) { + self.end(); + #[allow(clippy::cast_possible_truncation)] + let elapsed = begin.elapsed().as_nanos() as u64; + self.nanos.fetch_add(elapsed, Ordering::Relaxed); + } + /// Wrap the provided future in one that will measure its execution. // Lifetime annotations say that self must live longer than the `future` argument. This is // typically satisfied by `&'static self`, i.e. the static Measurement created by `measure!()`. @@ -66,12 +90,9 @@ impl Measurement { // times. self.fut_size.store(size_of_val(&future), Ordering::Relaxed); } - self.count.fetch_add(1, Ordering::Relaxed); - self.inflight.fetch_add(1, Ordering::Relaxed); + self.begin(); // We don't use an async function or closure because it doubles the size of the future. - future.inspect(move |_| { - self.inflight.fetch_sub(1, Ordering::Relaxed); - }) + future.inspect(|_| self.end()) } pub fn fut_timed<'a, 'b, R>( @@ -95,10 +116,9 @@ impl Measurement { where F: FnOnce() -> R, { - self.count.fetch_add(1, Ordering::Relaxed); - self.inflight.fetch_add(1, Ordering::Relaxed); + self.begin(); let result = f(); - self.inflight.fetch_sub(1, Ordering::Relaxed); + self.end(); result } @@ -107,11 +127,9 @@ impl Measurement { where F: FnOnce() -> R, { - let begin = Instant::now(); + let begin = self.begin_timed(); let result = self.func(f); - #[allow(clippy::cast_possible_truncation)] - let elapsed = begin.elapsed().as_nanos() as u64; - self.nanos.fetch_add(elapsed, Ordering::Relaxed); + self.end_timed(begin); result } diff --git a/cmd/zfs_object_agent/util/src/mutex_ext.rs b/cmd/zfs_object_agent/util/src/mutex_ext.rs deleted file mode 100644 index 78b4b610eb77..000000000000 --- a/cmd/zfs_object_agent/util/src/mutex_ext.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::marker::PhantomData; -use std::ops::Deref; -use std::ops::DerefMut; - -pub struct NonSendMutexGuard<'a, T> { - inner: tokio::sync::MutexGuard<'a, T>, - // force this to not be Send - _marker: PhantomData<*const ()>, -} - -impl<'a, T> Deref for NonSendMutexGuard<'a, T> { - type Target = T; - fn deref(&self) -> &Self::Target { - &self.inner - } -} - -impl<'a, T> DerefMut for NonSendMutexGuard<'a, T> { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.inner - } -} - -// This locks the mutex like Mutex::lock(), but returns a new kind of guard -// which can not be sent between threads. This is useful if you want to ensure -// that .await is not used while the mutex is locked by some callers, but .await -// can be used from other callers (that use tokio::sync::Mutex::lock() -// directly). -pub async fn lock_non_send(mutex: &tokio::sync::Mutex) -> NonSendMutexGuard<'_, T> { - // It would be nice to do this via an async_trait, but that requires a memory - // allocation each time it's called, which can impact performance. - NonSendMutexGuard { - inner: mutex.lock().await, - _marker: PhantomData, - } -} diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs index 1a125b041767..e482ad0120ec 100644 --- a/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs @@ -103,7 +103,9 @@ impl MergeMessage { let timer = Instant::now(); let free_count = frees.len(); let cache_updates_count = cache_updates.len(); - let (new_index, index_delta) = next_index.flush().await; + let (new_index, index_delta) = measure!("new_progress() next_index.flush()") + .fut_timed(next_index.flush()) + .await; let message = MergeProgress { new_index, index_delta, @@ -265,6 +267,8 @@ impl Progress { /// nothing to send. async fn report(&mut self) { if let Some(last_key) = self.last_key { + let entries_len = self.entries.len(); + let frees_len = self.frees.len(); measure!("Progress::report() tx.send(IndexMessage)") .fut_timed(self.tx.send(IndexMessage { last_key, @@ -280,9 +284,7 @@ impl Progress { .await .unwrap_or_else(|e| panic!("couldn't send: {e}")); trace!( - "Collected and sent {} entries and {} frees to next_index_task in {}ms", - self.entries.len(), - self.frees.len(), + "Collected and sent {entries_len} entries and {frees_len} frees to next_index_task after {}ms", self.timer.elapsed().as_millis() ); self.timer = Instant::now(); diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs index add876f312d7..284e8220212e 100644 --- a/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs @@ -44,7 +44,8 @@ use tokio::sync::OwnedSemaphorePermit; use tokio::sync::Semaphore; use tokio::time::sleep_until; use util::concurrent_batch::ConcurrentBatch; -use util::lock_non_send; +use util::lock_measured; +use util::lock_non_send_measured; use util::measure; use util::message::ExpandDiskResponse; use util::nice_p2size; @@ -819,7 +820,7 @@ impl Inner { CACHE_INSERT_DEMAND_BUFFER_SIZE.as_u64() - cache.demand_buffer_bytes_available.available_permits() as u64, ); - measure!().fut(lock_non_send(&locked)).await.update_stats(); + lock_non_send_measured!(&locked).await.update_stats(); } }); @@ -881,7 +882,7 @@ impl Inner { loop { // if there is no current merging state, check to see if a merge should be started { - let mut locked = self.locked.lock().await; + let mut locked = lock_measured!(&self.locked).await; if locked.merge.is_none() { assert!(merging.is_none()); merging = locked.try_start_merge_task(self.old_index.clone()).await; @@ -931,7 +932,7 @@ impl Inner { ); { - let mut locked = self.locked.lock().await; + let mut locked = lock_non_send_measured!(&self.locked).await; let begin = Instant::now(); // free the extent ranges associated with the evicted blocks @@ -993,7 +994,7 @@ impl Inner { let mut old_index = self.old_index.write().await; let mut new_index_opt = self.new_index.write().await; - let mut locked = self.locked.lock().await; + let mut locked = lock_measured!(&self.locked).await; locked.rotate_index(&mut old_index, new_index).await; locked.block_allocator.rebalance_fini(); *new_index_opt = None; @@ -1052,7 +1053,10 @@ impl Inner { let begin = Instant::now(); // Bind to a variable here so that we can drop the state lock before waiting for the // batch of reads to complete. - let outstanding_reads = lock_non_send(&self.locked).await.outstanding_reads.rotate(); + let outstanding_reads = lock_non_send_measured!(&self.locked) + .await + .outstanding_reads + .rotate(); outstanding_reads.await; debug!( "waited for outstanding_reads in {}ms", @@ -1065,7 +1069,7 @@ impl Inner { // index/operation_log will actually have the correct contents. See above comments // on how the ConcurrentBatch is manipulated. let begin = Instant::now(); - let outstanding_writes = lock_non_send(&self.locked) + let outstanding_writes = lock_non_send_measured!(&self.locked) .await .outstanding_writes .rotate(); @@ -1078,7 +1082,7 @@ impl Inner { let (old_index_phys, delta) = self.old_index.write().await.flush().await; assert!(delta.is_empty()); - let mut locked = self.locked.lock().await; + let mut locked = lock_measured!(&self.locked).await; // Now that we have the state lock, we need to wait for outstanding i/os again, because // more i/os could have been initiated while we were waiting above. Those i/os will @@ -1183,7 +1187,7 @@ impl Inner { let fut_or_f = { // We don't want to hold the state lock while reading from disk so we use // lock_non_send() to ensure that we can't hold it across .await. - let mut locked = measure!().fut(lock_non_send(&self.locked)).await; + let mut locked = lock_non_send_measured!(&self.locked).await; let got_value = |locked: &mut Locked, f: F, counter, value| { if count_ghost_hits { @@ -1265,7 +1269,7 @@ impl Inner { Some(entry) => { // Again, we don't want to hold the state lock while reading from disk so we use // lock_non_send() to ensure that we can't hold it across .await. - let mut locked = measure!().fut(lock_non_send(&self.locked)).await; + let mut locked = lock_non_send_measured!(&self.locked).await; // The LockedKey prevents an entry for this key from being inserted while we // weren't holding the state lock. @@ -1282,7 +1286,7 @@ impl Inner { None => { // key not in index super_trace!("lookup {key:?}: cache miss after reading index"); - let mut locked = measure!().fut(lock_non_send(&self.locked)).await; + let mut locked = lock_non_send_measured!(&self.locked).await; f(&mut locked, None) } }; @@ -1344,11 +1348,10 @@ impl Inner { bytes }; let len = bytes.len() as u64; - let fut = measure!().fut(lock_non_send(&self.locked)).await.insert( - locked_key, - &self.pool_guids, - bytes, - ); + let fut = + lock_non_send_measured!(&self.locked) + .await + .insert(locked_key, &self.pool_guids, bytes); match measure!().fut(fut).await { Ok(_) => { self.stats.track_bytes(InsertBytes, len); @@ -1483,20 +1486,20 @@ impl Inner { } async fn add_disk(&self, path: &Path) -> Result<()> { - self.locked.lock().await.add_disk(path)?; + lock_measured!(&self.locked).await.add_disk(path)?; self.sync_checkpoint().await; Ok(()) } // Returns the amount of additional space, in bytes async fn expand_disk(&self, path: &Path) -> Result { - let additional_bytes = self.locked.lock().await.expand_disk(path)?; + let additional_bytes = lock_measured!(&self.locked).await.expand_disk(path)?; self.sync_checkpoint().await; Ok(additional_bytes) } async fn initiate_merge(&self) { - self.locked.lock().await.request_merge(); + lock_measured!(&self.locked).await.request_merge(); self.sync_checkpoint().await; } @@ -1519,11 +1522,11 @@ impl Inner { } async fn hits_by_size_data(&self) -> SizeHistogramPhys { - self.locked.lock().await.size_histogram.clone() + lock_measured!(&self.locked).await.size_histogram.clone() } async fn clear_hit_data(&self) { - self.locked.lock().await.clear_hit_data(); + lock_measured!(&self.locked).await.clear_hit_data(); } fn devices(&self) -> DeviceList { From 75c74ba5db9c9becd7e45ad488b0e25cf1582a61 Mon Sep 17 00:00:00 2001 From: Serapheim Dimitropoulos Date: Mon, 13 Jun 2022 14:00:24 -0700 Subject: [PATCH 117/119] DLPX-81000 Generate Disk GUID for ZettaCache Devices (#434) Side-Change: Also record sector_size on-disk --- cmd/zfs_object_agent/server/src/main.rs | 3 +- cmd/zfs_object_agent/zcdb/src/main.rs | 3 +- .../zettacache/src/base_types.rs | 34 +++++++ .../zettacache/src/features.rs | 5 + cmd/zfs_object_agent/zettacache/src/open.rs | 96 ++++++++++++------- .../zettacache/src/superblock.rs | 77 +++++++++++---- .../zettacache/src/zettacache/mod.rs | 7 +- .../zettacache/src/zettacache/zcdb.rs | 5 +- 8 files changed, 167 insertions(+), 63 deletions(-) diff --git a/cmd/zfs_object_agent/server/src/main.rs b/cmd/zfs_object_agent/server/src/main.rs index 86ebc7dd22f6..be0b24ea4a2b 100644 --- a/cmd/zfs_object_agent/server/src/main.rs +++ b/cmd/zfs_object_agent/server/src/main.rs @@ -11,6 +11,7 @@ use util::writeln_stderr; use util::TrackingAllocator; use util::ALLOCATOR_PRINT_MIN_ALLOCS; use util::ALLOCATOR_PRINT_MIN_BYTES; +use zettacache::base_types::CacheGuid; use zettacache::CacheOpenMode; use zettaobject::object_access::BlobCredentials; use zettaobject::object_access::ObjectAccessProtocol; @@ -90,7 +91,7 @@ struct Cli { value_name = "GUID", conflicts_with = "cache-device" )] - guid: Option, + guid: Option, /// Clear the cache when it has incompatible features #[clap(long)] diff --git a/cmd/zfs_object_agent/zcdb/src/main.rs b/cmd/zfs_object_agent/zcdb/src/main.rs index a13af5ca2b3c..35e97389b350 100644 --- a/cmd/zfs_object_agent/zcdb/src/main.rs +++ b/cmd/zfs_object_agent/zcdb/src/main.rs @@ -3,6 +3,7 @@ use std::path::PathBuf; use clap::Parser; use clap::Subcommand; use git_version::git_version; +use zettacache::base_types::CacheGuid; use zettacache::CacheOpenMode; use zettacache::DumpSlabsOptions; use zettacache::DumpStructuresOptions; @@ -33,7 +34,7 @@ struct Cli { /// Specific cache GUID to look for in cache device directory #[clap(short = 'g', long, value_name = "GUID")] - guid: Option, + guid: Option, /// Sets the verbosity level for logging and debugging #[clap(short = 'v', long, parse(from_occurrences), global = true)] diff --git a/cmd/zfs_object_agent/zettacache/src/base_types.rs b/cmd/zfs_object_agent/zettacache/src/base_types.rs index 6afc69ebc949..f0aa6ffcc1d7 100644 --- a/cmd/zfs_object_agent/zettacache/src/base_types.rs +++ b/cmd/zfs_object_agent/zettacache/src/base_types.rs @@ -2,8 +2,10 @@ use std::borrow::Borrow; use std::cmp::min; use std::fmt::*; use std::num::NonZeroU64; +use std::num::ParseIntError; use std::ops::Add; use std::ops::Sub; +use std::str::FromStr; use more_asserts::*; use serde::Deserialize; @@ -18,6 +20,38 @@ impl Display for PoolGuid { } } +#[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, PartialEq, Hash)] +pub struct CacheGuid(pub u64); +impl CacheGuid { + pub fn new() -> Self { + CacheGuid(rand::random()) + } +} +impl Default for CacheGuid { + fn default() -> Self { + CacheGuid::new() + } +} +impl FromStr for CacheGuid { + type Err = ParseIntError; + fn from_str(s: &str) -> std::result::Result { + s.parse().map(CacheGuid) + } +} + +#[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] +pub struct DiskGuid(pub u64); +impl DiskGuid { + pub fn new() -> Self { + DiskGuid(rand::random()) + } +} +impl Default for DiskGuid { + fn default() -> Self { + DiskGuid::new() + } +} + #[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash)] pub struct BlockId(pub u64); impl Display for BlockId { diff --git a/cmd/zfs_object_agent/zettacache/src/features.rs b/cmd/zfs_object_agent/zettacache/src/features.rs index 9563ce87cc14..362140708411 100644 --- a/cmd/zfs_object_agent/zettacache/src/features.rs +++ b/cmd/zfs_object_agent/zettacache/src/features.rs @@ -28,6 +28,7 @@ lazy_static! { SLAB_ALLOCATOR.clone(), SLAB_SIZE_32MB.clone(), TRIMMED_INDEX.clone(), + DISK_GUIDS.clone(), ] .map(|feature: Feature| (feature.name, feature.info)) .into_iter() @@ -48,6 +49,10 @@ lazy_static! { name: FeatureName("com.delphix:trimmed_index".to_string()), info: FeatureType::Upgradeable }; + pub static ref DISK_GUIDS: Feature = Feature { + name: FeatureName("com.delphix:disk_guids".to_string()), + info: FeatureType::Upgradeable + }; } #[derive(Debug)] diff --git a/cmd/zfs_object_agent/zettacache/src/open.rs b/cmd/zfs_object_agent/zettacache/src/open.rs index 39a968ac9537..c6ab7cb87237 100644 --- a/cmd/zfs_object_agent/zettacache/src/open.rs +++ b/cmd/zfs_object_agent/zettacache/src/open.rs @@ -16,6 +16,8 @@ use tokio::fs::File; use tokio::io::AsyncReadExt; use util::message::SUPERBLOCK_SIZE; +use crate::base_types::CacheGuid; +use crate::base_types::DiskGuid; use crate::base_types::DiskId; use crate::block_access::BlockAccess; use crate::superblock::SuperblockPhys; @@ -23,8 +25,8 @@ use crate::superblock::SuperblockPhys; #[derive(Debug, Clone)] pub enum CacheOpenMode { DeviceList(Vec), - DiscoveryDirectory(PathBuf, Option), // u64 is the cache guid - None, // no zettacache + DiscoveryDirectory(PathBuf, Option), + None, // no zettacache } impl CacheOpenMode { @@ -73,8 +75,8 @@ impl DiscoveredDevice { } } -async fn discover_devices(dir_path: &Path, target_guid: Option) -> Result> { - let mut caches = HashMap::>::new(); +async fn discover_devices(dir_path: &Path, target_guid: Option) -> Result> { + let mut caches = HashMap::<_, BTreeMap<_, _>>::new(); let mut discovery = FuturesUnordered::new(); let mut canonical_entries = HashSet::new(); @@ -121,28 +123,26 @@ async fn discover_devices(dir_path: &Path, target_guid: Option) -> Result { debug!("discovery: found device: {device:?}"); - let cache_guid = device.superblock.guid; + let cache_guid = device.superblock.cache_guid; let cache = caches.entry(cache_guid).or_default(); - if let Some(old_device) = cache.insert(device.superblock.disk, device) { - // If we crash in the middle of a zcache-add for one device - // and then do zcache-add for another device, we may get - // into a situation where discovery runs into two devices - // with the same DiskID and cache GUID. Until we make cache - // device import more deterministic (see DLPX-81000) error - // out. + let disk_guid = device.superblock.disk_guid; + if let Some(old_device) = cache.insert((device.superblock.disk, disk_guid), device) + { return Err(anyhow!( - "found two disks with {:?} for cache {cache_guid}", - old_device.superblock.disk + "found two disks with {:?} for {cache_guid:?} with {disk_guid:?}", + old_device.superblock.disk, )); } } Err(why) => debug!("discovery: error: {why:?}"), }; } - filter_invalid_caches(&mut caches); + + caches.retain(|&guid, disks| is_valid_cache(guid, disks)); if let Some(guid) = target_guid { caches.retain(|cache_guid, _| *cache_guid == guid); } + match caches.values().next() { Some(cache) => { if caches.len() > 1 { @@ -161,25 +161,51 @@ async fn discover_devices(dir_path: &Path, target_guid: Option) -> Result>) { - // Only retain caches that have a primary block - caches.retain(|_, disks| disks.values().any(|disk| disk.superblock.primary.is_some())); - - // Only retain caches whose devices we've discovered - caches.retain(|cache_guid, disks| { - let mut disk_ids_from_discovery = HashSet::new(); - let mut disk_ids_from_primary = HashSet::new(); - for (&disk_id, disk) in disks { - disk_ids_from_discovery.insert(disk_id); - if let Some(primary) = &disk.superblock.primary { - disk_ids_from_primary = primary.disks.keys().copied().collect(); - } +fn is_valid_cache( + cache_guid: CacheGuid, + disks: &mut BTreeMap<(DiskId, Option), DiscoveredDevice>, +) -> bool { + let primary = disks + .values() + .find(|&disk| disk.superblock.primary.is_some()); + + match primary { + Some(disk) => { + let disks_from_primary = disk + .superblock + .primary + .as_ref() + .unwrap() + .disks + .iter() + .map(|(k, v)| (*k, v.guid)) + .collect::>(); + + // Only retain disks with IDs that are part of the primary block + disks.retain( + |(id, disk_guid), _| match (disks_from_primary.get(id), *disk_guid) { + (Some(&guid_from_primary), Some(guid_from_superblock)) => { + guid_from_superblock == guid_from_primary + } + (Some(_guid_from_primary), None) => true, + (None, _) => false, + }, + ); + + // If we are missing any device mentioned in the primary block, + // then this cache is invalid + let disks_ids_from_discovery = disks + .keys() + .map(|(id, _)| id) + .copied() + .collect::>(); + let disk_ids_from_primary = disks_from_primary.keys().copied().collect::>(); + disk_ids_from_primary + .difference(&disks_ids_from_discovery) + .inspect(|id| info!("cache {cache_guid:?} can't find {id:?}")) + .count() + == 0 } - assert!(!disk_ids_from_primary.is_empty()); - disk_ids_from_primary - .difference(&disk_ids_from_discovery) - .inspect(|id| info!("cache {cache_guid} can't find {id:?}")) - .count() - == 0 - }); + None => false, + } } diff --git a/cmd/zfs_object_agent/zettacache/src/superblock.rs b/cmd/zfs_object_agent/zettacache/src/superblock.rs index 06276f7d2f3f..2738595d8f5b 100644 --- a/cmd/zfs_object_agent/zettacache/src/superblock.rs +++ b/cmd/zfs_object_agent/zettacache/src/superblock.rs @@ -25,7 +25,10 @@ pub const SUPERBLOCK_SIZE: u64 = util::message::SUPERBLOCK_SIZE as u64; pub struct SuperblockPhys { pub primary: Option, pub disk: DiskId, - pub guid: u64, + #[serde(alias = "guid")] + pub cache_guid: CacheGuid, + #[serde(default)] + pub disk_guid: Option, } /// Subset of SuperblockPhys that's needed to get the feature flags. @@ -33,19 +36,24 @@ pub struct SuperblockPhys { struct SuperblockFeaturesPhys { primary: Option, disk: DiskId, - guid: u64, + #[serde(alias = "guid")] + cache_guid: CacheGuid, } /// State stored about every disk #[derive(Serialize, Deserialize, Debug, Clone)] pub struct DiskPhys { pub size: u64, - // XXX put sector size in here too and verify it matches what the disk says now? + #[serde(default)] + pub guid: DiskGuid, } impl DiskPhys { pub fn new(size: u64) -> Self { - Self { size } + Self { + size, + guid: DiskGuid::new(), + } } } @@ -55,6 +63,8 @@ pub struct PrimaryPhys { pub checkpoint_id: CheckpointId, pub feature_flags: Vec, pub disks: BTreeMap, + #[serde(default)] + pub sector_size: Option, // Each extent is a single slab, but the last extent can be a fraction of a // slab. The remainder of that slab is uninitialized padding. @@ -68,17 +78,27 @@ pub struct PrimaryFeaturesPhys { } impl PrimaryPhys { - pub fn new(disks: BTreeMap, checkpoint_extents: Vec) -> Self { + pub fn new( + disks: BTreeMap, + sector_size: u64, + checkpoint_extents: Vec, + ) -> Self { PrimaryPhys { checkpoint_id: CheckpointId(0), feature_flags: SUPPORTED_FEATURES.keys().cloned().collect(), disks, + sector_size: Some(sector_size), checkpoint: checkpoint_extents, } } /// Write superblocks to all disks. - pub async fn write_all(&self, primary_disk: DiskId, guid: u64, block_access: &BlockAccess) { + pub async fn write_all( + &self, + primary_disk: DiskId, + cache_guid: CacheGuid, + block_access: &BlockAccess, + ) { // Write the non-primary disks first, so that newly-added disks will // have their superblocks present before the primary superblock is // updated to indicate that they are part of the cache. If we wrote all @@ -92,7 +112,8 @@ impl PrimaryPhys { let phys = SuperblockPhys { primary: None, disk, - guid, + cache_guid, + disk_guid: Some(self.disks.get(&disk).unwrap().guid), }; phys.write(block_access, disk).await; }) @@ -103,7 +124,8 @@ impl PrimaryPhys { let phys = SuperblockPhys { primary: Some(self.clone()), disk: primary_disk, - guid, + cache_guid, + disk_guid: Some(self.disks.get(&primary_disk).unwrap().guid), }; phys.write(block_access, primary_disk).await; } @@ -114,17 +136,19 @@ impl PrimaryPhys { .map(|phys| phys.feature_flags) } - /// Return value is (Self, primary_disk, guid, extra_disks) - pub async fn read(block_access: &BlockAccess) -> Result<(Self, DiskId, u64, Vec)> { + /// Return value is (Self, primary_disk, cache_guid, extra_disks) + pub async fn read( + block_access: &BlockAccess, + ) -> Result<(Self, DiskId, CacheGuid, Vec)> { let results = SuperblockPhys::read_all(block_access).await; - let (primary, primary_disk, guid) = results + let (mut primary, primary_disk, cache_guid) = results .iter() .find_map(|result| { if let Ok(phys) = result { phys.primary .as_ref() - .map(|primary| (primary.clone(), phys.disk, phys.guid)) + .map(|primary| (primary.clone(), phys.disk, phys.cache_guid)) } else { None } @@ -144,11 +168,21 @@ impl PrimaryPhys { // XXX proper error handling // XXX we should be able to reorder them? if let Ok(phys) = result { - assert_eq!(DiskId::new(id), phys.disk); - assert_eq!(phys.guid, guid); + let disk = DiskId::new(id); + assert_eq!(disk, phys.disk); assert!(phys.primary.is_none() || phys.disk == primary_disk); + assert_eq!(phys.cache_guid, cache_guid); + if let Some(disk_guid) = phys.disk_guid { + assert_eq!(disk_guid, primary.disks.get(&disk).unwrap().guid); + } } } + let sector_size = block_access.round_up_to_sector::(1); + if let Some(recorded_sector_size) = primary.sector_size { + assert_eq!(recorded_sector_size, sector_size); + } else { + primary.sector_size = Some(sector_size); + } assert_eq!( results.len() - extra_disks.len(), @@ -159,7 +193,7 @@ impl PrimaryPhys { results.len() - extra_disks.len() ); - Ok((primary, primary_disk, guid, extra_disks)) + Ok((primary, primary_disk, cache_guid, extra_disks)) } } @@ -213,11 +247,12 @@ impl SuperblockPhys { for block_access_disk_id in block_access.disks() { match Self::read_impl(block_access, block_access_disk_id).await { Ok(superblock) => writeln_stdout!( - "{:?} - Path: {:?} Size: {} GUID: {} Primary?: {}", + "{:?} - Path: {:?} Size: {} {:?} {:?} Primary?: {}", superblock.disk, block_access.disk_path(block_access_disk_id), nice_p2size(block_access.disk_size(block_access_disk_id)), - superblock.guid, + superblock.disk_guid, + superblock.cache_guid, match &superblock.primary { Some(primary) => format!("{:#?}", primary), None => "No".to_string(), @@ -233,17 +268,17 @@ impl SuperblockPhys { } impl PrimaryFeaturesPhys { - /// Return value is (Self, primary_disk, guid, extra_disks) + /// Return value is (Self, primary_disk, cache_guid, extra_disks) pub async fn read(block_access: &BlockAccess) -> Result { let results = SuperblockFeaturesPhys::read_all(block_access).await; - let (primary, primary_disk, guid) = results + let (primary, primary_disk, cache_guid) = results .iter() .find_map(|result| { if let Ok(phys) = result { phys.primary .as_ref() - .map(|primary| (primary.clone(), phys.disk, phys.guid)) + .map(|primary| (primary.clone(), phys.disk, phys.cache_guid)) } else { None } @@ -255,7 +290,7 @@ impl PrimaryFeaturesPhys { // XXX we should be able to reorder them? if let Ok(phys) = result { assert_eq!(DiskId::new(id), phys.disk); - assert_eq!(phys.guid, guid); + assert_eq!(phys.cache_guid, cache_guid); assert!(phys.primary.is_none() || phys.disk == primary_disk); } } diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs index 284e8220212e..28650812b747 100644 --- a/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/mod.rs @@ -211,7 +211,7 @@ type PendingChanges = BTreeMap; struct Locked { block_access: Arc, primary: PrimaryPhys, - guid: u64, + guid: CacheGuid, primary_disk: DiskId, block_allocator: BlockAllocator, pending_changes: PendingChanges, @@ -449,7 +449,7 @@ impl Inner { } let block_access = BlockAccess::new(disks, false); - let guid: u64 = rand::random(); + let guid = CacheGuid::new(); let total_capacity = block_access.total_capacity(); info!("creating cache from {} disks", block_access.disks().count()); @@ -483,6 +483,7 @@ impl Inner { .disks() .map(|disk| (disk, DiskPhys::new(block_access.disk_size(disk)))) .collect(), + block_access.round_up_to_sector(1), checkpoint_extents, ) .write_all(DiskId::new(0), guid, &block_access) @@ -605,7 +606,7 @@ impl Inner { } info!( - "opening ZettaCache {} with {} disks", + "opening ZettaCache {:?} with {} disks", guid, primary.disks.len() ); diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs index 1128a460d8f0..d4ab0c154b3a 100644 --- a/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs @@ -8,6 +8,7 @@ use util::writeln_stderr; use util::writeln_stdout; use super::CheckpointPhys; +use crate::base_types::CacheGuid; use crate::base_types::DiskId; use crate::block_access::BlockAccess; use crate::block_access::Disk; @@ -24,7 +25,7 @@ pub struct ZCacheDBHandle { block_access: Arc, primary: PrimaryPhys, primary_disk: DiskId, - guid: u64, + guid: CacheGuid, checkpoint: Arc, slab_builder: SlabAllocatorBuilder, } @@ -74,7 +75,7 @@ impl ZCacheDBHandle { pub async fn dump_space(&self) { writeln_stdout!("Superblock: {}", nice_p2size(SUPERBLOCK_SIZE)); - writeln_stdout!(" Primary {:?}, GUID: {}", self.primary_disk, self.guid); + writeln_stdout!(" Primary {:?}, {:?}", self.primary_disk, self.guid); writeln_stdout!(); let slabs_capacity = self From 48699394544e33212ab7b69795de3adf65efbd77 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Mon, 13 Jun 2022 15:01:10 -0700 Subject: [PATCH 118/119] fix bug in `AggregatingWriter::write()` (#480) If `AggregatingWriter::write()` is passed a slice that's larger than the buffer capacity, it will panic. This normally doesn't happen, since the BlockBasedLogChunk is designed to be small (a few KB). This commit changes `Aggregatingwriter::Write()` to allocate a larger buffer if necessary. --- cmd/zfs_object_agent/zettacache/src/aggregating_writer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/zfs_object_agent/zettacache/src/aggregating_writer.rs b/cmd/zfs_object_agent/zettacache/src/aggregating_writer.rs index 433d162fa798..fec6b9eb2e18 100644 --- a/cmd/zfs_object_agent/zettacache/src/aggregating_writer.rs +++ b/cmd/zfs_object_agent/zettacache/src/aggregating_writer.rs @@ -1,3 +1,4 @@ +use std::cmp::max; use std::sync::Arc; use tokio::sync::RwLock; @@ -40,7 +41,7 @@ impl AggregatingWriter { None => { let mut vec = with_alloctag("AggregatingWriter PendingWrite", || { AlignedVec::with_capacity( - self.capacity, + max(self.capacity, data.len()), self.block_access.round_up_to_sector(1), ) }); From 484b664ae4fab9f96eac484ab595179ed2cc169b Mon Sep 17 00:00:00 2001 From: Manoj Joseph Date: Tue, 14 Jun 2022 12:33:22 -0700 Subject: [PATCH 119/119] DLPX-81529 DOSE-Azure: object-protocol is not getting set as a zpool property (#476) --- cmd/zpool/zpool_main.c | 8 ++++++++ cmd/zpool/zpool_vdev.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index f377ce42eafe..abb638130ce6 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -1655,6 +1655,14 @@ zpool_do_create(int argc, char **argv) goto errout; } + /* Allocate props before passing it */ + if (props == NULL && + nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) { + (void) fprintf(stderr, + gettext("internal error: out of memory\n")); + return (1); + } + char *profile; if ((nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_OBJ_CRED_PROFILE), &profile)) == 0) { diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index 2ed379229432..ad3f7263e9f2 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -1721,6 +1721,15 @@ construct_spec(nvlist_t *props, int argc, char **argv) argv[1])) == NULL) { goto spec_out; } + + /* + * Add object-protocol as a property so that it is set + * as a zpool property. + */ + fnvlist_add_string(props, + zpool_prop_to_name(ZPOOL_PROP_OBJ_PROTOCOL), + fulltype); + argc -= 2; argv += 2; } else {