diff --git a/.github/workflows/zfs-tests-functional.yml b/.github/workflows/zfs-tests-functional.yml index 56f165b1d62c..a5da114ffb1f 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 + ./configure --enable-debug --enable-debuginfo --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 ce68bb7dd6bc..408b9ebae0b0 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 + ./configure --enable-debug --enable-debuginfo --with-config=dist - name: Make run: | make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod diff --git a/.gitignore b/.gitignore index 3dc58e823484..7bc5769696c7 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,41 +82,12 @@ 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 .vscode - *.so *.so.debug *.so.full +*.log 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 diff --git a/Makefile.am b/Makefile.am index d6ea2b17fffc..10a4b6eb5638 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,68 +1,85 @@ +CLEANFILES = +dist_noinst_DATA = +INSTALL_DATA_HOOKS = +ALL_LOCAL = +CLEAN_LOCAL = +CHECKS = shellcheck checkbashisms + +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 SUBDIRS = include if BUILD_LINUX -SUBDIRS += rpm +include $(srcdir)/%D%/rpm/Makefile.am endif if CONFIG_USER -SUBDIRS += man scripts lib tests cmd etc contrib +SUBDIRS += lib +if BUILD_RUST +SUBDIRS += cmd/zfs_object_agent cmd/zfs_object_agent/scripts +endif +include $(srcdir)/%D%/cmd/Makefile.am +include $(srcdir)/%D%/contrib/Makefile.am +include $(srcdir)/%D%/etc/Makefile.am +include $(srcdir)/%D%/man/Makefile.am +include $(srcdir)/%D%/scripts/Makefile.am +include $(srcdir)/%D%/tests/Makefile.am if BUILD_LINUX -SUBDIRS += udev +include $(srcdir)/%D%/udev/Makefile.am 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 += 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 +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@ GITREV = include/zfs_gitrev.h - -PHONY = gitrev +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 \ @@ -74,44 +91,27 @@ distclean-local:: -o -name '*.gcno' \) \ -type f -delete -all-local: - -[ -x ${top_builddir}/scripts/zfs-tests.sh ] && \ - ${top_builddir}/scripts/zfs-tests.sh -c +PHONY += $(CLEAN_LOCAL) +clean-local: $(CLEAN_LOCAL) + +PHONY += $(ALL_LOCAL) +all-local: $(ALL_LOCAL) 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 -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 $(CHECKS) +codecheck: $(CHECKS) -PHONY += codecheck -codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck zstdcheck \ - rustfmt rustclippy +SHELLCHECKSCRIPTS += autogen.sh PHONY += checkstyle 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 @@ -120,17 +120,12 @@ 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]' \ - ! -name 'zfs_config.*' \ - ! -name '*.mod.c' \ - ! -name 'opt_global.h' \ - ! -name '*_if*.h' \ + $(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' \ ! -name 'libzoa.h' \ ! -name 'zstd_compat_wrapper.h' \ ! -path './module/zstd/lib/*' \ @@ -141,7 +136,7 @@ cstyle: RUSTDIRS = cmd/zfs_object_agent -PHONY += rustfmt +CHECKS += rustfmt rustfmt: $(RUSTDIRS) @if type cargo-fmt > /dev/null 2>&1; then \ toolchain="" ; \ @@ -156,7 +151,7 @@ rustfmt: $(RUSTDIRS) echo "skipping rustfmt because cargo-fmt is not installed"; \ fi -PHONY += rustclippy +CHECKS += rustclippy rustclippy: $(RUSTDIRS) @if type cargo-clippy > /dev/null 2>&1; then \ set -e ; \ @@ -169,72 +164,49 @@ rustclippy: $(RUSTDIRS) fi 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 - -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} \) | \ + $(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 \ + \( -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 \ + $(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 -PHONY += zstdcheck +CHECKS += zstdcheck zstdcheck: @$(MAKE) -C module check-zstd-symbols 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 \ - ${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 -PHONY += flake8 +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 +PHONY += regen-tests +regen-tests: + @$(MAKE) -C tests/zfs-tests/tests regen + PHONY += ctags ctags: $(RM) tags diff --git a/autogen.sh b/autogen.sh index 488e913b2bf4..c817090183f1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,62 @@ #!/bin/sh +[ "${0%/*}" = "$0" ] || cd "${0%/*}" || exit -autoreconf -fiv || exit 1 -rm -Rf autom4te.cache +# %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 diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 5008c3113eae..cf057539144e 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -1,34 +1,139 @@ -include $(top_srcdir)/config/Shellcheck.am +bin_SCRIPTS = +bin_PROGRAMS = +sbin_SCRIPTS = +sbin_PROGRAMS = +dist_bin_SCRIPTS = +zfsexec_PROGRAMS = +mounthelper_PROGRAMS = -SUBDIRS = zfs zpool zhack zinject zstream -SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path zfs_file -SUBDIRS += zpool_influxdb -CPPCHECKDIRS = zfs zpool zdb zhack zinject zstream ztest -CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb +sbin_SCRIPTS += fsck.zfs +SHELLCHECKSCRIPTS += fsck.zfs +CLEANFILES += fsck.zfs +dist_noinst_DATA += %D%/fsck.zfs.in +$(call SUBST,fsck.zfs,%D%/) -# TODO: #12084: SHELLCHECKDIRS += vdev_id -SHELLCHECKDIRS = fsck_zfs zed zpool zvol_wait -if USING_PYTHON -SUBDIRS += arcstat arc_summary dbufstat -endif +sbin_PROGRAMS += zfs_file +CPPCHECKTARGETS += zfs_file + +zfs_file_SOURCES = \ + %D%/zfs_file.c + +zfs_file_LDADD = \ + lib/libzfs.la \ + lib/libzfs_core.la + + +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 = \ + lib/libzfs.la + + +zhack_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) + +sbin_PROGRAMS += zhack +CPPCHECKTARGETS += zhack + +zhack_SOURCES = \ + %D%/zhack.c + +zhack_LDADD = \ + lib/libzpool.la \ + lib/libzfs_core.la \ + lib/libnvpair.la + + +include $(srcdir)/%D%/raidz_test/Makefile.am +include $(srcdir)/%D%/zfs/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 + if BUILD_LINUX -SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait -CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id -SHELLCHECKDIRS += zed +mounthelper_PROGRAMS += mount.zfs +CPPCHECKTARGETS += mount.zfs + +mount_zfs_SOURCES = \ + %D%/mount_zfs.c + +mount_zfs_LDADD = \ + lib/libzfs.la \ + lib/libzfs_core.la \ + lib/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 endif + +include $(srcdir)/%D%/zdb/Makefile.am + + +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%/libzoa_util/libzoa_util.c \ + %D%/ztest.c + +ztest_DEPENDENCIES = \ + %D%/zfs_object_agent \ + lib/libzpool.la + +ztest_LDADD = \ + lib/libzpool.la \ + lib/libzfs_core.la \ + lib/libnvpair.la + +ztest_LDADD += -lm +ztest_LDFLAGS = -pthread + if BUILD_RUST -SUBDIRS += zfs_object_agent zfs_object_agent/scripts +ztest_LDADD += -lzoa +ztest_LDFLAGS += -L%D%/zfs_object_agent/$(RUSTDIR) +ztest_CFLAGS += -DHAVE_LIBZOA +endif + + +if USING_PYTHON +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%/) +arc_summary: %D%/arc_summary + $(AM_V_at)cp $< $@ endif -# ztest and zdb depend on zfs_object_agent, if present. -SUBDIRS += ztest zdb -PHONY = cppcheck -cppcheck: $(CPPCHECKDIRS) - set -e ; for dir in $(CPPCHECKDIRS) ; do \ - $(MAKE) -C $$dir cppcheck ; \ - done +PHONY += cmd +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/.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 deleted file mode 100644 index f419f07e0eda..000000000000 --- a/cmd/arc_summary/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_SCRIPTS = arc_summary - -CLEANFILES = arc_summary -EXTRA_DIST = arc_summary3 -SCRIPT = arc_summary3 - -arc_summary: $(SCRIPT) - 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/.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 deleted file mode 100644 index d1ba989a0cd8..000000000000 --- a/cmd/arcstat/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include $(top_srcdir)/config/Substfiles.am - -bin_SCRIPTS = arcstat - -SUBSTFILES += $(bin_SCRIPTS) 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/.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 deleted file mode 100644 index e672a01a4227..000000000000 --- a/cmd/dbufstat/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include $(top_srcdir)/config/Substfiles.am - -bin_SCRIPTS = dbufstat - -SUBSTFILES += $(bin_SCRIPTS) diff --git a/cmd/fsck_zfs/fsck.zfs.in b/cmd/fsck.zfs.in similarity index 93% rename from cmd/fsck_zfs/fsck.zfs.in rename to cmd/fsck.zfs.in index 37096902cb94..f0d4d2ec38ca 100755 --- a/cmd/fsck_zfs/fsck.zfs.in +++ b/cmd/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/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 deleted file mode 100644 index ec955c7c7ff9..000000000000 --- a/cmd/fsck_zfs/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -dist_sbin_SCRIPTS = fsck.zfs - -SUBSTFILES += $(dist_sbin_SCRIPTS) - diff --git a/cmd/libzoa_util/libzoa_util.c b/cmd/libzoa_util/libzoa_util.c index 163cd3764a46..8e5714a043c7 100644 --- a/cmd/libzoa_util/libzoa_util.c +++ b/cmd/libzoa_util/libzoa_util.c @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef HAVE_LIBZOA #include #endif @@ -39,6 +40,8 @@ static char zoa_sock_dir[] = "/tmp/zoa.sock.XXXXXX"; static char zoa_log_file[PATH_MAX] = "/tmp/zoa.log"; +int start_zfs_object_agent(char *, void **); + /* * Wait until the specified unix socket starts accepting connections. */ @@ -77,17 +80,20 @@ zoa_socket_init_wait(char *zoa_sock_str) static int zoa_init_wait(char *zoa_sock_dir) { - char zoa_sock[PATH_MAX]; + char *zoa_sock = umem_alloc(PATH_MAX, UMEM_NOFAIL); snprintf(zoa_sock, PATH_MAX, "%s/zfs_root_socket", zoa_sock_dir); if (zoa_socket_init_wait(zoa_sock) != 0) { + umem_free(zoa_sock, PATH_MAX); return (-1); } snprintf(zoa_sock, PATH_MAX, "%s/zfs_public_socket", zoa_sock_dir); if (zoa_socket_init_wait(zoa_sock) != 0) { + umem_free(zoa_sock, PATH_MAX); return (-1); } + umem_free(zoa_sock, PATH_MAX); return (0); } 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/.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 deleted file mode 100644 index 3957602d27ad..000000000000 --- a/cmd/mount_zfs/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -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 - -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 - -mount_zfs_LDADD += $(LTLIBINTL) - -include $(top_srcdir)/config/CppCheck.am 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 983ff25dc92a..6667bdcf4fa8 100644 --- a/cmd/raidz_test/Makefile.am +++ b/cmd/raidz_test/Makefile.am @@ -1,22 +1,16 @@ -include $(top_srcdir)/config/Rules.am +raidz_test_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) +raidz_test_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -# Unconditionally enable ASSERTs -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG - -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)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la + lib/libzpool.la \ + lib/libzfs_core.la raidz_test_LDADD += -lm - -include $(top_srcdir)/config/CppCheck.am diff --git a/cmd/vdev_id/Makefile.am b/cmd/vdev_id/Makefile.am deleted file mode 100644 index 4071c6d5ed6b..000000000000 --- a/cmd/vdev_id/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -include $(top_srcdir)/config/Shellcheck.am - -dist_udev_SCRIPTS = 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 12e752b2c25e..af8fab8c120c 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -1,20 +1,19 @@ -include $(top_srcdir)/config/Rules.am - # Unconditionally enable debugging for zdb -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +zdb_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -sbin_PROGRAMS = zdb +sbin_PROGRAMS += zdb +CPPCHECKTARGETS += zdb zdb_SOURCES = \ - zdb.c \ - zdb_il.c \ - ../libzoa_util/libzoa_util.c \ - zdb.h + %D%/zdb.c \ + %D%/zdb_il.c \ + %D%/../libzoa_util/libzoa_util.c \ + %D%/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 + lib/libzpool.la \ + lib/libzfs_core.la \ + lib/libnvpair.la if BUILD_RUST zdb_LDADD += -lzoa @@ -22,4 +21,4 @@ zdb_LDFLAGS = -L$(abs_top_builddir)/cmd/zfs_object_agent/$(RUSTDIR) zdb_CFLAGS = -DHAVE_LIBZOA endif -include $(top_srcdir)/config/CppCheck.am +# include $(top_srcdir)/config/CppCheck.am diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 1bbd2aa6eba8..87903ec82aba 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -3219,13 +3219,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); @@ -7442,7 +7447,7 @@ verify_checkpoint(spa_t *spa) if (err != 0) { (void) printf("\nAgent checkpoint detected, " "uberblock not found for txg %llu: %s\n", - checkpoint_txg, strerror(err)); + (u_longlong_t)checkpoint_txg, strerror(err)); return (err); } (void) printf("\nAgent checkpoint uberblock found:\n"); @@ -8581,7 +8586,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; @@ -8601,9 +8605,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/zed/Makefile.am b/cmd/zed/Makefile.am index 7b662994d1c6..b4a58ccb32f5 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -1,53 +1,46 @@ -include $(top_srcdir)/config/Rules.am -include $(top_srcdir)/config/Shellcheck.am - -AM_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 - -zed_SOURCES = $(ZED_SRC) $(FMA_SRC) +include $(srcdir)/%D%/zed.d/Makefile.am + +zed_CFLAGS = $(AM_CFLAGS) +zed_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS) + +sbin_PROGRAMS += zed +CPPCHECKTARGETS += zed + +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)/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 + lib/libzfs.la \ + lib/libzfs_core.la \ + lib/libnvpair.la \ + lib/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 +dist_noinst_DATA += %D%/agents/README.md 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"); 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.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 3efcfb3629cf..c65b43fb027e 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 + +dist_noinst_DATA += %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/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@" 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) { } 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 1ead457f0f29..8ff98eb9a484 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -1,25 +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)/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 + lib/libzfs.la \ + lib/libzfs_core.la \ + lib/libnvpair.la \ + lib/libuutil.la zfs_LDADD += $(LTLIBINTL) if BUILD_FREEBSD zfs_LDADD += -lgeom -ljail endif - -include $(top_srcdir)/config/CppCheck.am diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index a103f6b09a22..319140f3c264 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -765,12 +765,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); @@ -6659,7 +6659,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 */ @@ -6670,7 +6670,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]; @@ -6788,7 +6788,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); } } @@ -6846,10 +6846,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 && @@ -6869,23 +6870,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: @@ -6983,6 +6972,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) { @@ -7041,17 +7046,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++; } @@ -7088,7 +7086,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; @@ -7140,9 +7138,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); } } @@ -7152,7 +7150,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. @@ -7261,12 +7259,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]; @@ -7356,16 +7354,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++; } @@ -7472,7 +7466,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; @@ -7545,12 +7539,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; @@ -8584,11 +8578,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/zfs_file/zfs_file.c b/cmd/zfs_file.c similarity index 100% rename from cmd/zfs_file/zfs_file.c rename to cmd/zfs_file.c diff --git a/cmd/zfs_file/.gitignore b/cmd/zfs_file/.gitignore deleted file mode 100644 index add9d7ad2f2e..000000000000 --- a/cmd/zfs_file/.gitignore +++ /dev/null @@ -1 +0,0 @@ -zfs_file diff --git a/cmd/zfs_file/Makefile.am b/cmd/zfs_file/Makefile.am deleted file mode 100644 index bcb26e0f3c53..000000000000 --- a/cmd/zfs_file/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zfs_file - -zfs_file_SOURCES = \ - zfs_file.c - -zfs_file_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la 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/.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 deleted file mode 100644 index 549426764026..000000000000 --- a/cmd/zfs_ids_to_path/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zfs_ids_to_path - -zfs_ids_to_path_SOURCES = \ - zfs_ids_to_path.c - -zfs_ids_to_path_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la - -include $(top_srcdir)/config/CppCheck.am 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/Makefile.am b/cmd/zfs_object_agent/Makefile.am index 9418dbf0fb6a..7c7c49f233c8 100644 --- a/cmd/zfs_object_agent/Makefile.am +++ b/cmd/zfs_object_agent/Makefile.am @@ -12,38 +12,32 @@ __RUSTDIR__zoa_test_SOURCES = $(shell ./parse_deps.sh $(RUSTDIR)/zoa_test.d) __RUSTDIR__libzoa_so_SOURCES = $(shell ./parse_deps.sh $(RUSTDIR)/libzoa.d) -EXTRA_DIST = $(__RUSTDIR__libzoa_so_SOURCES) parse_deps.sh +dist_noinst_DATA = $(__RUSTDIR__libzoa_so_SOURCES) parse_deps.sh RUSTFLAGS = \ - -L $(abs_top_builddir)/lib/libzfs/.libs \ - -L $(abs_top_builddir)/lib/libnvpair/.libs + -L $(abs_top_builddir)/lib/.libs GITREV = $(shell cat $(abs_top_builddir)/include/zfs_gitrev.h | awk '{print $$3}') -.PHONY: \ - build - -$(RUSTDIR)/libzoa.so : $(__RUSTDIR__libzoa_so_SOURCES) +$(RUSTDIR)/libzoa.so: $(__RUSTDIR__libzoa_so_SOURCES) CARGO_ZOA_GITREV="$(GITREV)" RUSTFLAGS="$(RUSTFLAGS)" cargo build --package zoa $(RUSTTARGET) -$(RUSTDIR)/zfs_object_agent$(EXEEXT) : $(__RUSTDIR__zfs_object_agent_SOURCES) +$(RUSTDIR)/zfs_object_agent$(EXEEXT): $(__RUSTDIR__zfs_object_agent_SOURCES) CARGO_ZOA_GITREV="$(GITREV)" RUSTFLAGS="$(RUSTFLAGS)" cargo build --package zfs_object_agent $(RUSTTARGET) -$(RUSTDIR)/zfs_object_perf$(EXEEXT) : $(__RUSTDIR__zfs_object_perf_SOURCES) +$(RUSTDIR)/zfs_object_perf$(EXEEXT): $(__RUSTDIR__zfs_object_perf_SOURCES) CARGO_ZOA_GITREV="$(GITREV)" RUSTFLAGS="$(RUSTFLAGS)" cargo build --package zfs_object_perf $(RUSTTARGET) -$(RUSTDIR)/zoa_test$(EXEEXT) : $(__RUSTDIR__zoa_test_SOURCES) +$(RUSTDIR)/zoa_test$(EXEEXT): $(__RUSTDIR__zoa_test_SOURCES) CARGO_ZOA_GITREV="$(GITREV)" RUSTFLAGS="$(RUSTFLAGS)" cargo build --package zoa_test $(RUSTTARGET) -$(RUSTDIR)/zcachedb$(EXEEXT) : $(__RUSTDIR__zcachedb_SOURCES) +$(RUSTDIR)/zcachedb$(EXEEXT): $(__RUSTDIR__zcachedb_SOURCES) CARGO_ZOA_GITREV="$(GITREV)" RUSTFLAGS="$(RUSTFLAGS)" cargo build --package zcachedb $(RUSTTARGET) -$(RUSTDIR)/zcache$(EXEEXT) : $(__RUSTDIR__zcache_SOURCES) +$(RUSTDIR)/zcache$(EXEEXT): $(__RUSTDIR__zcache_SOURCES) CARGO_ZOA_GITREV="$(GITREV)" RUSTFLAGS="$(RUSTFLAGS)" cargo build --package zcache $(RUSTTARGET) -all: build - -build: \ +all: \ $(RUSTDIR)/libzoa.so \ $(RUSTDIR)/zcache$(EXEEXT) \ $(RUSTDIR)/zcachedb$(EXEEXT) \ @@ -51,5 +45,5 @@ build: \ $(RUSTDIR)/zfs_object_perf$(EXEEXT) \ $(RUSTDIR)/zoa_test$(EXEEXT) -install-exec-hook : +install-exec-hook: cp $(RUSTDIR)/libzoa.so $(DESTDIR)$(libdir)/libzoa.so 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/scripts/start_zoa b/cmd/zfs_object_agent/scripts/start_zoa index 5a64d256bb71..ce906c2a937f 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 @@ -49,4 +70,4 @@ if [[ ! -z $ZETTACACHE_DEVICES ]]; then done fi -/sbin/zfs_object_agent ${PARAMS} +exec /sbin/zfs_object_agent ${PARAMS} 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/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/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/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), ) }); 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/checkpoint.rs b/cmd/zfs_object_agent/zettacache/src/checkpoint.rs index 2634c8c5a51a..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; @@ -23,7 +24,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)] @@ -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/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 9ada49a018ee..c6ab7cb87237 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; @@ -15,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; @@ -22,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 { @@ -56,6 +59,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 @@ -66,15 +75,23 @@ 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(); let mut dir = fs::read_dir(dir_path).await?; while let Some(entry) = dir.next_entry().await? { - if entry.metadata().await?.is_dir() { - continue; + match entry.metadata().await { + Ok(meta) => { + 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 @@ -83,44 +100,49 @@ 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) => { 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 { @@ -139,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/merge.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs new file mode 100644 index 000000000000..e482ad0120ec --- /dev/null +++ b/cmd/zfs_object_agent/zettacache/src/zettacache/merge.rs @@ -0,0 +1,616 @@ +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) = measure!("new_progress() next_index.flush()") + .fut_timed(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 { + 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, + 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_len} entries and {frees_len} frees to next_index_task after {}ms", + 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..28650812b747 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; @@ -47,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; @@ -67,6 +65,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 +118,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 +129,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 +149,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 +204,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 @@ -809,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, @@ -888,6 +290,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 { @@ -1033,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()); @@ -1067,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) @@ -1136,8 +553,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; @@ -1190,7 +606,7 @@ impl Inner { } info!( - "opening ZettaCache {} with {} disks", + "opening ZettaCache {:?} with {} disks", guid, primary.disks.len() ); @@ -1405,7 +821,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(); } }); @@ -1467,7 +883,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; @@ -1517,7 +933,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 @@ -1579,7 +995,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; @@ -1638,7 +1054,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", @@ -1651,7 +1070,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(); @@ -1664,7 +1083,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 @@ -1769,7 +1188,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 { @@ -1851,7 +1270,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. @@ -1868,7 +1287,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) } }; @@ -1930,11 +1349,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); @@ -2069,20 +1487,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; } @@ -2105,11 +1523,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 { @@ -2128,20 +1546,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 +1812,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 +1864,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 +1883,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 +1901,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 +2015,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 +2031,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 +2047,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 +2067,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 +2077,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 +2088,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 +2117,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) + } +} diff --git a/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs b/cmd/zfs_object_agent/zettacache/src/zettacache/zcdb.rs index 90ee08b03f49..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, } @@ -54,7 +55,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, @@ -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 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; + } } }) } 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/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/.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 deleted file mode 100644 index 4526a90a1d51..000000000000 --- a/cmd/zgenhostid/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zgenhostid - -zgenhostid_SOURCES = zgenhostid.c - -include $(top_srcdir)/config/CppCheck.am 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/.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 deleted file mode 100644 index 23f03ffd8243..000000000000 --- a/cmd/zhack/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -# Unconditionally enable debugging for zhack -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG - -sbin_PROGRAMS = zhack - -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 - -include $(top_srcdir)/config/CppCheck.am 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 40f382c66191..eb14fae4e7d9 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -1,15 +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)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am + lib/libzfs.la \ + lib/libzfs_core.la \ + lib/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 7ea7c5fc3f3e..b3a505782d23 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% -DEFAULT_INCLUDES += -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)/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 + lib/libzfs.la \ + lib/libzfs_core.la \ + lib/libnvpair.la \ + lib/libuutil.la \ + lib/libzutil.la zpool_LDADD += $(LTLIBINTL) @@ -37,56 +38,53 @@ zpool_LDADD += -lgeom endif zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS) -include $(top_srcdir)/config/CppCheck.am +dist_noinst_DATA += %D%/zpool.d/README -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 \ @@ -133,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" @@ -178,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/zpool_main.c b/cmd/zpool/zpool_main.c index fb6da0106df5..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) { @@ -1839,8 +1847,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); } @@ -2036,40 +2044,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); } @@ -11321,11 +11310,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/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 { 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 a59217570b9d..e9e9610f2b9a 100644 --- a/cmd/zpool_influxdb/Makefile.am +++ b/cmd/zpool_influxdb/Makefile.am @@ -1,13 +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)/lib/libspl/libspl.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs/libzfs.la - -include $(top_srcdir)/config/CppCheck.am + lib/libspl.la \ + lib/libnvpair.la \ + lib/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 8e813027fa3d..1ac5389b3b84 100644 --- a/cmd/zstream/Makefile.am +++ b/cmd/zstream/Makefile.am @@ -1,20 +1,17 @@ -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)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am + lib/libzfs.la \ + lib/libzfs_core.la \ + lib/libnvpair.la install-exec-hook: cd $(DESTDIR)$(sbindir) && $(LN_S) -f zstream zstreamdump diff --git a/cmd/ztest/ztest.c b/cmd/ztest.c similarity index 98% rename from cmd/ztest/ztest.c rename to cmd/ztest.c index 2522c6436d51..b8d2c72aa81f 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest.c @@ -535,7 +535,6 @@ typedef struct ztest_shared { static char ztest_dev_template[] = "%s/%s.%llua"; static char ztest_aux_template[] = "%s/%s.%s.%llu"; -static char ztest_zcache_template[] = "%s/zcache.%d"; ztest_shared_t *ztest_shared; static spa_t *ztest_spa = NULL; @@ -970,8 +969,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)); @@ -1019,7 +1017,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); @@ -1114,7 +1112,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); @@ -1157,8 +1156,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 && zo->zo_obj_store == 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); @@ -1208,51 +1206,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); } } @@ -1263,14 +1238,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 @@ -6773,22 +6748,22 @@ 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; } 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; } @@ -7035,7 +7010,7 @@ ztest_run_zdb(char *pool, uint64_t guid) free(loc); if (ztest_opts.zo_verbose >= 5) - (void) printf("Executing %s\n", strstr(zdb, "zdb ")); + (void) printf("Executing %s\n", zdb); fp = popen(zdb, "r"); @@ -8082,21 +8057,24 @@ 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); + 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); } @@ -8164,27 +8142,6 @@ ztest_run_init(void) } } -static char * -zoa_get_zettacache(ztest_shared_opts_t *ztest_opts) -{ - if (!ztest_opts->zo_use_zettacache) { - return (NULL); - } - - char *path = umem_alloc(MAXPATHLEN, UMEM_NOFAIL); - (void) snprintf(path, MAXPATHLEN, - ztest_zcache_template, ztest_opts->zo_dir, getpid()); - - int fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0666); - if (fd == -1) - fatal(1, "can't open %s", path); - if (ftruncate(fd, ztest_opts->zo_vdev_size) != 0) - fatal(1, "can't ftruncate %s", path); - (void) close(fd); - - return (path); -} - int main(int argc, char **argv) { @@ -8248,7 +8205,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) { 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 deleted file mode 100644 index ea934d37241b..000000000000 --- a/cmd/ztest/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -# 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 - -sbin_PROGRAMS = ztest - -ztest_SOURCES = \ - ztest.c \ - ../libzoa_util/libzoa_util.c - -ztest_DEPENDENCIES = $(abs_top_builddir)/cmd/zfs_object_agent - -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 - -ztest_LDADD += -lm -ztest_LDFLAGS = -pthread - -if BUILD_RUST -ztest_LDADD += -lzoa -ztest_LDFLAGS += -L$(abs_top_builddir)/cmd/zfs_object_agent/$(RUSTDIR) -ztest_CFLAGS = -DHAVE_LIBZOA -endif - -include $(top_srcdir)/config/CppCheck.am 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 deleted file mode 100644 index bb7e31a0590f..000000000000 --- a/cmd/zvol_id/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -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 = \ - zvol_id_main.c - -include $(top_srcdir)/config/CppCheck.am diff --git a/cmd/zvol_id/zvol_id_main.c b/cmd/zvol_id/zvol_id_main.c deleted file mode 100644 index 929a1a6e794d..000000000000 --- a/cmd/zvol_id/zvol_id_main.c +++ /dev/null @@ -1,129 +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 (c) 2011, Fajar A. Nugraha. All rights reserved. - * Use is subject to license terms. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(ZFS_ASAN_ENABLED) -/* - * zvol_id is invoked by udev with the help of ptrace() - * making sanitized binary with leak detection croak - * because of tracing mechanisms collision - */ -extern const char *__asan_default_options(void); - -const char *__asan_default_options(void) { - return ("abort_on_error=true:halt_on_error=true:" - "allocator_may_return_null=true:disable_coredump=false:" - "detect_stack_use_after_return=true:detect_leaks=false"); -} -#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) -{ - 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; - } - - 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; - } - - ret = ioctl_get_msg(zvol_name, fd); - if (ret < 0) { - fprintf(stderr, "ioctl_get_msg failed: %s\n", strerror(errno)); - goto fail; - } - 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] = '+'; - } - - printf("%s\n", zvol_name_part); - status = EXIT_SUCCESS; - -fail: - if (zvol_name_part) - free(zvol_name_part); - if (fd >= 0) - close(fd); - - return (status); -} 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 e8b546a60659..000000000000 --- a/cmd/zvol_wait/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -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..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 @@ -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 cppcheck-recursive-,,$@) cppcheck + +_CTGT = $(subst cppcheck-for-,,$@) +cppcheck-for-%: + @[ -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/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/Shellcheck.am b/config/Shellcheck.am index fb0bdedd3be3..878919575321 100644 --- a/config/Shellcheck.am +++ b/config/Shellcheck.am @@ -1,30 +1,40 @@ -.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 + +_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)) +PHONY += checkbashisms + # 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)) diff --git a/config/Substfiles.am b/config/Substfiles.am index b051438fb9e3..38e870b2f501 100644 --- a/config/Substfiles.am +++ b/config/Substfiles.am @@ -1,38 +1,46 @@ 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|@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' - -SUBSTFILES = -CLEANFILES = $(SUBSTFILES) -EXTRA_DIST = $(SUBSTFILES:=.in) + -e 's|@PYTHON[@]|$(PYTHON)|g' \ + -e 's|@PYTHON_SHEBANG[@]|$(PYTHON_SHEBANG)|g' \ + -e 's|@UBSAN_ENABLED[@]|$(UBSAN_ENABLED)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' -$(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) +dist_noinst_DATA += $(SUBSTFILES:=.in) + +$(call SUBST,%,) 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/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/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-blk-queue.m4 b/config/kernel-blk-queue.m4 index 559ae9800e8f..6f42b98125cd 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,69 +88,111 @@ 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 ],[ - 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); ]) ]) 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]) + ]) ]) ]) 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 ],[ - 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); ]) ]) 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/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/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/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/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/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) 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-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/config/kernel-vfs-read_folio.m4 b/config/kernel-vfs-read_folio.m4 new file mode 100644 index 000000000000..9ca0faff218d --- /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([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]) + ],[ + AC_MSG_RESULT([no]) + ]) +]) 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 a70db91a8364..9530367507d6 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -102,10 +102,13 @@ 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 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 @@ -136,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 @@ -219,10 +220,13 @@ 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 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 @@ -253,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 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/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) ]) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 8677b8ba8784..e9d1fa24351a 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -266,11 +266,16 @@ 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 ;; all) ZFS_AC_CONFIG_USER ZFS_AC_CONFIG_KERNEL ;; + dist) ;; srpm) ;; *) AC_MSG_RESULT([Error!]) @@ -278,6 +283,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], @@ -332,6 +341,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 diff --git a/configure.ac b/configure.ac index 30a62966f808..d643532df54c 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 @@ -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,11 +39,11 @@ 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]) +# 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 -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 @@ -66,319 +66,22 @@ 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_file/Makefile - cmd/zfs_ids_to_path/Makefile cmd/zfs_object_agent/Makefile cmd/zfs_object_agent/scripts/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 - 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 - 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 - 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/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/libspl/include/util/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 + lib/libzfsbootenv/libzfsbootenv.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 - scripts/Makefile - tests/Makefile - tests/runfiles/Makefile - 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 - tests/zfs-tests/cmd/getholes/Makefile - tests/zfs-tests/cmd/mkholes/Makefile - tests/zfs-tests/include/Makefile 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/background_freeing/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/hkdf/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/zcache_slog_sharing/Makefile - tests/zfs-tests/tests/functional/zoa/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 - tests/zfs-tests/tests/stress/Makefile - udev/Makefile - udev/rules.d/Makefile zfs.release ]) 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 eee617802bbe..dc4b610c42b8 100644 --- a/contrib/bash_completion.d/Makefile.am +++ b/contrib/bash_completion.d/Makefile.am @@ -1,12 +1,7 @@ -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) +nodist_bashcompletion_DATA = %D%/zfs +SUBSTFILES += $(nodist_bashcompletion_DATA) -SHELLCHECKSCRIPTS = $(noinst_DATA) -SHELLCHECK_SHELL = bash +SHELLCHECKSCRIPTS += $(nodist_bashcompletion_DATA) +$(call SHELLCHECK_OPTS,$(nodist_bashcompletion_DATA)): SHELLCHECK_SHELL = bash diff --git a/contrib/bpftrace/Makefile.am b/contrib/bpftrace/Makefile.am index 05e4f1c507ce..4f649cf5433e 100644 --- a/contrib/bpftrace/Makefile.am +++ b/contrib/bpftrace/Makefile.am @@ -1,7 +1,3 @@ -include $(top_srcdir)/config/Shellcheck.am +dist_noinst_DATA += %D%/taskqlatency.bt %D%/zfs-trace.sh -EXTRA_DIST = \ - taskqlatency.bt \ - 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 b1bbb6bd3aac..000000000000 --- a/contrib/dracut/02zfsexpandknowledge/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -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) diff --git a/contrib/dracut/90zfs/Makefile.am b/contrib/dracut/90zfs/Makefile.am deleted file mode 100644 index 3f7050300994..000000000000 --- a/contrib/dracut/90zfs/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -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.' diff --git a/contrib/dracut/Makefile.am b/contrib/dracut/Makefile.am index 09805277ffb0..73ca52b66316 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.' + +dist_noinst_DATA += %D%/README.md diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am index 57e8f5c3a485..a583341ea2b1 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 + + +dist_noinst_DATA += %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 0cd1aafcd359..000000000000 --- a/contrib/initramfs/hooks/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -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) diff --git a/contrib/initramfs/scripts/Makefile.am b/contrib/initramfs/scripts/Makefile.am deleted file mode 100644 index 444a5f374bfe..000000000000 --- a/contrib/initramfs/scripts/Makefile.am +++ /dev/null @@ -1,11 +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 diff --git a/contrib/initramfs/scripts/local-top/Makefile.am b/contrib/initramfs/scripts/local-top/Makefile.am deleted file mode 100644 index f3dc23129f09..000000000000 --- a/contrib/initramfs/scripts/local-top/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include $(top_srcdir)/config/Shellcheck.am - -localtopdir = /usr/share/initramfs-tools/scripts/local-top - -dist_localtop_SCRIPTS = \ - zfs - diff --git a/contrib/pam_zfs_key/Makefile.am b/contrib/pam_zfs_key/Makefile.am index f0f2550afccb..7cc4b78b4f72 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 = \ + lib/libnvpair.la \ + lib/libuutil.la \ + lib/libzfs.la \ + lib/libzfs_core.la -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 +%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..06d9a09d7f1e 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 +dist_noinst_DATA += %D%/libzfs_core %D%/README %D%/LICENSE %D%/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,14 @@ 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/ - -clean-local: + cd %D% && $(PYTHON) setup.py egg_info -e . install \ + --prefix $(prefix) \ + --root $(DESTDIR)/ \ + --install-lib $(pythonsitedir) \ + --single-version-externally-managed \ + --verbose -check-local: all +CLEAN_LOCAL += pyzfs-clean-local +pyzfs-clean-local: + -$(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..fc3f01a233cb 100644 --- a/contrib/zcp/Makefile.am +++ b/contrib/zcp/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = autosnap.lua +dist_noinst_DATA += %D%/autosnap.lua 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 diff --git a/debian/rules b/debian/rules index 45109e3ae767..09f5811c5a0a 100755 --- a/debian/rules +++ b/debian/rules @@ -82,8 +82,9 @@ override_dh_auto_install: @# * Takes care of spaces and tabs awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \ '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' - @# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs. - sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \ + @# Set "SUBDIRS = module include" for CONFIG_KERNEL. + @# Remove SUBDIRS and any included Makefile.am files for all other configs. + sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/include.*Makefile.am//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \ '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' @# Sanity test grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' diff --git a/debian/zfsutils-linux.install b/debian/zfsutils-linux.install index 49d96a5b99cd..4b05332186a9 100644 --- a/debian/zfsutils-linux.install +++ b/debian/zfsutils-linux.install @@ -17,6 +17,7 @@ lib/systemd/system-preset/ usr/lib/systemd/system-generators/zfs-mount-generator usr/lib/modules-load.d/ lib/ lib/udev/ +debian/tmp/etc/bash_completion.d/zfs etc/bash_completion.d/ debian/tmp/etc/default/zfs etc/default/ debian/tmp/etc/zfs/zfs-functions etc/zfs/ etc/zfs/zpool.d/ diff --git a/etc/Makefile.am b/etc/Makefile.am index 179c2400978c..f1ee64a16cec 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -1,9 +1,100 @@ -include $(top_srcdir)/config/Shellcheck.am +sudoersddir = $(sysconfdir)/sudoers.d +sudoersd_DATA = \ + %D%/sudoers.d/zfs + +dist_noinst_DATA += $(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 \ + %D%/zfs/zoa.conf \ + %D%/zfs/zoa_config.toml \ + %D%/zfs/zoa_log4rs.yml + +sysconf_zfs_DATA = \ + %D%/zfs/zfs-functions + +SUBSTFILES += $(sysconf_zfs_DATA) +SHELLCHECKSCRIPTS += $(sysconf_zfs_DATA) +$(call SHELLCHECK_OPTS,$(sysconf_zfs_DATA)): 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_DATA = \ + %D%/default/zfs + +SUBSTFILES += $(initconf_DATA) +SHELLCHECKSCRIPTS += $(initconf_DATA) +$(call SHELLCHECK_OPTS,$(initconf_DATA)): SHELLCHECK_SHELL = sh + + +if INIT_SYSV +dist_noinst_DATA += %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-object-agent.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 \ + %D%/systemd/system/zoa-chaos-monkey.service + +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 = \ + lib/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 0f7c96698d45..000000000000 --- a/etc/default/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -initconf_SCRIPTS = zfs - -SUBSTFILES += $(initconf_SCRIPTS) - -SHELLCHECK_SHELL = sh diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am deleted file mode 100644 index 625d0b91fd11..000000000000 --- a/etc/init.d/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -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 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 66232a5ff197..000000000000 --- a/etc/systemd/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index e5920bf39203..000000000000 --- a/etc/systemd/system-generators/Makefile.am +++ /dev/null @@ -1,14 +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)/lib/libzfs/libzfs.la - -zfs_mount_generator_LDFLAGS = -pthread - -include $(top_srcdir)/config/CppCheck.am 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 8fe1b2025118..000000000000 --- a/etc/systemd/system/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -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-object-agent.service \ - zoa-chaos-monkey.service \ - 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 1626d765b305..000000000000 --- a/etc/zfs/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -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 \ - zoa.conf \ - zoa_config.toml \ - zoa_log4rs.yml - -pkgsysconf_SCRIPTS = \ - zfs-functions - -SUBSTFILES += $(pkgsysconf_SCRIPTS) - -SHELLCHECK_SHELL = sh 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= diff --git a/include/Makefile.am b/include/Makefile.am index 89806c47ae65..d165b5e5e134 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,29 +13,191 @@ 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/sock.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_object_store.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 \ libzoa_util.h \ object_agent.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/libzfs.h b/include/libzfs.h index 8e5c514ad2ce..28306acb2482 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -35,14 +35,13 @@ #define _LIBZFS_H extern __attribute__((visibility("default"))) #include +#include #include #include #include #include -#include #include #include -#include #include #ifdef __cplusplus @@ -880,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 @@ -929,8 +916,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/include/libzutil.h b/include/libzutil.h index 68122d0d5622..23c0c560c40e 100644 --- a/include/libzutil.h +++ b/include/libzutil.h @@ -107,8 +107,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/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/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/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/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index 9fa8884bb7a1..fd91560a3cc4 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -495,21 +495,45 @@ blk_queue_discard_granularity(struct request_queue *q, unsigned int 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 +} + +/* + * 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 } @@ -527,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)); @@ -550,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); 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 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/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/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 6650f0692642..000000000000 --- a/include/sys/Makefile.am +++ /dev/null @@ -1,153 +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 \ - sock.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_object_store.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/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_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/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/include/sys/dnode.h b/include/sys/dnode.h index 9b0345ea118d..eb8863223f67 100644 --- a/include/sys/dnode.h +++ b/include/sys/dnode.h @@ -618,7 +618,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 diff --git a/include/sys/dsl_pool.h b/include/sys/dsl_pool.h index c2fb5622a949..82368a86291e 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/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/fs/zfs.h b/include/sys/fs/zfs.h index 368e7621655a..359a9065c0aa 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -1314,6 +1314,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/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/spa.h b/include/sys/spa.h index 84cff7c22327..5809568ab16d 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -901,6 +901,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/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/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. 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/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/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 diff --git a/include/sys/zstd/zstd.h b/include/sys/zstd/zstd.h index ca32a7464556..d8c3fa86dce3 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/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/Makefile.am b/lib/Makefile.am index f07975cc03fc..60434d43fbe3 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -33,50 +33,94 @@ # | | | # \-------- 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. +# +include $(top_srcdir)/config/Rules.am +noinst_LTLIBRARIES = +lib_LTLIBRARIES = +pkgconfig_DATA = +dist_noinst_DATA = +CPPCHECKTARGETS = +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..c70e5cbeac73 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..a1d271c890a3 100644 --- a/lib/libicp/Makefile.am +++ b/lib/libicp/Makefile.am @@ -1,69 +1,50 @@ -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 -# 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..1249933de0b3 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 +libnvpair_la-libnvpair_json.$(OBJEXT) : CFLAGS += -Wno-type-limits +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 +dist_noinst_DATA += %D%/libnvpair.abi %D%/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/libshare/libshare.c b/lib/libshare/libshare.c index 7bc31d7a6823..09529e5b4106 100644 --- a/lib/libshare/libshare.c +++ b/lib/libshare/libshare.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -37,139 +38,70 @@ #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) -{ - 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; +#define init_share(zfsname, path, shareopts) \ + { \ + .sa_zfsname = zfsname, \ + .sa_mountpoint = path, \ + .sa_shareopts = shareopts, \ + } - fstypes_count++; +#define VALIDATE_PROTOCOL(proto, ...) \ + if ((proto) < 0 || (proto) >= SA_PROTOCOL_COUNT) \ + return __VA_ARGS__ - fstype->next = fstypes; - fstypes = fstype; +const char *const sa_protocol_names[SA_PROTOCOL_COUNT] = { + [SA_PROTOCOL_NFS] = "nfs", + [SA_PROTOCOL_SMB] = "smb", +}; - return (fstype); -} - -__attribute__((constructor)) static void -libshare_init(void) -{ - libshare_nfs_init(); - libshare_smb_init(); -} +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, char *protocol) + const char *shareopts, enum sa_protocol 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; - - rc = fstype->ops->enable_share(impl_share); - if (rc != SA_OK) - ret = rc; + VALIDATE_PROTOCOL(protocol, SA_INVALID_PROTOCOL); - 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 (fstypes[protocol]->enable_share(&args)); } int -sa_disable_share(const char *mountpoint, char *protocol) +sa_disable_share(const char *mountpoint, enum sa_protocol 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); + VALIDATE_PROTOCOL(protocol, SA_INVALID_PROTOCOL); - fstype = fstypes; - while (fstype != NULL) { - if (strcmp(fstype->name, protocol) == 0) { - - 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 (fstypes[protocol]->disable_share(&args)); } boolean_t -sa_is_shared(const char *mountpoint, char *protocol) +sa_is_shared(const char *mountpoint, enum sa_protocol 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) - return (B_FALSE); + VALIDATE_PROTOCOL(protocol, 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 (fstypes[protocol]->is_shared(&args)); } void -sa_commit_shares(const char *protocol) +sa_commit_shares(enum sa_protocol protocol) { - sa_fstype_t *fstype = fstypes; - while (fstype != NULL) { - if (strcmp(fstype->name, protocol) == 0) - fstype->ops->commit_shares(); - fstype = fstype->next; - } + /* CSTYLED */ + VALIDATE_PROTOCOL(protocol, ); + + fstypes[protocol]->commit_shares(); +} + +int +sa_validate_shareopts(const char *options, enum sa_protocol protocol) +{ + VALIDATE_PROTOCOL(protocol, SA_INVALID_PROTOCOL); + + return (fstypes[protocol]->validate_shareopts(options)); } /* @@ -177,189 +109,85 @@ 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]; - 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(char *options, 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_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; - } - - free(impl_share->sa_mountpoint); - free(impl_share->sa_zfsname); - free(impl_share->sa_fsinfo); - free(impl_share); } diff --git a/lib/libshare/libshare_impl.h b/lib/libshare/libshare_impl.h index 63a6907539e0..110fe93d250f 100644 --- a/lib/libshare/libshare_impl.h +++ b/lib/libshare/libshare_impl.h @@ -27,39 +27,20 @@ #ifndef _LIBSPL_LIBSHARE_IMPL_H #define _LIBSPL_LIBSHARE_IMPL_H -typedef struct sa_share_fsinfo { - char *shareopts; -} sa_share_fsinfo_t; - -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 sa_fstype { - struct sa_fstype *next; - - const char *name; - const sa_share_ops_t *ops; - int fsinfo_index; +typedef struct { + 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); } sa_fstype_t; -sa_fstype_t *register_fstype(const char *name, const sa_share_ops_t *ops); +extern const sa_fstype_t libshare_nfs_type, libshare_smb_type; #endif /* _LIBSPL_LIBSHARE_IMPL_H */ diff --git a/lib/libshare/nfs.c b/lib/libshare/nfs.c index 2a901bcec503..2146346cf08c 100644 --- a/lib/libshare/nfs.c +++ b/lib/libshare/nfs.c @@ -24,39 +24,37 @@ #include #include #include +#include #include #include #include #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 +62,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 { @@ -147,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), @@ -157,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] == '#') @@ -167,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); @@ -216,13 +251,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 +272,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); } diff --git a/lib/libshare/nfs.h b/lib/libshare/nfs.h index cfac274c3d26..24ae1f8adb85 100644 --- a/lib/libshare/nfs.h +++ b/lib/libshare/nfs.h @@ -28,8 +28,7 @@ #define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n" -void libshare_nfs_init(void); - +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 ea02dc1bae3c..78977a25f4f5 100644 --- a/lib/libshare/os/freebsd/nfs.c +++ b/lib/libshare/os/freebsd/nfs.c @@ -52,10 +52,8 @@ __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 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 +70,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 *known_opts[] = { "ro", "maproot", "mapall", "mask", - "network", "sec", "alldirs", "public", "webnfs", "index", "quiet", - NULL }; - static char newopts[OPTSSIZE]; - char oldopts[OPTSSIZE]; + static const char *const known_opts[] = { "ro", "maproot", "mapall", + "mask", "network", "sec", "alldirs", "public", "webnfs", "index", + "quiet" }; + char oldopts[OPTSSIZE], newopts[OPTSSIZE]; char *o, *s = NULL; unsigned int i; size_t len; @@ -93,7 +88,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] == '=')) { @@ -104,23 +99,34 @@ translate_opts(const char *shareopts) strlcat(newopts, o, sizeof (newopts)); strlcat(newopts, " ", sizeof (newopts)); } - return (newopts); + return (fputs(newopts, 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 = ""; - if (fprintf(tmpfile, "%s\t%s\n", impl_share->sa_mountpoint, - translate_opts(shareopts)) < 0) { + 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 @@ -159,19 +165,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. */ @@ -202,22 +195,11 @@ nfs_commit_shares(void) return (SA_OK); } -static const sa_share_ops_t nfs_shareops = { +const sa_fstype_t libshare_nfs_type = { .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 445784b756bc..0f546dc5543e 100644 --- a/lib/libshare/os/freebsd/smb.c +++ b/lib/libshare/os/freebsd/smb.c @@ -23,22 +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; /* * Enables SMB sharing for the specified share. @@ -47,7 +34,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 +44,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 +55,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); } @@ -82,51 +69,18 @@ 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 = { +const sa_fstype_t libshare_smb_type = { .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 5acfa3fb8545..1da6d1617247 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -45,7 +45,8 @@ #define ZFS_EXPORTS_FILE ZFS_EXPORTS_DIR"/zfs.exports" #define ZFS_EXPORTS_LOCK ZFS_EXPORTS_FILE".lock" -static sa_fstype_t *nfs_fstype; + +static boolean_t nfs_available(void); typedef int (*nfs_shareopt_callback_t)(const char *opt, const char *value, void *cookie); @@ -229,7 +230,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 +237,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)); } /* @@ -299,6 +297,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. @@ -306,6 +309,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 */ @@ -324,26 +336,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); @@ -395,14 +390,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); } /* @@ -411,11 +413,8 @@ 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; - int error; - - shareopts = FSINFO(impl_share, nfs_fstype)->shareopts; - error = get_linux_shareopts(shareopts, &linux_opts); + char *linux_opts = NULL; + int error = get_linux_shareopts(impl_share->sa_shareopts, &linux_opts); if (error != SA_OK) return (error); @@ -428,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)); @@ -446,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)); @@ -454,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)); } @@ -463,11 +471,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); @@ -475,51 +480,41 @@ 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) { + if (!nfs_available()) + return (SA_SYSTEM_ERR); + char *argv[] = { - "/usr/sbin/exportfs", - "-ra", + (char *)"/usr/sbin/exportfs", + (char *)"-ra", NULL }; return (libzfs_run_process(argv[0], argv, 0)); } -static const sa_share_ops_t nfs_shareops = { +const sa_fstype_t libshare_nfs_type = { .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) +static boolean_t +nfs_available(void) { - nfs_fstype = register_fstype("nfs", &nfs_shareops); + static int avail; + + if (!avail) { + if (access("/usr/sbin/exportfs", F_OK) != 0) + avail = -1; + else + avail = 1; + } + + return (avail == 1); } diff --git a/lib/libshare/os/linux/smb.c b/lib/libshare/os/linux/smb.c index 47d1aa776c4f..57965ebfaad1 100644 --- a/lib/libshare/os/linux/smb.c +++ b/lib/libshare/os/linux/smb.c @@ -63,9 +63,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 +216,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 */ @@ -272,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 */ @@ -298,20 +286,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); @@ -370,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) { @@ -393,24 +363,12 @@ 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; -} - -static const sa_share_ops_t smb_shareops = { +const sa_fstype_t libshare_smb_type = { .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, }; @@ -420,23 +378,18 @@ static const sa_share_ops_t smb_shareops = { static boolean_t smb_available(void) { - struct stat statbuf; - - if (lstat(SHARE_DIR, &statbuf) != 0 || - !S_ISDIR(statbuf.st_mode)) - return (B_FALSE); + static int avail; - if (access(NET_CMD_PATH, F_OK) != 0) - return (B_FALSE); + if (!avail) { + struct stat statbuf; - return (B_TRUE); -} + if (access(NET_CMD_PATH, F_OK) != 0 || + lstat(SHARE_DIR, &statbuf) != 0 || + !S_ISDIR(statbuf.st_mode)) + avail = -1; + else + avail = 1; + } -/* - * Initializes the SMB functionality of libshare. - */ -void -libshare_smb_init(void) -{ - smb_fstype = register_fstype("smb", &smb_shareops); + return (avail == 1); } diff --git a/lib/libshare/smb.h b/lib/libshare/smb.h index 8ea44677f9ae..ca3577751923 100644 --- a/lib/libshare/smb.h +++ b/lib/libshare/smb.h @@ -43,7 +43,3 @@ 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/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 20996366030c..6f0e1818d22e 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -1,22 +1,94 @@ -SUBDIRS = rpc sys util 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%/libgen.h \ + %D%/libshare.h \ + %D%/statcommon.h \ + %D%/stdlib.h \ + %D%/string.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/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/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/uio.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/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/libshare.h b/lib/libspl/include/libshare.h index 5d06b163a3ba..ae0e2c39dc6d 100644 --- a/lib/libspl/include/libshare.h +++ b/lib/libspl/include/libshare.h @@ -27,28 +27,28 @@ #ifndef _LIBSPL_LIBSHARE_H #define _LIBSPL_LIBSHARE_H extern __attribute__((visibility("default"))) -/* API Initialization */ -#define SA_INIT_SHARE_API 0x0001 /* init share specific interface */ -#define SA_INIT_CONTROL_API 0x0002 /* init control specific interface */ +#include /* * 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 */ @@ -56,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 */ @@ -71,16 +70,26 @@ #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); + +/* 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 *, - char *); -_LIBSPL_LIBSHARE_H int sa_disable_share(const char *, char *); -_LIBSPL_LIBSHARE_H boolean_t sa_is_shared(const char *, 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(char *, char *); +_LIBSPL_LIBSHARE_H int sa_validate_shareopts(const char *, enum sa_protocol); #endif /* _LIBSPL_LIBSHARE_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/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/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/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/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/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/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 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/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/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/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 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); 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..329716abacb8 100644 --- a/lib/libunicode/Makefile.am +++ b/lib/libunicode/Makefile.am @@ -1,20 +1,7 @@ -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 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..339f9a064745 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 +dist_noinst_DATA += %D%/libuutil.abi %D%/libuutil.suppr diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 14bb7df4d7cf..323ed54cbaa2 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -1,81 +1,68 @@ -include $(top_srcdir)/config/Rules.am - 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 +libzfs_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzfs_la_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) +libzfs_la_CFLAGS += -fvisibility=hidden -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 +78,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 +dist_noinst_DATA += %D%/libzfs.abi %D%/libzfs.suppr +dist_noinst_DATA += %D%/THIRDPARTYLICENSE.openssl %D%/THIRDPARTYLICENSE.openssl.descrip diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 0f08393aadc2..96519585c156 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 @@ - - - - - - @@ -599,6 +585,7 @@ + @@ -606,110 +593,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -851,65 +735,111 @@ - + + + + + - + - + - + - + - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + - + - - + + - - + + - - + + - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + @@ -923,7 +853,7 @@ - + @@ -1261,12 +1191,12 @@ - + - + @@ -1377,7 +1307,7 @@ - + @@ -1385,12 +1315,12 @@ - + - + @@ -1609,18 +1539,18 @@ - + - + - + @@ -1628,7 +1558,7 @@ - + @@ -1636,13 +1566,13 @@ - + - + @@ -1654,6 +1584,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1728,75 +1727,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1848,4005 +1778,4053 @@ - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - + - + - + - - - - - - - - - - + - - + - + - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - - - - - - - - + + - - + + - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - + + + - + - + - + - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - - + + + + + + + - + - - + + - - + + - + - + - - - - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + - - + + - - - + + + + + - - - + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - - + + + + + + - - - - - + + + + - - - - - - - + + + + + - - - + + + - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + - - - - - - - + + + + + - - - + + + - - - + + + - - - - + + + - + + + - - - + + + + + - - - + + + + + + - - - + + + + - - - + + + + - - - + + + + + + + + + + - - - + + + + + - - - + + + + - - - + + + + + - - - + + + + + - - - - + + + + + + - - - - + + + + + + + + + + + + + - - - + + + - - - - - - - + + + + + + + + - - - + + + + + - - + + + + + + + - - + + + + + - + + - + + + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + + + - - - + + + + + - - - - + + + - - - - + + + + + - - - + + + + - - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - + + + + + + - - - - - - - - - - - + + + + + - - - - - - - - - - - + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + - - - + + + + + - - - - - + + + + - - - - - + + + + + + - - - - - + + + + + + - - - - + + + + + + + - - - - - + + + + + - - + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + + - - - - - - - + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - + - - - - + - - + + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - + + + + - - - - - - - - - - + + + - - - - + + + - - - - - - - + + + + + + + - - + + - + - - - - - + + + + - - - - + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - + - - + + - + - - - - - - - - - - - - - - - + + - - - - - + + + - - - - - + + + - - + + - - - - - + + + - + - - + + + - - - - - - - - - - + + + - - - - - - - + + + - - - + + + - - - - - + + + - - - - + + + + + - - - - - + + + - + - - - - + + + + - + - - + + + - + + + + + - - - - + + + + - - - - - + + + + - - - - - - + + + + - - - - + + + + + - - - - - + + + + - - - - + + + + + + + - - - - - + + + + + + + - - - + + + + - - - - + + + - - - - - + + + + + - - - - - + + + + - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - + + + + + + + - - - - - + + + - - - - - - - - - - - - + + + + + + + - - - - - - - + + + - - - - + + - - - - - - + + + + - - - - - + + + + - - - - + + + - - - - - + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - + + + + + + - - - - + + + - - - + + + - - - + + + + + + - - + + + - - + + + + + - - - - - - - - - + + + + + + + - - + + + + - - + + + + + - + + + + + + - - + + + + + + - - - - - - - - - - - + + + - - - + + + + + - - + + + - - + + + - - - + + + + + + - - - + + + + + + + + - - - - + + + + + + + + + - - - - - - - - - - - - - - - + - - + + - + - + + + - - + + - + + + + + + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - + - + - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + - - + + - - - + + + + + - - - - - - - + + + + + + + + + - - - - + + + + + + - - - - - + + + + + + + + + + + + + + + - - - - - + + - + + + + + - - - - + - - - + + + + + + - + - - + + + - - + + + + + + + + - - - + + + + + - - + + + + + - - - + + + - - - - - - + + + + + + - - - + + + + - - + + + + + + + + + + + - - + + + + + + + + + + + + + + + - - - + + + + + + + + - + - - + - - - - + + + - + + + + - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + - - - - + + + + + - - + - - + - - - - + + + - - - + + + - - - - + + + - - - - + + + - - - - - + + - - - - + + + - - - + + + + + + + + + - - - - - - + + + - - - + + + + - - - - - + + + + - - - - - - + + + - - - - + + + - - - - - + + + + + + + - - - - - - - + + + - - - - - + + + - - - - - - - - - - + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + - - - - + + - - - - + + + - - - - - + + - - - - + + - - - - - + + + + + + + + + + + - - - - - - + + + + + - - + + + + + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - - - - + - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - + - - - - + - + - + - - - - + - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - + + + - - - - - + + + - - - - - + + + - - - - - - - - - - + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + - - - + + - + - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + - - - + + + - - - + + - + + + + + + + + + + + + + + + + + + + - - - - - - + + - - + + - + - + - + + + + - - + + + + + - + - - + + - - + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + - - + + + + + - - - - - - + + + + - - - + + + + + - + + - - + + + + + - + + + + - - - - + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + - + + + + - - - - + + + - - - + + + + + - - - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - + - + + - + - + + + + - + - + - + - - + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - - - - + + - - + + - - + + - - + + - - - - - - - + + + + + + + + - - - + + - - - - + + + - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + - - - + + + + - - - + + + + + - - - + + + - - + + - - + + - - - + + + - - + + + + + + + + + + + + + + - - - - - - - - - - + + + - - - + + + + - - - - + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - + + + + - - - - - - + + - - - + + + - + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - + + + - - - - - - - + + + - - - - - - - - - - - - + + - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + - - - - + + + + + + + + + + - - - - + + + + + + + + + + - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/libzfs/libzfs_changelist.c b/lib/libzfs/libzfs_changelist.c index 5441864c5cf6..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); @@ -345,7 +355,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; @@ -359,11 +369,12 @@ changelist_unshare(prop_changelist_t *clp, const zfs_share_proto_t *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; } - 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); @@ -451,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; @@ -521,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; @@ -737,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 4f5d4d8c3c7b..684a7e0eef46 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 @@ -1418,14 +1417,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); @@ -3580,14 +3580,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_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 diff --git a/lib/libzfs/libzfs_impl.h b/lib/libzfs/libzfs_impl.h index 4b18ad66854f..926e14a3716c 100644 --- a/lib/libzfs/libzfs_impl.h +++ b/lib/libzfs/libzfs_impl.h @@ -105,22 +105,6 @@ 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. - */ -typedef enum { - SHARED_NOT_SHARED = 0x0, - SHARED_NFS = 0x2, - SHARED_SMB = 0x4 -} zfs_share_type_t; - 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 +173,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 +193,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; @@ -243,21 +224,10 @@ 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 zfs_share_proto_t *proto); -extern int zfs_unshare_proto(zfs_handle_t *, const char *, - const zfs_share_proto_t *); -extern int unshare_one(libzfs_handle_t *hdl, const char *name, - const char *mountpoint, zfs_share_proto_t 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); 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..a2f1c982c9f4 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,31 +85,18 @@ 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); -/* - * 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 }; @@ -260,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) { @@ -634,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); } @@ -702,58 +679,20 @@ zfs_unmountall(zfs_handle_t *zhp, int flags) return (ret); } -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); - - return (rc ? B_TRUE : B_FALSE); -} - /* * Unshare a filesystem by mountpoint. */ -int +static 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); -} -/* - * Query libshare for the given mountpoint and protocol, returning - * a zfs_share_type_t value. - */ -zfs_share_type_t -is_shared(const char *mountpoint, zfs_share_proto_t 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); + return (0); } /* @@ -762,19 +701,22 @@ 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(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 (proto == NULL) + proto = share_all_proto; + 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 +736,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, @@ -806,188 +748,88 @@ zfs_share_proto(zfs_handle_t *zhp, const zfs_share_proto_t *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, zfs_share_proto_t 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, - PROTO_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)); -} + char *mountpoint; + if (proto == NULL) + proto = share_all_proto; -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); -} + if (ZFS_IS_VOLUME(zhp)) + return (B_FALSE); -void -zfs_commit_nfs_shares(void) -{ - zfs_commit_proto(nfs_only); -} + if (!zfs_is_mounted(zhp, &mountpoint)) + return (B_FALSE); -void -zfs_commit_smb_shares(void) -{ - zfs_commit_proto(smb_only); -} + 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) -{ - zfs_commit_proto(share_all_proto); + 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_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); -} - -int -zfs_share_nfs(zfs_handle_t *zhp) -{ - return (zfs_share_proto(zhp, nfs_only)); -} + proto = share_all_proto; -int -zfs_share_smb(zfs_handle_t *zhp) -{ - 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, - const zfs_share_proto_t *proto) +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; - /* check to see if need to unmount the filesystem */ - if (mountpoint != NULL) - mntpt = zfs_strdup(hdl, mountpoint); + if (proto == NULL) + proto = share_all_proto; 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; - if (mountpoint == NULL) - mntpt = zfs_strdup(zhp->zfs_hdl, entry.mnt_mountp); - - for (curr_proto = proto; *curr_proto != PROTO_END; - curr_proto++) { + /* check to see if need to unmount the filesystem */ + const char *mntpt = mountpoint ?: entry.mnt_mountp; - if (is_shared(mntpt, *curr_proto)) { - if (unshare_one(hdl, zhp->zfs_name, - mntpt, *curr_proto) != 0) { - if (mntpt != NULL) - free(mntpt); + for (const enum sa_protocol *curr_proto = proto; + *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); } -int -zfs_unshare_nfs(zfs_handle_t *zhp, const char *mountpoint) -{ - return (zfs_unshare_proto(zhp, mountpoint, nfs_only)); -} - -int -zfs_unshare_smb(zfs_handle_t *zhp, const char *mountpoint) -{ - 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 zfs_share_proto_t *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); @@ -998,44 +840,6 @@ zfs_unshareall_proto(zfs_handle_t *zhp, const zfs_share_proto_t *proto) return (ret); } -int -zfs_unshareall_nfs(zfs_handle_t *zhp) -{ - return (zfs_unshareall_proto(zhp, nfs_only)); -} - -int -zfs_unshareall_smb(zfs_handle_t *zhp) -{ - 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)); - 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); -} - /* * Remove the mountpoint associated with the current dataset, if necessary. * We only remove the underlying directory if: @@ -1326,7 +1130,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); } @@ -1499,7 +1303,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++) @@ -1608,16 +1412,14 @@ 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 (sa_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; } } - zfs_commit_all_shares(); + zfs_commit_shares(NULL); /* * Now unmount everything, removing the underlying directories as diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 2f5b8dbfbdbe..4dc4d672be14 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -4171,10 +4171,11 @@ char * zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, int name_flags) { - char *path, *type, *env; + char *type, *tpath; + const char *path; 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 @@ -4184,19 +4185,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 || @@ -4204,7 +4197,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) { @@ -5232,7 +5227,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) @@ -5291,7 +5286,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/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 2458d616c97a..b4001afbfa2a 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 a32aa1513b39..9d6f574a5546 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 @@ -192,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); } diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am index b75ed464a907..d1c6fb86d186 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 +dist_noinst_DATA += %D%/libzfs_core.abi %D%/libzfs_core.suppr diff --git a/lib/libzfsbootenv/Makefile.am b/lib/libzfsbootenv/Makefile.am index a9f19ad5bb1d..5ca92bf2e76a 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$(top_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 +dist_noinst_DATA += %D%/libzfsbootenv.abi %D%/libzfsbootenv.suppr diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index 694ae84e6616..dfb9c99f868c 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -1,226 +1,199 @@ -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$(top_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 \ - object_agent.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 \ - sock.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_object_store.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 \ + %D%/object_agent.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/sock.c \ + ../module/os/linux/zfs/trace.c \ + ../module/os/linux/zfs/vdev_file.c \ + ../module/os/linux/zfs/vdev_object_store.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 @@ -237,8 +210,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/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/lib/libzstd/Makefile.am b/lib/libzstd/Makefile.am index e7de3e979fb8..ffdbb86555f9 100644 --- a/lib/libzstd/Makefile.am +++ b/lib/libzstd/Makefile.am @@ -1,44 +1,32 @@ -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 + +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 52e336b5bbb5..951dfe1b3b5a 100644 --- a/lib/libzutil/Makefile.am +++ b/lib/libzutil/Makefile.am @@ -1,49 +1,44 @@ -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 \ - zutil_zoa.c \ - zutil_zoa.h +libzutil_la_SOURCES = \ + %D%/zutil_device_path.c \ + %D%/zutil_import.c \ + %D%/zutil_import.h \ + %D%/zutil_nicenum.c \ + %D%/zutil_pool.c \ + %D%/zutil_zoa.c \ + %D%/zutil_zoa.h 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/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..cfd4bfbf1e2c 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,10 +148,18 @@ 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); + 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); } /* 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); diff --git a/man/Makefile.am b/man/Makefile.am index 64650c2b988a..8fa21d2fd23e 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,118 +1,124 @@ -include $(top_srcdir)/config/Substfiles.am - -EXTRA_DIST += \ - man1/cstyle.1 +dist_noinst_man_MANS = \ + %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/test-runner.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 + +dist_noinst_DATA += $(dist_noinst_man_MANS) $(dist_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 # 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/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/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 diff --git a/man/man4/zfs.4 b/man/man4/zfs.4 index 5ef517c46faa..a086e1a5d56c 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 @@ -1098,10 +1109,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. @@ -2129,6 +2139,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 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 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/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..eaa93e0ea75c 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 @@ -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 diff --git a/module/Kbuild.in b/module/Kbuild.in index 75e7a0688e98..f543b30475b6 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@ diff --git a/module/Makefile.in b/module/Makefile.in index a75602f1641d..9754f8d1c827 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -7,15 +7,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. @@ -121,6 +123,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 @# XXX is the Delphix version needed anymore? @@ -138,6 +149,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 \ @@ -145,7 +164,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 \ 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)))) 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..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. */ -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_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 flag = 1, 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') { \ @@ -474,46 +485,21 @@ int ddi_strtou##type(const char *str, char **endptr, \ if (last_value > value) /* Overflow */ \ return (ERANGE); \ \ - flag = 1; \ ptr++; \ } \ \ - if (flag) \ - *result = value; \ + *result = minus ? -value : value; \ \ if (endptr) \ - *endptr = (char *)(flag ? ptr : str); \ + *endptr = ptr; \ \ 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_ddi_strtoux(l, unsigned long) define_ddi_strtox(l, long) -define_ddi_strtoux(ll, unsigned long long) +define_ddi_strtox(ull, unsigned long long) define_ddi_strtox(ll, long long) -EXPORT_SYMBOL(ddi_strtoul); EXPORT_SYMBOL(ddi_strtol); EXPORT_SYMBOL(ddi_strtoll); EXPORT_SYMBOL(ddi_strtoull); diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index 8cf1b8e49fef..61fe2407b9de 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); @@ -316,13 +314,13 @@ 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); + 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); @@ -460,6 +458,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 +561,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 +572,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 +613,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 +665,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 +675,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 +738,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); @@ -728,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_control_flags & ZIO_CONTROL_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_control_flags & ZIO_CONTROL_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; /* @@ -806,14 +855,7 @@ vdev_disk_io_start(zio_t *zio) break; case ZIO_TYPE_TRIM: -#if defined(BLKDEV_DISCARD_SECURE) - if (zio->io_control_flags & ZIO_CONTROL_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; 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, diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c index c19f9a2b1902..0a1388044374 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) @@ -1267,7 +1275,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, diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index dae7c4600319..43c05ca2d5c1 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -1070,7 +1070,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 diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index c2c3b05e1764..e6ce6fa0b100 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -3194,8 +3194,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)); } @@ -3329,7 +3331,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); } @@ -3464,7 +3467,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); } @@ -3476,7 +3480,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_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/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"); diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c index 7057a65be78a..1dcd569eb3ac 100644 --- a/module/zfs/dsl_pool.c +++ b/module/zfs/dsl_pool.c @@ -106,9 +106,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; @@ -624,15 +623,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 @@ -642,6 +644,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 diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c index 2576e677aac1..c54cb6c5e561 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/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, diff --git a/module/zfs/spa.c b/module/zfs/spa.c index d56403dfe38a..fb9d9366bd1a 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -2323,9 +2323,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 @@ -2333,6 +2330,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/spa_log_spacemap.c b/module/zfs/spa_log_spacemap.c index 5e8c64b7f111..8297e631b38f 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; 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, 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; diff --git a/module/zfs/zil.c b/module/zfs/zil.c index bc18a1e6b867..edc1afd586ab 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -561,8 +561,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); @@ -1187,9 +1187,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); @@ -1198,15 +1198,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; @@ -1265,12 +1263,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 } /* @@ -1566,11 +1599,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); @@ -1586,7 +1614,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 @@ -1663,6 +1695,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(). @@ -2938,7 +2972,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 @@ -3137,6 +3171,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); @@ -3303,6 +3339,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, @@ -3316,6 +3353,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); } @@ -3351,8 +3389,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)); } @@ -3400,9 +3440,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); diff --git a/module/zfs/zio.c b/module/zfs/zio.c index d50590768307..deaf115b559e 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -978,14 +978,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)); 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 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..af7b25021eac 100644 --- a/rpm/Makefile.am +++ b/rpm/Makefile.am @@ -1 +1,8 @@ -SUBDIRS = generic redhat +dist_noinst_DATA += \ + %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/generic/zfs-dkms.spec.in b/rpm/generic/zfs-dkms.spec.in index cd0a3ded2a00..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%{?rhel}%{?fedora}%{?suse_version} +%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 d07000cbd638..3f1fd22c76e7 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%{?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 @@ -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/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index 14111654e514..b26164bb6c63 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. @@ -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%{?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 @@ -218,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 @@ -278,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} @@ -314,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 @@ -524,6 +526,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.* 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 diff --git a/rpm/redhat/zfs-kmod.spec.in b/rpm/redhat/zfs-kmod.spec.in index 03933bb40a86..a9b377be9303 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. @@ -112,4 +109,3 @@ rm -rf $RPM_BUILD_ROOT %files -n kmod-%{kmod_name}-devel %{_usrsrc}/%{kmod_name}-%{version} -%{_usrsrc}/spl-%{version} diff --git a/scripts/Makefile.am b/scripts/Makefile.am index fffeb6b212d5..79719e621b69 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,83 +1,88 @@ -include $(top_srcdir)/config/Shellcheck.am +scriptsdir = $(datadir)/$(PACKAGE) +dist_scripts_SCRIPTS = \ + %D%/zfs-helpers.sh \ + %D%/zfs-tests.sh \ + %D%/zfs.sh \ + %D%/zimport.sh \ + %D%/zloop.sh -pkgdatadir = $(datadir)/@PACKAGE@ +dist_noinst_SCRIPTS = \ + %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 -dist_pkgdata_SCRIPTS = \ - zimport.sh \ - zfs.sh \ - zfs-tests.sh \ - zloop.sh \ - zfs-helpers.sh +dist_noinst_DATA += \ + %D%/cstyle.pl \ + %D%/enum-extract.pl \ + %D%/zfs2zol-patch.sed \ + %D%/zol2zfs-patch.sed -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 +SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) $(dist_noinst_SCRIPTS) -EXTRA_DIST = \ - cstyle.pl \ - enum-extract.pl \ - zfs2zol-patch.sed \ - zol2zfs-patch.sed \ - $(EXTRA_SCRIPTS) - -SHELLCHECKSCRIPTS = $(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@/cmd -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 CONTRIB_DIR=@abs_top_builddir@/contrib -export LIB_DIR=@abs_top_builddir@/lib -export SYSCONF_DIR=@abs_top_builddir@/etc +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 +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 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 + +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" >>$@ -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|' \ - -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 +ALL_LOCAL += scripts-all-local +scripts-all-local: %D%/common.sh + -SCRIPT_COMMON=$< $(srcdir)/%D%/zfs-tests.sh -c -clean-local: - -$(RM) common.sh +CLEAN_LOCAL += scripts-clean-local +scripts-clean-local: + -$(RM) -r tests/zfs-tests/bin/ -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 diff --git a/scripts/kmodtool b/scripts/kmodtool index afbb6ab3b03c..a79ad0c7a0f3 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 < 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 @@ -303,11 +278,6 @@ Provides: ${kmodname}-devel-kmod = %{?epoch:%{epoch}:}%{version}-%{relea Provides: kmod-${kmodname}-devel-uname-r = ${kernel_uname_r} EOF - if [ -n "${obsolete_name}" ]; then - echo "Provides: kmod-${obsolete_name}-devel-${kernel_uname_r} = ${obsolete_version}" - echo "Obsoletes: kmod-${obsolete_name}-devel-${kernel_uname_r} < ${obsolete_version}" - fi - # second part if [ -z "${customkernel}" ]; then 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}" @@ -514,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}" @@ -583,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 @@ -608,21 +552,17 @@ 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 - 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 fi - print_rpmtemplate + print_rpmtemplate fi diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh index a86a6eb61a60..8dcb0630126a 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,32 +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 "$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 + 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/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" - 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 f46c9d507ba0..8a7345b6b463 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" @@ -384,7 +379,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="" @@ -394,14 +389,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/scripts/zloop.sh b/scripts/zloop.sh index f7d5bedadec8..729fba98c33e 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}" @@ -73,8 +73,7 @@ EOF function or_die { - # shellcheck disable=SC2068 - if ! $@; then + if ! "$@"; then echo "Command failed: $*" exit 1 fi @@ -137,7 +136,6 @@ function store_core fi dest=$coredir/$coreid - or_die mkdir -p "$dest" or_die mkdir -p "$dest/vdev" if [[ $symlink -ne 0 ]]; then @@ -146,15 +144,8 @@ function store_core echo "*** ztest crash found - moving logs to $dest" - or_die mv ztest.history "$dest/" - [[ -e ztest.zdb ]] && \ - or_die mv ztest.zdb "$dest/" - or_die mv ztest.out "$dest/" - - ztest_dirs=$(find "$workdir" -name "ztest*") - if [ -n "$ztest_dirs" ]; then - or_die mv "$workdir/ztest*" "$dest/vdev/" - fi + 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/" @@ -289,9 +280,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 @@ -386,9 +375,7 @@ while (( timeout == 0 )) || (( curtime <= (starttime + timeout) )); do zopt="$zopt -s $size" fi 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 diff --git a/tests/Makefile.am b/tests/Makefile.am index 1dfc2cc5f518..dc8869198612 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,8 +1,32 @@ -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 = $$(find . -name '*.sh') -.PHONY: $(SHELLCHECKSCRIPTS) +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/dlpx_functional.run \ + %D%/runfiles/freebsd.run \ + %D%/runfiles/linux.run \ + %D%/runfiles/longevity.run \ + %D%/runfiles/object_store.run \ + %D%/runfiles/perf-regression.run \ + %D%/runfiles/sanity.run \ + %D%/runfiles/sunos.run + + +dist_noinst_DATA += %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 bac2b2a436fe..000000000000 --- a/tests/runfiles/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/runfiles -dist_pkgdata_DATA = \ - common.run \ - dlpx_functional.run \ - freebsd.run \ - linux.run \ - longevity.run \ - object_store.run \ - perf-regression.run \ - sanity.run \ - sunos.run diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index 5e040a2d520a..324065e3675e 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'] @@ -305,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] @@ -886,10 +890,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/Makefile.am b/tests/test-runner/Makefile.am deleted file mode 100644 index db3d966142d6..000000000000 --- a/tests/test-runner/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = bin include man diff --git a/tests/test-runner/bin/Makefile.am b/tests/test-runner/bin/Makefile.am deleted file mode 100644 index e11e55fffdeb..000000000000 --- a/tests/test-runner/bin/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -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/bin/zts-report.py.in b/tests/test-runner/bin/zts-report.py.in index e347d93992fb..9d2c36a98b89 100755 --- a/tests/test-runner/bin/zts-report.py.in +++ b/tests/test-runner/bin/zts-report.py.in @@ -190,6 +190,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], @@ -458,7 +459,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/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/test-runner/man/Makefile.am b/tests/test-runner/man/Makefile.am deleted file mode 100644 index a7017f5f0535..000000000000 --- a/tests/test-runner/man/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -dist_man_MANS = test-runner.1 - -install-data-local: - $(INSTALL) -d -m 0755 "$(DESTDIR)$(mandir)/man1" 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/Makefile.am b/tests/zfs-tests/Makefile.am index ef4e6be9e980..c5051bfe11d8 100644 --- a/tests/zfs-tests/Makefile.am +++ b/tests/zfs-tests/Makefile.am @@ -1 +1,49 @@ -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 = \ + lib/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 = \ + lib/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/object_store.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/.gitignore b/tests/zfs-tests/cmd/.gitignore index 9de5687d6ec8..7776b129667d 100644 --- a/tests/zfs-tests/cmd/.gitignore +++ b/tests/zfs-tests/cmd/.gitignore @@ -4,16 +4,19 @@ /devname2devid /dir_rd_update /draid +/file_append /file_check /file_trunc /file_write /get_diff +/getholes /getversion /largest_file /libzfs_input_check /mkbusy /mkfile /mkfiles +/mkholes /mktree /mmap_exec /mmap_libaio diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am index 2dbe41af6e1c..a3d10899c3a4 100644 --- a/tests/zfs-tests/cmd/Makefile.am +++ b/tests/zfs-tests/cmd/Makefile.am @@ -1,190 +1,135 @@ -include $(top_srcdir)/config/Rules.am +scripts_zfs_tests_bindir = $(datadir)/$(PACKAGE)/zfs-tests/bin -SUBDIRS = getholes mkholes -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)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la +scripts_zfs_tests_bin_PROGRAMS += %D%/badsend +%C%_badsend_LDADD = \ + lib/libzfs_core.la \ + lib/libzfs.la \ + lib/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_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/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 = \ + lib/libzpool.la \ + lib/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)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la -draid_LDADD += $(ZLIB_LIBS) +scripts_zfs_tests_bin_PROGRAMS += %D%/draid +%C%_draid_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) +%C%_draid_LDADD = \ + lib/libzpool.la \ + lib/libnvpair.la +%C%_draid_LDADD += $(ZLIB_LIBS) +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 +%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 -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%/getholes +%C%_getholes_LDADD = lib/libzfs.la -pkgexec_PROGRAMS += get_diff -get_diff_SOURCES = get_diff.c +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 = \ + lib/libzfs_core.la \ + lib/libnvpair.la -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)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la +scripts_zfs_tests_bin_PROGRAMS += %D%/mkbusy %D%/mkfile %D%/mkfiles %D%/mktree +%C%_mkfile_LDADD = $(LTLIBINTL) -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%/mkholes +%C%_mkholes_LDADD = lib/libzfs.la -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)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la - +scripts_zfs_tests_bin_PROGRAMS += %D%/nvlist_to_lua +%C%_nvlist_to_lua_LDADD = \ + lib/libzfs_core.la \ + lib/libnvpair.la -pkgexec_PROGRAMS += rename_dir -rename_dir_SOURCES = rename_dir.c +scripts_zfs_tests_bin_PROGRAMS += %D%/rm_lnkcnt_zero_file +%C%_rm_lnkcnt_zero_file_LDADD = -lpthread -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%/send_doall +%C%_send_doall_LDADD = \ + lib/libzfs_core.la \ + lib/libzfs.la \ + lib/libnvpair.la -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 +scripts_zfs_tests_bin_PROGRAMS += %D%/stride_dd +%C%_stride_dd_LDADD = -lrt -pkgexec_PROGRAMS += stride_dd -stride_dd_SOURCES = stride_dd.c -stride_dd_LDADD = -lrt +scripts_zfs_tests_bin_PROGRAMS += %D%/threadsappend +%C%_threadsappend_LDADD = -lpthread -pkgexec_PROGRAMS += threadsappend -threadsappend_SOURCES = threadsappend.c -threadsappend_LDADD = -lpthread +scripts_zfs_tests_bin_PROGRAMS += %D%/ereports +%C%_ereports_LDADD = \ + lib/libnvpair.la \ + lib/libzfs.la -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)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libzfs/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)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la -sha2_test_LDADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la -edonr_test_LDADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/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 = \ + lib/libicp.la \ + lib/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 +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 -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/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/cmd/getholes/getholes.c b/tests/zfs-tests/cmd/getholes.c similarity index 100% rename from tests/zfs-tests/cmd/getholes/getholes.c rename to tests/zfs-tests/cmd/getholes.c diff --git a/tests/zfs-tests/cmd/getholes/.gitignore b/tests/zfs-tests/cmd/getholes/.gitignore deleted file mode 100644 index f88884bf0375..000000000000 --- a/tests/zfs-tests/cmd/getholes/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/getholes diff --git a/tests/zfs-tests/cmd/getholes/Makefile.am b/tests/zfs-tests/cmd/getholes/Makefile.am deleted file mode 100644 index 85251f973b4a..000000000000 --- a/tests/zfs-tests/cmd/getholes/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin - -DEFAULT_INCLUDES += \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/libspl/include - -getholes_LDADD = \ - $(top_builddir)/lib/libspl/libspl.la \ - $(top_builddir)/lib/libzfs/libzfs.la - -pkgexec_PROGRAMS = getholes -getholes_SOURCES = getholes.c diff --git a/tests/zfs-tests/cmd/mkholes/mkholes.c b/tests/zfs-tests/cmd/mkholes.c similarity index 100% rename from tests/zfs-tests/cmd/mkholes/mkholes.c rename to tests/zfs-tests/cmd/mkholes.c diff --git a/tests/zfs-tests/cmd/mkholes/.gitignore b/tests/zfs-tests/cmd/mkholes/.gitignore deleted file mode 100644 index 02a50f380890..000000000000 --- a/tests/zfs-tests/cmd/mkholes/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/mkholes diff --git a/tests/zfs-tests/cmd/mkholes/Makefile.am b/tests/zfs-tests/cmd/mkholes/Makefile.am deleted file mode 100644 index 8a65f7a177f5..000000000000 --- a/tests/zfs-tests/cmd/mkholes/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -include $(top_srcdir)/config/Rules.am - -pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin - -DEFAULT_INCLUDES += \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/libspl/include - -mkholes_LDADD = \ - $(top_builddir)/lib/libspl/libspl.la \ - $(top_builddir)/lib/libzfs/libzfs.la - -pkgexec_PROGRAMS = mkholes -mkholes_SOURCES = mkholes.c diff --git a/tests/zfs-tests/include/Makefile.am b/tests/zfs-tests/include/Makefile.am deleted file mode 100644 index 71447a5687cd..000000000000 --- a/tests/zfs-tests/include/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -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 \ - object_store.shlib - -nodist_pkgdata_DATA = default.cfg -SUBSTFILES += $(nodist_pkgdata_DATA) diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg index d5e735d59888..089e1f2c94a0 100644 --- a/tests/zfs-tests/include/commands.cfg +++ b/tests/zfs-tests/include/commands.cfg @@ -189,6 +189,7 @@ export ZFSTEST_FILES='badsend devname2devid dir_rd_update draid + file_append file_check file_trunc file_write diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 7ad58ff26d33..39e01b2b9a8a 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -1147,6 +1147,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 f7494791524e..e300cd53187f 100644 --- a/tests/zfs-tests/tests/Makefile.am +++ b/tests/zfs-tests/tests/Makefile.am @@ -1 +1,2008 @@ -SUBDIRS = functional perf stress +CLEANFILES = +dist_noinst_DATA = +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/random_writes_fill.fio \ + perf/fio/sequential_reads.fio \ + perf/fio/sequential_reads_fill.fio \ + perf/fio/sequential_readwrite.fio \ + perf/fio/sequential_writes.fio + +nobase_dist_datadir_zfs_tests_tests_SCRIPTS = \ + perf/regression/file_deletion.ksh \ + 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 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/$/ \\/' +# 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 + +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 = \ + 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/holes/holes.shlib \ + 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/zcache_slog_sharing/zcache_slog_sharing.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/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 \ + 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/background_freeing/cleanup.ksh \ + functional/background_freeing/default_free_space_reclaimation.ksh \ + functional/background_freeing/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_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 \ + 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_destroy/zpool_destroy_object_store.ksh \ + functional/cli_root/zpool_destroy/zpool_resume_destroy_object_store.ksh \ + functional/cli_root/zpool_destroy/zpool_resume_destroy_on_import_object_store.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_agent_stopped_multi_pools_object_store.ksh \ + functional/cli_root/zpool_import/import_agent_stopped_object_store.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_pools_with_same_name_object_store.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/holes/cleanup.ksh \ + functional/holes/holes_sanity.ksh \ + functional/holes/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/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/zcache_slog_sharing/cleanup.ksh \ + functional/zcache_slog_sharing/setup.ksh \ + functional/zcache_slog_sharing/zcache_slog_sharing_import_pool_slog_missing_neg.ksh \ + functional/zcache_slog_sharing/zcache_slog_sharing_multiple_pools_pos.ksh \ + functional/zcache_slog_sharing/zcache_slog_sharing_slog_same_as_cache_neg.ksh \ + functional/zcache_slog_sharing/zcache_slog_sharing_without_cache_inuse_pos.ksh \ + functional/zcache_slog_sharing/zcache_slog_sharing_zoa_invalid_cache_device_neg.ksh \ + functional/zcache_slog_sharing/zcache_slog_sharing_zpool_add_pos.ksh \ + functional/zcache_slog_sharing/zcache_slog_sharing_zpool_create_pos.ksh \ + functional/zcache_slog_sharing/zcache_slog_sharing_zpool_import_pos.ksh \ + functional/zoa/dump_inmemory_zoa_tracing_sigusr1.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 b322734065b6..000000000000 --- a/tests/zfs-tests/tests/functional/Makefile.am +++ /dev/null @@ -1,98 +0,0 @@ -SUBDIRS = \ - acl \ - alloc_class \ - arc \ - atime \ - background_freeing \ - 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 \ - hkdf \ - 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 \ - zcache_slog_sharing \ - zoa \ - 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/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/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/background_freeing/Makefile.am b/tests/zfs-tests/tests/functional/background_freeing/Makefile.am deleted file mode 100644 index 4feb94cbba81..000000000000 --- a/tests/zfs-tests/tests/functional/background_freeing/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/background_freeing -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - default_free_space_reclaimation.ksh \ - cleanup.ksh 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_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." 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 3af5d036064a..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am +++ /dev/null @@ -1,10 +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 \ - zpool_destroy_object_store.ksh \ - zpool_resume_destroy_object_store.ksh \ - zpool_resume_destroy_on_import_object_store.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 58c76986e12d..000000000000 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -SUBDIRS = blockfiles - -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_import -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - import_agent_stopped_multi_pools_object_store.ksh \ - import_agent_stopped_object_store.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_pools_with_same_name_object_store.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/hkdf/Makefile.am b/tests/zfs-tests/tests/functional/hkdf/Makefile.am deleted file mode 100644 index 1d126c4a907a..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)/lib/libzpool/libzpool.la diff --git a/tests/zfs-tests/tests/functional/holes/Makefile.am b/tests/zfs-tests/tests/functional/holes/Makefile.am deleted file mode 100644 index 3fe266d9935a..000000000000 --- a/tests/zfs-tests/tests/functional/holes/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/holes -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - cleanup.ksh \ - holes_sanity.ksh - -dist_pkgdata_DATA = \ - holes.kshlib 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 51482f4e63b5..000000000000 --- a/tests/zfs-tests/tests/functional/libzfs/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -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)/lib/libzfs/libzfs.la 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); } 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 26c5ac595a5d..000000000000 --- a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -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/.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 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 35a1f44c1693..000000000000 --- a/tests/zfs-tests/tests/functional/tmpfile/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -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/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/zcache_slog_sharing/Makefile.am b/tests/zfs-tests/tests/functional/zcache_slog_sharing/Makefile.am deleted file mode 100644 index e0562554f376..000000000000 --- a/tests/zfs-tests/tests/functional/zcache_slog_sharing/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zcache_slog_sharing -dist_pkgdata_SCRIPTS = \ - setup.ksh \ - zcache_slog_sharing_zpool_create_pos.ksh \ - zcache_slog_sharing_zpool_add_pos.ksh \ - zcache_slog_sharing_zpool_import_pos.ksh \ - zcache_slog_sharing_multiple_pools_pos.ksh \ - zcache_slog_sharing_without_cache_inuse_pos.ksh \ - zcache_slog_sharing_slog_same_as_cache_neg.ksh \ - zcache_slog_sharing_import_pool_slog_missing_neg.ksh \ - zcache_slog_sharing_zoa_invalid_cache_device_neg.ksh \ - cleanup.ksh - -dist_pkgdata_DATA = \ - zcache_slog_sharing.kshlib diff --git a/tests/zfs-tests/tests/functional/zoa/Makefile.am b/tests/zfs-tests/tests/functional/zoa/Makefile.am deleted file mode 100644 index 11778a409237..000000000000 --- a/tests/zfs-tests/tests/functional/zoa/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zoa -dist_pkgdata_SCRIPTS = \ - dump_inmemory_zoa_tracing_sigusr1.ksh 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 c62ccc257313..000000000000 --- a/tests/zfs-tests/tests/perf/fio/Makefile.am +++ /dev/null @@ -1,12 +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 \ - random_writes_fill.fio \ - sequential_reads.fio \ - sequential_reads_fill.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 84515edd6308..000000000000 --- a/tests/zfs-tests/tests/perf/regression/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/perf/regression -dist_pkgdata_SCRIPTS = \ - file_deletion.ksh \ - 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 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 = 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 f930941fb083..6fd645b5c22f 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -1 +1,18 @@ -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) + + +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/udev/rules.d/Makefile.am b/udev/rules.d/Makefile.am deleted file mode 100644 index 72f47d6f2a66..000000000000 --- a/udev/rules.d/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -include $(top_srcdir)/config/Substfiles.am - -udevrule_DATA = \ - 69-vdev.rules \ - 60-zvol.rules \ - 90-zfs.rules - -SUBSTFILES += $(udevrule_DATA) 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/udev/zvol_id.c b/udev/zvol_id.c new file mode 100644 index 000000000000..ea38ac8cdf38 --- /dev/null +++ b/udev/zvol_id.c @@ -0,0 +1,86 @@ +/* + * 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) 2011, Fajar A. Nugraha. All rights reserved. + * Use is subject to license terms. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(ZFS_ASAN_ENABLED) +/* + * zvol_id is invoked by udev with the help of ptrace() + * making sanitized binary with leak detection croak + * because of tracing mechanisms collision + */ +extern const char *__asan_default_options(void); + +const char *__asan_default_options(void) { + return ("abort_on_error=true:halt_on_error=true:" + "allocator_may_return_null=true:disable_coredump=false:" + "detect_stack_use_after_return=true:detect_leaks=false"); +} +#endif + +int +main(int argc, const char *const *argv) +{ + if (argc != 2) { + fprintf(stderr, "usage: %s /dev/zdX\n", argv[0]); + return (1); + } + 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); + } + + 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); + } + + unsigned int dev_part = minor(sb.st_rdev) % ZVOL_MINORS; + if (dev_part != 0) + sprintf(zvol_name + strlen(zvol_name), "-part%u", dev_part); + + for (size_t i = 0; i < strlen(zvol_name); ++i) + if (isblank(zvol_name[i])) + zvol_name[i] = '+'; + + puts(zvol_name); + + return (0); +}