From b828cf1d01d291de2ab43f207f243898c763f7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 14 May 2021 04:17:31 +0200 Subject: [PATCH 01/24] zed-functions.sh: zed_lock(): don't truncate lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By appending instead of truncating, we can lock on any file (with write permissions) instead of only dedicated lock files, since the locking process itself no longer alters the file in any way Reviewed-by: Tony Hutter Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12042 --- cmd/zed/zed.d/zed-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zed/zed.d/zed-functions.sh b/cmd/zed/zed.d/zed-functions.sh index c4ed5aa8ac7a..9f8531d737a6 100644 --- a/cmd/zed/zed.d/zed-functions.sh +++ b/cmd/zed/zed.d/zed-functions.sh @@ -126,7 +126,7 @@ zed_lock() # Obtain a lock on the file bound to the given file descriptor. # - eval "exec ${fd}> '${lockfile}'" + eval "exec ${fd}>> '${lockfile}'" if ! err="$(flock --exclusive "${fd}" 2>&1)"; then zed_log_err "failed to lock \"${lockfile}\": ${err}" fi From e20c9330d7b68c41a4e9b19dc6bd4760b6052b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 14 May 2021 04:18:20 +0200 Subject: [PATCH 02/24] zed.d/all-debug.sh: simplify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By locking the log file itself, we can omit arduous rebinding and explicit umask setting, but, perhaps more importantly, avoid permanently littering /var/lock/ with zed.debug.log.lock we will never delete It is imperative that the previous commit ("zed-functions.sh: zed_lock(): don't truncate lock") be included in any series that contains this one Reviewed-by: Tony Hutter Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12042 --- cmd/zed/zed.d/Makefile.am | 3 +++ cmd/zed/zed.d/all-debug.sh | 16 ++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 3eece353ef90..2c8173b3e769 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am @@ -52,3 +52,6 @@ install-data-hook: ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \ done chmod 0600 "$(DESTDIR)$(zedconfdir)/zed.rc" + +# 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}"' diff --git a/cmd/zed/zed.d/all-debug.sh b/cmd/zed/zed.d/all-debug.sh index 14b39caacd9d..824c9fe423d7 100755 --- a/cmd/zed/zed.d/all-debug.sh +++ b/cmd/zed/zed.d/all-debug.sh @@ -12,15 +12,11 @@ zed_exit_if_ignoring_this_event -lockfile="$(basename -- "${ZED_DEBUG_LOG}").lock" +zed_lock "${ZED_DEBUG_LOG}" +{ + printenv | sort + echo +} 1>&"${ZED_FLOCK_FD}" +zed_unlock "${ZED_DEBUG_LOG}" -umask 077 -zed_lock "${lockfile}" -exec >> "${ZED_DEBUG_LOG}" - -printenv | sort -echo - -exec >&- -zed_unlock "${lockfile}" exit 0 From 1fcfc21cd8cce3d44b2526f262be5c73e4d8621a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 14 May 2021 04:22:34 +0200 Subject: [PATCH 03/24] zed.d/history_event-zfs-list-cacher.sh.in: parallelise, simplify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This: (a) improves the error log message, (b) locks per pool instead of globally, (c) locks the actual output file instead of /var/lock/zfs-list, which would otherwise linger there forever (well, still will, but you can remove it and it won't come back), and (d) preserves attributes of the output file instead of reverting them to 0:0 644 It is imperative that the previous commit ("zed-functions.sh: zed_lock(): don't truncate lock") be included in any series that contains this one Reviewed-by: Tony Hutter Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12042 --- .../zed.d/history_event-zfs-list-cacher.sh.in | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in b/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in index 15f0a8ed6189..db40fa36d668 100755 --- a/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in +++ b/cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in @@ -3,9 +3,8 @@ # Track changes to enumerated pools for use in early-boot set -ef -FSLIST_DIR="@sysconfdir@/zfs/zfs-list.cache" -FSLIST_TMP="@runstatedir@/zfs-list.cache.new" -FSLIST="${FSLIST_DIR}/${ZEVENT_POOL}" +FSLIST="@sysconfdir@/zfs/zfs-list.cache/${ZEVENT_POOL}" +FSLIST_TMP="@runstatedir@/zfs-list.cache@${ZEVENT_POOL}" # If the pool specific cache file is not writeable, abort [ -w "${FSLIST}" ] || exit 0 @@ -19,15 +18,15 @@ zed_check_cmd "${ZFS}" sort diff # If we are acting on a snapshot, we have nothing to do [ "${ZEVENT_HISTORY_DSNAME%@*}" = "${ZEVENT_HISTORY_DSNAME}" ] || exit 0 -# We obtain a lock on zfs-list to avoid any simultaneous writes. +# We lock the output file to avoid simultaneous writes. # If we run into trouble, log and drop the lock abort_alter() { - zed_log_msg "Error updating zfs-list.cache!" - zed_unlock zfs-list + zed_log_msg "Error updating zfs-list.cache for ${ZEVENT_POOL}!" + zed_unlock "${FSLIST}" } finished() { - zed_unlock zfs-list + zed_unlock "${FSLIST}" trap - EXIT exit 0 } @@ -37,7 +36,7 @@ case "${ZEVENT_HISTORY_INTERNAL_NAME}" in ;; export) - zed_lock zfs-list + zed_lock "${FSLIST}" trap abort_alter EXIT echo > "${FSLIST}" finished @@ -63,7 +62,7 @@ case "${ZEVENT_HISTORY_INTERNAL_NAME}" in ;; esac -zed_lock zfs-list +zed_lock "${FSLIST}" trap abort_alter EXIT PROPS="name,mountpoint,canmount,atime,relatime,devices,exec\ @@ -79,7 +78,7 @@ PROPS="name,mountpoint,canmount,atime,relatime,devices,exec\ sort "${FSLIST_TMP}" -o "${FSLIST_TMP}" # Don't modify the file if it hasn't changed -diff -q "${FSLIST_TMP}" "${FSLIST}" || mv "${FSLIST_TMP}" "${FSLIST}" +diff -q "${FSLIST_TMP}" "${FSLIST}" || cat "${FSLIST_TMP}" > "${FSLIST}" rm -f "${FSLIST_TMP}" finished From 08cd0717359b1a18693e3c8e6d6e5a2819b35a48 Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Tue, 8 Jun 2021 20:20:16 -0400 Subject: [PATCH 04/24] Correct a flaw in the Python 3 version checking It turns out the ax_python_devel.m4 version check assumes that ("3.X+1.0" >= "3.X.0") is True in Python, which is not when X+1 is 10 or above and X is not. (Also presumably X+1=100 and ...) So let's remake the check to behave consistently, using the "packaging" or (if absent) the "distlib" modules. (Also, update the Github workflows to use the new packages.) Reviewed-by: Brian Behlendorf Reviewed-by: John Kennedy Signed-off-by: Rich Ercolani Closes: #12073 --- .github/workflows/zfs-tests-functional.yml | 3 +- .github/workflows/zfs-tests-sanity.yml | 3 +- .github/workflows/zloop.yml | 4 +-- config/always-pyzfs.m4 | 15 ++++++++++ config/ax_python_devel.m4 | 33 ++++++++++++++++++---- rpm/generic/zfs.spec.in | 5 ++++ 6 files changed, 53 insertions(+), 10 deletions(-) diff --git a/.github/workflows/zfs-tests-functional.yml b/.github/workflows/zfs-tests-functional.yml index d2b5764dbf80..eacc95ae1617 100644 --- a/.github/workflows/zfs-tests-functional.yml +++ b/.github/workflows/zfs-tests-functional.yml @@ -26,7 +26,8 @@ jobs: xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ libpam0g-dev pamtester python-dev python-setuptools python-cffi \ - python3 python3-dev python3-setuptools python3-cffi libcurl4-openssl-dev + python-packaging python3 python3-dev python3-setuptools python3-cffi \ + libcurl4-openssl-dev python3-packaging - name: Autogen.sh run: | sh autogen.sh diff --git a/.github/workflows/zfs-tests-sanity.yml b/.github/workflows/zfs-tests-sanity.yml index 9e2ed1b2f7cf..40a7f8ba511c 100644 --- a/.github/workflows/zfs-tests-sanity.yml +++ b/.github/workflows/zfs-tests-sanity.yml @@ -22,7 +22,8 @@ jobs: xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ libpam0g-dev pamtester python-dev python-setuptools python-cffi \ - python3 python3-dev python3-setuptools python3-cffi libcurl4-openssl-dev + python-packaging python3 python3-dev python3-setuptools python3-cffi \ + python3-packaging libcurl4-openssl-dev - name: Autogen.sh run: | sh autogen.sh diff --git a/.github/workflows/zloop.yml b/.github/workflows/zloop.yml index 30785b14507a..b3679e7f7f20 100644 --- a/.github/workflows/zloop.yml +++ b/.github/workflows/zloop.yml @@ -22,8 +22,8 @@ jobs: xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ libpam0g-dev \ - python-dev python-setuptools python-cffi \ - python3 python3-dev python3-setuptools python3-cffi + python-dev python-setuptools python-cffi python-packaging \ + python3 python3-dev python3-setuptools python3-cffi python3-packaging - name: Autogen.sh run: | sh autogen.sh diff --git a/config/always-pyzfs.m4 b/config/always-pyzfs.m4 index 76e07b593df2..fa39fd88519c 100644 --- a/config/always-pyzfs.m4 +++ b/config/always-pyzfs.m4 @@ -46,6 +46,21 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [ ]) AC_SUBST(DEFINE_PYZFS) + dnl # + dnl # Python "packaging" (or, failing that, "distlib") module is required to build and install pyzfs + dnl # + AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [ + ZFS_AC_PYTHON_MODULE([packaging], [], [ + ZFS_AC_PYTHON_MODULE([distlib], [], [ + AS_IF([test "x$enable_pyzfs" = xyes], [ + AC_MSG_ERROR("Python $PYTHON_VERSION packaging and distlib modules are not installed") + ], [test "x$enable_pyzfs" != xno], [ + enable_pyzfs=no + ]) + ]) + ]) + ]) + dnl # dnl # Require python-devel libraries dnl # diff --git a/config/ax_python_devel.m4 b/config/ax_python_devel.m4 index faf6c2b0d7ef..fcf73dc20880 100644 --- a/config/ax_python_devel.m4 +++ b/config/ax_python_devel.m4 @@ -97,9 +97,18 @@ AC_DEFUN([AX_PYTHON_DEVEL],[ # Check for a version of Python >= 2.1.0 # AC_MSG_CHECKING([for a version of Python >= '2.1.0']) - ac_supports_python_ver=`$PYTHON -c "import sys; \ - ver = sys.version.split ()[[0]]; \ - print (ver >= '2.1.0')"` + ac_supports_python_ver=`cat<= '3.11.0' + ac_supports_python_ver=`cat<= 8 || 0%{?centos} >= 8 || 0%{?fedora} >= 28 +BuildRequires: python3-packaging +%else +BuildRequires: python-packaging +%endif BuildRequires: python%{__python_pkg_version}-devel BuildRequires: %{__python_cffi_pkg} BuildRequires: %{__python_setuptools_pkg} From 88af959b24301e6fb39ce6ae8b66bdb7e817c710 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 9 Jun 2021 12:21:24 -0700 Subject: [PATCH 05/24] Fix minor shellcheck 0.7.2 warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first warning of a misspelling is a false positive, so we annotate the script accordingly. As for the x-prefix warnings update the check to use the conventional '[ -z ]' syntax. all-syslog.sh:46:47: warning: Possible misspelling: ZEVENT_ZIO_OBJECT may not be assigned, but ZEVENT_ZIO_OBJSET is. [SC2153] make_gitrev.sh:53:6: note: Avoid x-prefix in comparisons as it no longer serves a purpose [SC2268] man-dates.sh:10:7: note: Avoid x-prefix in comparisons as it no longer serves a purpose [SC2268] Reviewed-by: Ahelenia Ziemiańska Reviewed-by: John Kennedy Signed-off-by: Brian Behlendorf Closes #12208 --- cmd/zed/zed.d/all-syslog.sh | 1 + scripts/make_gitrev.sh | 2 +- scripts/man-dates.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/zed/zed.d/all-syslog.sh b/cmd/zed/zed.d/all-syslog.sh index 270b1bc67e5c..b07cf0f295ad 100755 --- a/cmd/zed/zed.d/all-syslog.sh +++ b/cmd/zed/zed.d/all-syslog.sh @@ -42,6 +42,7 @@ fi msg="${msg} delay=$((ZEVENT_ZIO_DELAY / 1000000))ms" # list the bookmark data together +# shellcheck disable=SC2153 [ -n "${ZEVENT_ZIO_OBJSET}" ] && \ msg="${msg} bookmark=${ZEVENT_ZIO_OBJSET}:${ZEVENT_ZIO_OBJECT}:${ZEVENT_ZIO_LEVEL}:${ZEVENT_ZIO_BLKID}" diff --git a/scripts/make_gitrev.sh b/scripts/make_gitrev.sh index da21455332ab..e7f4ce8844d5 100755 --- a/scripts/make_gitrev.sh +++ b/scripts/make_gitrev.sh @@ -50,7 +50,7 @@ esac ZFS_GITREV=$({ cd "${top_srcdir}" && git describe --always --long --dirty 2>/dev/null; } || :) -if [ "x${ZFS_GITREV}" = x ] +if [ -z "${ZFS_GITREV}" ] then # If the source directory is not a git repository, check if the file # already exists (in the source) diff --git a/scripts/man-dates.sh b/scripts/man-dates.sh index 186d94639a56..39f1b5fb1324 100755 --- a/scripts/man-dates.sh +++ b/scripts/man-dates.sh @@ -7,6 +7,6 @@ set -eu find man -type f | while read -r i ; do git_date=$(git log -1 --date=short --format="%ad" -- "$i") - [ "x$git_date" = "x" ] && continue + [ -z "$git_date" ] && continue sed -i "s|^\.Dd.*|.Dd $(date -d "$git_date" "+%B %-d, %Y")|" "$i" done From b0f3e8a6ebe10a9098c7a984ae14c6fc9b0e0d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 31 May 2021 14:10:11 +0200 Subject: [PATCH 06/24] man: use one Makefile, use OpenZFS for .Os MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prevailing style is to use either nothing, or the originating organisational umbrella (here: OpenZFS), and these aren't Linux manpages This also deduplicates the substitution code, and makes adding/removing sexions simpler in future Reviewed-by: Richard Laager Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12212 --- configure.ac | 3 -- man/Makefile.am | 117 ++++++++++++++++++++++++++++++++++++++++++- man/man1/Makefile.am | 12 ----- man/man5/Makefile.am | 16 ------ man/man8/Makefile.am | 102 ------------------------------------- 5 files changed, 116 insertions(+), 134 deletions(-) delete mode 100644 man/man1/Makefile.am delete mode 100644 man/man5/Makefile.am delete mode 100644 man/man8/Makefile.am diff --git a/configure.ac b/configure.ac index 077ad7c43f4d..27409c82f396 100644 --- a/configure.ac +++ b/configure.ac @@ -171,9 +171,6 @@ AC_CONFIG_FILES([ lib/libzstd/Makefile lib/libzutil/Makefile man/Makefile - man/man1/Makefile - man/man5/Makefile - man/man8/Makefile module/Kbuild module/Makefile module/avl/Makefile diff --git a/man/Makefile.am b/man/Makefile.am index 841cb9c4e6a0..4ad4aeaa406e 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1 +1,116 @@ -SUBDIRS = man1 man5 man8 +include $(top_srcdir)/config/Substfiles.am + +EXTRA_DIST += \ + man1/cstyle.1 + +dist_man_MANS = \ + man1/zhack.1 \ + man1/ztest.1 \ + man1/raidz_test.1 \ + man1/zvol_wait.1 \ + man1/arcstat.1 \ + \ + man5/vdev_id.conf.5 \ + man5/zpool-features.5 \ + man5/spl-module-parameters.5 \ + man5/zfs-module-parameters.5 \ + man5/zfs-events.5 \ + \ + man8/fsck.zfs.8 \ + man8/mount.zfs.8 \ + man8/vdev_id.8 \ + man8/zdb.8 \ + man8/zfs.8 \ + man8/zfsconcepts.8 \ + man8/zfsprops.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/zpoolconcepts.8 \ + man8/zpoolprops.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 + +nodist_man_MANS = \ + man8/zed.8 \ + man8/zfs-mount-generator.8 + +SUBSTFILES += $(nodist_man_MANS) + + +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) +endif diff --git a/man/man1/Makefile.am b/man/man1/Makefile.am deleted file mode 100644 index 8d7457a3e258..000000000000 --- a/man/man1/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -dist_man_MANS = zhack.1 ztest.1 raidz_test.1 zvol_wait.1 arcstat.1 -EXTRA_DIST = cstyle.1 - -if BUILD_LINUX -# The man pager in most Linux distros defaults to BSD instead of Linux -# 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)/man1; \ - $(SED) ${ac_inplace} -e 's/^\.Os$$/.Os Linux/' \ - $(dist_man_MANS) -endif diff --git a/man/man5/Makefile.am b/man/man5/Makefile.am deleted file mode 100644 index 9cbb2c08f378..000000000000 --- a/man/man5/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -dist_man_MANS = \ - vdev_id.conf.5 \ - zpool-features.5 \ - spl-module-parameters.5 \ - zfs-module-parameters.5 \ - zfs-events.5 - -if BUILD_LINUX -# The man pager in most Linux distros defaults to BSD instead of Linux -# 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)/man5; \ - $(SED) ${ac_inplace} -e 's/^\.Os$$/.Os Linux/' \ - $(dist_man_MANS) -endif diff --git a/man/man8/Makefile.am b/man/man8/Makefile.am deleted file mode 100644 index 602645180beb..000000000000 --- a/man/man8/Makefile.am +++ /dev/null @@ -1,102 +0,0 @@ -include $(top_srcdir)/config/Substfiles.am - -dist_man_MANS = \ - fsck.zfs.8 \ - mount.zfs.8 \ - vdev_id.8 \ - zdb.8 \ - zfs.8 \ - zfsconcepts.8 \ - zfsprops.8 \ - zfs-allow.8 \ - zfs-bookmark.8 \ - zfs-change-key.8 \ - zfs-clone.8 \ - zfs-create.8 \ - zfs-destroy.8 \ - zfs-diff.8 \ - zfs-get.8 \ - zfs-groupspace.8 \ - zfs-hold.8 \ - zfs-inherit.8 \ - zfs-jail.8 \ - zfs-list.8 \ - zfs-load-key.8 \ - zfs-mount.8 \ - zfs-program.8 \ - zfs-project.8 \ - zfs-projectspace.8 \ - zfs-promote.8 \ - zfs-receive.8 \ - zfs-recv.8 \ - zfs-redact.8 \ - zfs-release.8 \ - zfs-rename.8 \ - zfs-rollback.8 \ - zfs-send.8 \ - zfs-set.8 \ - zfs-share.8 \ - zfs-snapshot.8 \ - zfs-unallow.8 \ - zfs-unjail.8 \ - zfs-unload-key.8 \ - zfs-unmount.8 \ - zfs-upgrade.8 \ - zfs-userspace.8 \ - zfs-wait.8 \ - zfs_ids_to_path.8 \ - zgenhostid.8 \ - zinject.8 \ - zpool.8 \ - zpoolconcepts.8 \ - zpoolprops.8 \ - zpool-add.8 \ - zpool-attach.8 \ - zpool-checkpoint.8 \ - zpool-clear.8 \ - zpool-create.8 \ - zpool-destroy.8 \ - zpool-detach.8 \ - zpool-events.8 \ - zpool-export.8 \ - zpool-get.8 \ - zpool-history.8 \ - zpool-import.8 \ - zpool-initialize.8 \ - zpool-iostat.8 \ - zpool-labelclear.8 \ - zpool-list.8 \ - zpool-offline.8 \ - zpool-online.8 \ - zpool-reguid.8 \ - zpool-remove.8 \ - zpool-reopen.8 \ - zpool-replace.8 \ - zpool-resilver.8 \ - zpool-scrub.8 \ - zpool-set.8 \ - zpool-split.8 \ - zpool-status.8 \ - zpool-sync.8 \ - zpool-trim.8 \ - zpool-upgrade.8 \ - zpool-wait.8 \ - zstream.8 \ - zstreamdump.8 \ - zpool_influxdb.8 - -nodist_man_MANS = \ - zed.8 \ - zfs-mount-generator.8 - -SUBSTFILES += $(nodist_man_MANS) - -if BUILD_LINUX -# The man pager in most Linux distros defaults to BSD instead of Linux -# 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)/man8; \ - $(SED) ${ac_inplace} -e 's/^\.Os$$/.Os Linux/' \ - $(dist_man_MANS) $(nodist_man_MANS) -endif From 2badb3457ad396b3c2d282d7a9eae90259b15a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 4 Jun 2021 22:29:26 +0200 Subject: [PATCH 07/24] Move properties, parameters, events, and concepts around manual sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pages moved as follows: zpool-features.{5 => 7} spl{-module-parameters.5 => .4} zfs{-module-parameters.5 => .4} zfs-events.5 => into zpool-events.8 zfsconcepts.{8 => 7} zfsprops.{8 => 7} zpoolconcepts.{8 => 7} zpoolprops.{8 => 7} Reviewed-by: Richard Laager Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Co-authored-by: Daniel Ebdrup Jensen Closes #12149 Closes #12212 --- cmd/zpool/zpool_main.c | 6 +- .../ZFS-pool-latency-heatmaps-influxdb.json | 4 +- man/Makefile.am | 17 +- man/man1/zhack.1 | 2 +- man/man1/ztest.1 | 2 +- .../spl-module-parameters.5 => man4/spl.4} | 5 +- .../zfs-module-parameters.5 => man4/zfs.4} | 7 +- man/man5/zfs-events.5 | 448 ------------------ .../zfsconcepts.8 => man7/zfsconcepts.7} | 2 +- man/{man8/zfsprops.8 => man7/zfsprops.7} | 22 +- .../zpool-features.7} | 4 +- .../zpoolconcepts.8 => man7/zpoolconcepts.7} | 4 +- man/{man8/zpoolprops.8 => man7/zpoolprops.7} | 14 +- man/man8/mount.zfs.8 | 2 +- man/man8/zed.8.in | 1 - man/man8/zfs-bookmark.8 | 2 +- man/man8/zfs-clone.8 | 2 +- man/man8/zfs-create.8 | 2 +- man/man8/zfs-jail.8 | 4 +- man/man8/zfs-list.8 | 8 +- man/man8/zfs-load-key.8 | 4 +- man/man8/zfs-mount-generator.8.in | 4 +- man/man8/zfs-mount.8 | 2 +- man/man8/zfs-receive.8 | 2 +- man/man8/zfs-send.8 | 8 +- man/man8/zfs-set.8 | 12 +- man/man8/zfs-share.8 | 2 +- man/man8/zfs-snapshot.8 | 2 +- man/man8/zfs-upgrade.8 | 2 +- man/man8/zfs-userspace.8 | 4 +- man/man8/zfs.8 | 10 +- man/man8/zgenhostid.8 | 2 +- man/man8/zpool-add.8 | 4 +- man/man8/zpool-attach.8 | 2 +- man/man8/zpool-create.8 | 14 +- man/man8/zpool-events.8 | 422 ++++++++++++++++- man/man8/zpool-get.8 | 10 +- man/man8/zpool-import.8 | 4 +- man/man8/zpool-list.8 | 2 +- man/man8/zpool-remove.8 | 2 +- man/man8/zpool-replace.8 | 2 +- man/man8/zpool-split.8 | 2 +- man/man8/zpool-status.8 | 2 +- man/man8/zpool-sync.8 | 4 +- man/man8/zpool-trim.8 | 4 +- man/man8/zpool-upgrade.8 | 12 +- man/man8/zpool.8 | 21 +- rpm/generic/zfs.spec.in | 2 + scripts/zol2zfs-patch.sed | 2 +- .../functional/l2arc/l2arc_mfuonly_pos.ksh | 2 +- 50 files changed, 543 insertions(+), 582 deletions(-) rename man/{man5/spl-module-parameters.5 => man4/spl.4} (99%) rename man/{man5/zfs-module-parameters.5 => man4/zfs.4} (99%) delete mode 100644 man/man5/zfs-events.5 rename man/{man8/zfsconcepts.8 => man7/zfsconcepts.7} (99%) rename man/{man8/zfsprops.8 => man7/zfsprops.7} (99%) rename man/{man5/zpool-features.5 => man7/zpool-features.7} (99%) rename man/{man8/zpoolconcepts.8 => man7/zpoolconcepts.7} (99%) rename man/{man8/zpoolprops.8 => man7/zpoolprops.7} (98%) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 02415b157935..35a59710c05e 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -533,7 +533,7 @@ usage(boolean_t requested) (void) fprintf(fp, "YES disabled | enabled | active\n"); (void) fprintf(fp, gettext("\nThe feature@ properties must be " - "appended with a feature name.\nSee zpool-features(5).\n")); + "appended with a feature name.\nSee zpool-features(7).\n")); } /* @@ -8248,7 +8248,7 @@ status_callback(zpool_handle_t *zhp, void *data) printf_color(ANSI_YELLOW, gettext("Enable all features using " "'zpool upgrade'. Once this is done,\n\tthe pool may no " "longer be accessible by software that does not support\n\t" - "the features. See zpool-features(5) for details.\n")); + "the features. See zpool-features(7) for details.\n")); break; case ZPOOL_STATUS_COMPATIBILITY_ERR: @@ -8951,7 +8951,7 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg) "pool may become incompatible with " "software\nthat does not support " "the feature. See " - "zpool-features(5) for " + "zpool-features(7) for " "details.\n\n" "Note that the pool " "'compatibility' feature can be " diff --git a/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json b/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json index a99f92783bc4..70260ae40814 100644 --- a/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json +++ b/cmd/zpool_influxdb/dashboards/grafana/ZFS-pool-latency-heatmaps-influxdb.json @@ -1360,7 +1360,7 @@ "type": "row" }, { - "content": "I/O requests that are satisfied by accessing pool devices are managed by the ZIO scheduler.\nThe total latency is measured from the start of the I/O to completion by the disk.\nLatency through each queue is shown prior to its submission to the disk queue.\n\nThis view is useful for observing the effects of tuning the ZIO scheduler min and max values\n(see zfs-module-parameters(5) and [ZFS on Linux Module Parameters](https://openzfs.github.io/openzfs-docs/Performance%20and%20tuning/ZFS%20on%20Linux%20Module%20Parameters.html)):\n+ *zfs_vdev_max_active* controls the ZIO scheduler's disk queue depth (do not confuse with the block device's nr_requests)\n+ *zfs_vdev_sync_read_min_active* and *zfs_vdev_sync_read_max_active* control the synchronous queue for reads: most reads are sync\n+ *zfs_vdev_sync_write_min_active* and *zfs_vdev_sync_write_max_active* control the synchronous queue for writes: \nusually metadata or user data depending on the \"sync\" property setting or I/Os that are requested to be flushed\n+ *zfs_vdev_async_read_min_active* and *zfs_vdev_async_read_max_active* control the asynchronous queue for reads: usually prefetches\n+ *zfs_vdev_async_write_min_active* and *zfs_vdev_async_write_max_active* control the asynchronous queue for writes: \nusually the bulk of all writes at transaction group (txg) commit\n+ *zfs_vdev_scrub_min_active* and *zfs_vdev_scrub_max_active* controls the scan reads: usually scrub or resilver\n\n", + "content": "I/O requests that are satisfied by accessing pool devices are managed by the ZIO scheduler.\nThe total latency is measured from the start of the I/O to completion by the disk.\nLatency through each queue is shown prior to its submission to the disk queue.\n\nThis view is useful for observing the effects of tuning the ZIO scheduler min and max values\n(see zfs(4) and [ZFS on Linux Module Parameters](https://openzfs.github.io/openzfs-docs/Performance%20and%20tuning/ZFS%20on%20Linux%20Module%20Parameters.html)):\n+ *zfs_vdev_max_active* controls the ZIO scheduler's disk queue depth (do not confuse with the block device's nr_requests)\n+ *zfs_vdev_sync_read_min_active* and *zfs_vdev_sync_read_max_active* control the synchronous queue for reads: most reads are sync\n+ *zfs_vdev_sync_write_min_active* and *zfs_vdev_sync_write_max_active* control the synchronous queue for writes: \nusually metadata or user data depending on the \"sync\" property setting or I/Os that are requested to be flushed\n+ *zfs_vdev_async_read_min_active* and *zfs_vdev_async_read_max_active* control the asynchronous queue for reads: usually prefetches\n+ *zfs_vdev_async_write_min_active* and *zfs_vdev_async_write_max_active* control the asynchronous queue for writes: \nusually the bulk of all writes at transaction group (txg) commit\n+ *zfs_vdev_scrub_min_active* and *zfs_vdev_scrub_max_active* controls the scan reads: usually scrub or resilver\n\n", "datasource": "${DS_MACBOOK-INFLUX}", "fieldConfig": { "defaults": { @@ -1664,4 +1664,4 @@ "list": [] }, "version": 2 -} \ No newline at end of file +} diff --git a/man/Makefile.am b/man/Makefile.am index 4ad4aeaa406e..8ab1b757242c 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -11,18 +11,21 @@ dist_man_MANS = \ man1/arcstat.1 \ \ man5/vdev_id.conf.5 \ - man5/zpool-features.5 \ - man5/spl-module-parameters.5 \ - man5/zfs-module-parameters.5 \ - man5/zfs-events.5 \ + \ + man4/spl.4 \ + man4/zfs.4 \ + \ + man7/zpool-features.7 \ + man7/zfsconcepts.7 \ + man7/zfsprops.7 \ + man7/zpoolconcepts.7 \ + man7/zpoolprops.7 \ \ man8/fsck.zfs.8 \ man8/mount.zfs.8 \ man8/vdev_id.8 \ man8/zdb.8 \ man8/zfs.8 \ - man8/zfsconcepts.8 \ - man8/zfsprops.8 \ man8/zfs-allow.8 \ man8/zfs-bookmark.8 \ man8/zfs-change-key.8 \ @@ -63,8 +66,6 @@ dist_man_MANS = \ man8/zgenhostid.8 \ man8/zinject.8 \ man8/zpool.8 \ - man8/zpoolconcepts.8 \ - man8/zpoolprops.8 \ man8/zpool-add.8 \ man8/zpool-attach.8 \ man8/zpool-checkpoint.8 \ diff --git a/man/man1/zhack.1 b/man/man1/zhack.1 index e2fc189b4d0d..b18b3a4c0996 100644 --- a/man/man1/zhack.1 +++ b/man/man1/zhack.1 @@ -138,5 +138,5 @@ descriptions_obj: . .Sh SEE ALSO .Xr ztest 1 , -.Xr zpool-features 5 , +.Xr zpool-features 7 , .Xr zfs 8 diff --git a/man/man1/ztest.1 b/man/man1/ztest.1 index 459486c286bf..fd1374a2f106 100644 --- a/man/man1/ztest.1 +++ b/man/man1/ztest.1 @@ -230,4 +230,4 @@ By default the stack size is limited to .Xr zdb 1 , .Xr zfs 1 , .Xr zpool 1 , -.Xr spl-module-parameters 5 +.Xr spl 4 diff --git a/man/man5/spl-module-parameters.5 b/man/man4/spl.4 similarity index 99% rename from man/man5/spl-module-parameters.5 rename to man/man4/spl.4 index 88652a75ae43..11cde14ae5ca 100644 --- a/man/man5/spl-module-parameters.5 +++ b/man/man4/spl.4 @@ -15,11 +15,11 @@ .\" Copyright 2013 Turbo Fredriksson . All rights reserved. .\" .Dd August 24, 2020 -.Dt SPL-MODULE-PARAMETERS 5 +.Dt SPL 4 .Os . .Sh NAME -.Nm spl-module-parameters +.Nm spl .Nd parameters of the SPL kernel module . .Sh DESCRIPTION @@ -192,5 +192,4 @@ The proc file will walk the lists with lock held, reading it could cause a lock-up if the list grow too large without limiting the output. "(truncated)" will be shown if the list is larger than the limit. -. .El diff --git a/man/man5/zfs-module-parameters.5 b/man/man4/zfs.4 similarity index 99% rename from man/man5/zfs-module-parameters.5 rename to man/man4/zfs.4 index 6dbf2749f3b7..6da8d42b42bd 100644 --- a/man/man5/zfs-module-parameters.5 +++ b/man/man4/zfs.4 @@ -16,14 +16,15 @@ .\" Portions Copyright [yyyy] [name of copyright owner] .\" .Dd June 1, 2021 -.Dt ZFS-MODULE-PARAMETERS 5 +.Dt ZFS 4 .Os . .Sh NAME -.Nm zfs-module-parameters -.Nd parameters of the ZFS kernel module +.Nm zfs +.Nd tuning of the ZFS kernel module . .Sh DESCRIPTION +The ZFS module supports these parameters: .Bl -tag -width Ds .It Sy dbuf_cache_max_bytes Ns = Ns Sy ULONG_MAX Ns B Pq ulong Maximum size in bytes of the dbuf cache. diff --git a/man/man5/zfs-events.5 b/man/man5/zfs-events.5 deleted file mode 100644 index 846a7080d01c..000000000000 --- a/man/man5/zfs-events.5 +++ /dev/null @@ -1,448 +0,0 @@ -.\" -.\" Copyright (c) 2013 by Turbo Fredriksson . All rights reserved. -.\" Portions Copyright 2018 by Richard Elling -.\" 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] -.\" -.Dd May 26, 2021 -.Dt ZFS-EVENTS 5 -.Os -. -.Sh NAME -.Nm zfs-events -.Nd Events created by the ZFS filesystem -.Sh DESCRIPTION -Description of the different events generated by the ZFS stack. -.Pp -Most of these don't have any description. -The events generated by ZFS have never been publicly documented. -What is here is intended as a starting point to provide documentation -for all possible events. -.Pp -To view all events created since the loading of the ZFS infrastructure -(i.e, "the module"), run -.Dl Nm zpool Cm events -to get a short list, and -.Dl Nm zpool Cm events Fl v -to get a full detail of the events and what information -is available about it. -.Pp -This manual page lists the different subclasses that are issued -in the case of an event. -The full event name would be -.Sy ereport.fs.zfs.\& Ns Em SUBCLASS , -but we only list the last part here. -. -.Sh EVENTS (SUBCLASS) -.Bl -tag -compact -width "vdev.bad_guid_sum" -.It Sy checksum -Issued when a checksum error has been detected. -.It Sy io -Issued when there is an I/O error in a vdev in the pool. -.It Sy data -Issued when there have been data errors in the pool. -.It Sy deadman -Issued when an I/O request is determined to be "hung", this can be caused -by lost completion events due to flaky hardware or drivers. -See -.Sy zfs_deadman_failmode -in -.Xr zfs-module-parameters 5 -for additional information regarding "hung" I/O detection and configuration. -.It Sy delay -Issued when a completed I/O request exceeds the maximum allowed time -specified by the -.Sy zio_slow_io_ms -module parameter. -This can be an indicator of problems with the underlying storage device. -The number of delay events is ratelimited by the -.Sy zfs_slow_io_events_per_second -module parameter. -.It Sy config -Issued every time a vdev change have been done to the pool. -.It Sy zpool -Issued when a pool cannot be imported. -.It Sy zpool.destroy -Issued when a pool is destroyed. -.It Sy zpool.export -Issued when a pool is exported. -.It Sy zpool.import -Issued when a pool is imported. -.It Sy zpool.reguid -Issued when a REGUID (new unique identifier for the pool have been regenerated) have been detected. -.It Sy vdev.unknown -Issued when the vdev is unknown. -Such as trying to clear device errors on a vdev that have failed/been kicked -from the system/pool and is no longer available. -.It Sy vdev.open_failed -Issued when a vdev could not be opened (because it didn't exist for example). -.It Sy vdev.corrupt_data -Issued when corrupt data have been detected on a vdev. -.It Sy vdev.no_replicas -Issued when there are no more replicas to sustain the pool. -This would lead to the pool being -.Em DEGRADED . -.It Sy vdev.bad_guid_sum -Issued when a missing device in the pool have been detected. -.It Sy vdev.too_small -Issued when the system (kernel) have removed a device, and ZFS -notices that the device isn't there any more. -This is usually followed by a -.Sy probe_failure -event. -.It Sy vdev.bad_label -Issued when the label is OK but invalid. -.It Sy vdev.bad_ashift -Issued when the ashift alignment requirement has increased. -.It Sy vdev.remove -Issued when a vdev is detached from a mirror (or a spare detached from a -vdev where it have been used to replace a failed drive - only works if -the original drive have been readded). -.It Sy vdev.clear -Issued when clearing device errors in a pool. -Such as running -.Nm zpool Cm clear -on a device in the pool. -.It Sy vdev.check -Issued when a check to see if a given vdev could be opened is started. -.It Sy vdev.spare -Issued when a spare have kicked in to replace a failed device. -.It Sy vdev.autoexpand -Issued when a vdev can be automatically expanded. -.It Sy io_failure -Issued when there is an I/O failure in a vdev in the pool. -.It Sy probe_failure -Issued when a probe fails on a vdev. -This would occur if a vdev -have been kicked from the system outside of ZFS (such as the kernel -have removed the device). -.It Sy log_replay -Issued when the intent log cannot be replayed. -The can occur in the case of a missing or damaged log device. -.It Sy resilver.start -Issued when a resilver is started. -.It Sy resilver.finish -Issued when the running resilver have finished. -.It Sy scrub.start -Issued when a scrub is started on a pool. -.It Sy scrub.finish -Issued when a pool has finished scrubbing. -.It Sy scrub.abort -Issued when a scrub is aborted on a pool. -.It Sy scrub.resume -Issued when a scrub is resumed on a pool. -.It Sy scrub.paused -Issued when a scrub is paused on a pool. -.It Sy bootfs.vdev.attach -.El -. -.Sh PAYLOADS -This is the payload (data, information) that accompanies an -event. -.Pp -For -.Xr zed 8 , -these are set to uppercase and prefixed with -.Sy ZEVENT_ . -.Bl -tag -compact -width "vdev_cksum_errors" -.It Sy pool -Pool name. -.It Sy pool_failmode -Failmode - -.Sy wait , -.Sy continue , -or -.Sy panic . -See the -.Sy failmode -property in -.Xr zpoolprops 8 -for more information. -.It Sy pool_guid -The GUID of the pool. -.It Sy pool_context -The load state for the pool (0=none, 1=open, 2=import, 3=tryimport, 4=recover -5=error). -.It Sy vdev_guid -The GUID of the vdev in question (the vdev failing or operated upon with -.Nm zpool Cm clear , -etc.). -.It Sy vdev_type -Type of vdev - -.Sy disk , -.Sy file , -.Sy mirror , -etc. -See the -.Sy Virtual Devices -section of -.Xr zpoolconcepts 8 -for more information on possible values. -.It Sy vdev_path -Full path of the vdev, including any -.Em -partX . -.It Sy vdev_devid -ID of vdev (if any). -.It Sy vdev_fru -Physical FRU location. -.It Sy vdev_state -State of vdev (0=uninitialized, 1=closed, 2=offline, 3=removed, 4=failed to open, 5=faulted, 6=degraded, 7=healthy). -.It Sy vdev_ashift -The ashift value of the vdev. -.It Sy vdev_complete_ts -The time the last I/O request completed for the specified vdev. -.It Sy vdev_delta_ts -The time since the last I/O request completed for the specified vdev. -.It Sy vdev_spare_paths -List of spares, including full path and any -.Em -partX . -.It Sy vdev_spare_guids -GUID(s) of spares. -.It Sy vdev_read_errors -How many read errors that have been detected on the vdev. -.It Sy vdev_write_errors -How many write errors that have been detected on the vdev. -.It Sy vdev_cksum_errors -How many checksum errors that have been detected on the vdev. -.It Sy parent_guid -GUID of the vdev parent. -.It Sy parent_type -Type of parent. -See -.Sy vdev_type . -.It Sy parent_path -Path of the vdev parent (if any). -.It Sy parent_devid -ID of the vdev parent (if any). -.It Sy zio_objset -The object set number for a given I/O request. -.It Sy zio_object -The object number for a given I/O request. -.It Sy zio_level -The indirect level for the block. -Level 0 is the lowest level and includes data blocks. -Values > 0 indicate metadata blocks at the appropriate level. -.It Sy zio_blkid -The block ID for a given I/O request. -.It Sy zio_err -The error number for a failure when handling a given I/O request, -compatible with -.Xr errno 3 -with the value of -.Sy EBADE -used to indicate a ZFS checksum error. -.It Sy zio_offset -The offset in bytes of where to write the I/O request for the specified vdev. -.It Sy zio_size -The size in bytes of the I/O request. -.It Sy zio_flags -The current flags describing how the I/O request should be handled. -See the -.Sy I/O FLAGS -section for the full list of I/O flags. -.It Sy zio_stage -The current stage of the I/O in the pipeline. -See the -.Sy I/O STAGES -section for a full list of all the I/O stages. -.It Sy zio_pipeline -The valid pipeline stages for the I/O. -See the -.Sy I/O STAGES -section for a full list of all the I/O stages. -.It Sy zio_delay -The time elapsed (in nanoseconds) waiting for the block layer to complete the -I/O request. -Unlike -.Sy zio_delta , -this does not include any vdev queuing time and is -therefore solely a measure of the block layer performance. -.It Sy zio_timestamp -The time when a given I/O request was submitted. -.It Sy zio_delta -The time required to service a given I/O request. -.It Sy prev_state -The previous state of the vdev. -.It Sy cksum_expected -The expected checksum value for the block. -.It Sy cksum_actual -The actual checksum value for an errant block. -.It Sy cksum_algorithm -Checksum algorithm used. -See -.Xr zfsprops 8 -for more information on the available checksum algorithms. -.It Sy cksum_byteswap -Whether or not the data is byteswapped. -.It Sy bad_ranges -.No [\& Ns Ar start , end ) -pairs of corruption offsets. -Offsets are always aligned on a 64-bit boundary, -and can include some gaps of non-corruption. -(See -.Sy bad_ranges_min_gap ) -.It Sy bad_ranges_min_gap -In order to bound the size of the -.Sy bad_ranges -array, gaps of non-corruption -less than or equal to -.Sy bad_ranges_min_gap -bytes have been merged with -adjacent corruption. -Always at least 8 bytes, since corruption is detected on a 64-bit word basis. -.It Sy bad_range_sets -This array has one element per range in -.Sy bad_ranges . -Each element contains -the count of bits in that range which were clear in the good data and set -in the bad data. -.It Sy bad_range_clears -This array has one element per range in -.Sy bad_ranges . -Each element contains -the count of bits for that range which were set in the good data and clear in -the bad data. -.It Sy bad_set_bits -If this field exists, it is an array of -.Pq Ar bad data No & ~( Ns Ar good data ) ; -that is, the bits set in the bad data which are cleared in the good data. -Each element corresponds a byte whose offset is in a range in -.Sy bad_ranges , -and the array is ordered by offset. -Thus, the first element is the first byte in the first -.Sy bad_ranges -range, and the last element is the last byte in the last -.Sy bad_ranges -range. -.It Sy bad_cleared_bits -Like -.Sy bad_set_bits , -but contains -.Pq Ar good data No & ~( Ns Ar bad data ) ; -that is, the bits set in the good data which are cleared in the bad data. -.It Sy bad_set_histogram -If this field exists, it is an array of counters. -Each entry counts bits set in a particular bit of a big-endian uint64 type. -The first entry counts bits -set in the high-order bit of the first byte, the 9th byte, etc, and the last -entry counts bits set of the low-order bit of the 8th byte, the 16th byte, etc. -This information is useful for observing a stuck bit in a parallel data path, -such as IDE or parallel SCSI. -.It Sy bad_cleared_histogram -If this field exists, it is an array of counters. -Each entry counts bit clears in a particular bit of a big-endian uint64 type. -The first entry counts bits -clears of the high-order bit of the first byte, the 9th byte, etc, and the -last entry counts clears of the low-order bit of the 8th byte, the 16th byte, etc. -This information is useful for observing a stuck bit in a parallel data -path, such as IDE or parallel SCSI. -.El -. -.Sh I/O STAGES -The ZFS I/O pipeline is comprised of various stages which are defined below. -The individual stages are used to construct these basic I/O -operations: Read, Write, Free, Claim, and Ioctl. -These stages may be -set on an event to describe the life cycle of a given I/O request. -.Pp -.TS -tab(:); -l l l . -Stage:Bit Mask:Operations -_:_:_ -ZIO_STAGE_OPEN:0x00000001:RWFCI - -ZIO_STAGE_READ_BP_INIT:0x00000002:R---- -ZIO_STAGE_WRITE_BP_INIT:0x00000004:-W--- -ZIO_STAGE_FREE_BP_INIT:0x00000008:--F-- -ZIO_STAGE_ISSUE_ASYNC:0x00000010:RWF-- -ZIO_STAGE_WRITE_COMPRESS:0x00000020:-W--- - -ZIO_STAGE_ENCRYPT:0x00000040:-W--- -ZIO_STAGE_CHECKSUM_GENERATE:0x00000080:-W--- - -ZIO_STAGE_NOP_WRITE:0x00000100:-W--- - -ZIO_STAGE_DDT_READ_START:0x00000200:R---- -ZIO_STAGE_DDT_READ_DONE:0x00000400:R---- -ZIO_STAGE_DDT_WRITE:0x00000800:-W--- -ZIO_STAGE_DDT_FREE:0x00001000:--F-- - -ZIO_STAGE_GANG_ASSEMBLE:0x00002000:RWFC- -ZIO_STAGE_GANG_ISSUE:0x00004000:RWFC- - -ZIO_STAGE_DVA_THROTTLE:0x00008000:-W--- -ZIO_STAGE_DVA_ALLOCATE:0x00010000:-W--- -ZIO_STAGE_DVA_FREE:0x00020000:--F-- -ZIO_STAGE_DVA_CLAIM:0x00040000:---C- - -ZIO_STAGE_READY:0x00080000:RWFCI - -ZIO_STAGE_VDEV_IO_START:0x00100000:RW--I -ZIO_STAGE_VDEV_IO_DONE:0x00200000:RW--I -ZIO_STAGE_VDEV_IO_ASSESS:0x00400000:RW--I - -ZIO_STAGE_CHECKSUM_VERIFY:0x00800000:R---- - -ZIO_STAGE_DONE:0x01000000:RWFCI -.TE -. -.Sh I/O FLAGS -Every I/O request in the pipeline contains a set of flags which describe its -function and are used to govern its behavior. -These flags will be set in an event as a -.Sy zio_flags -payload entry. -.Pp -.TS -tab(:); -l l . -Flag:Bit Mask -_:_ -ZIO_FLAG_DONT_AGGREGATE:0x00000001 -ZIO_FLAG_IO_REPAIR:0x00000002 -ZIO_FLAG_SELF_HEAL:0x00000004 -ZIO_FLAG_RESILVER:0x00000008 -ZIO_FLAG_SCRUB:0x00000010 -ZIO_FLAG_SCAN_THREAD:0x00000020 -ZIO_FLAG_PHYSICAL:0x00000040 - -ZIO_FLAG_CANFAIL:0x00000080 -ZIO_FLAG_SPECULATIVE:0x00000100 -ZIO_FLAG_CONFIG_WRITER:0x00000200 -ZIO_FLAG_DONT_RETRY:0x00000400 -ZIO_FLAG_DONT_CACHE:0x00000800 -ZIO_FLAG_NODATA:0x00001000 -ZIO_FLAG_INDUCE_DAMAGE:0x00002000 - -ZIO_FLAG_IO_ALLOCATING:0x00004000 -ZIO_FLAG_IO_RETRY:0x00008000 -ZIO_FLAG_PROBE:0x00010000 -ZIO_FLAG_TRYHARD:0x00020000 -ZIO_FLAG_OPTIONAL:0x00040000 - -ZIO_FLAG_DONT_QUEUE:0x00080000 -ZIO_FLAG_DONT_PROPAGATE:0x00100000 -ZIO_FLAG_IO_BYPASS:0x00200000 -ZIO_FLAG_IO_REWRITE:0x00400000 -ZIO_FLAG_RAW_COMPRESS:0x00800000 -ZIO_FLAG_RAW_ENCRYPT:0x01000000 - -ZIO_FLAG_GANG_CHILD:0x02000000 -ZIO_FLAG_DDT_CHILD:0x04000000 -ZIO_FLAG_GODFATHER:0x08000000 -ZIO_FLAG_NOPWRITE:0x10000000 -ZIO_FLAG_REEXECUTED:0x20000000 -ZIO_FLAG_DELEGATED:0x40000000 -ZIO_FLAG_FASTWRITE:0x80000000 -.TE diff --git a/man/man8/zfsconcepts.8 b/man/man7/zfsconcepts.7 similarity index 99% rename from man/man8/zfsconcepts.8 rename to man/man7/zfsconcepts.7 index 3403d53bf8e7..f958035f72df 100644 --- a/man/man8/zfsconcepts.8 +++ b/man/man7/zfsconcepts.7 @@ -30,7 +30,7 @@ .\" Copyright 2019 Joyent, Inc. .\" .Dd June 30, 2019 -.Dt ZFSCONCEPTS 8 +.Dt ZFSCONCEPTS 7 .Os . .Sh NAME diff --git a/man/man8/zfsprops.8 b/man/man7/zfsprops.7 similarity index 99% rename from man/man8/zfsprops.8 rename to man/man7/zfsprops.7 index 1b985c98e248..3f3ddcebf320 100644 --- a/man/man8/zfsprops.8 +++ b/man/man7/zfsprops.7 @@ -38,7 +38,7 @@ .\" Copyright (c) 2019, Kjeld Schouten-Lebbing .\" .Dd May 24, 2021 -.Dt ZFSPROPS 8 +.Dt ZFSPROPS 7 .Os . .Sh NAME @@ -304,7 +304,7 @@ The used space of a snapshot .Po see the .Sx Snapshots section of -.Xr zfsconcepts 8 +.Xr zfsconcepts 7 .Pc is space that is referenced exclusively by this snapshot. If this snapshot is destroyed, the amount of @@ -777,7 +777,7 @@ does not support the algorithm. .Pp Please see -.Xr zpool-features 5 +.Xr zpool-features 7 for more information on these algorithms. .Pp Changing this property affects only newly-written data. @@ -818,7 +818,7 @@ but can only be used on pools with the feature set to .Sy enabled . See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags and the .Sy lz4_compress feature. @@ -1019,7 +1019,7 @@ be enabled on a system. See the .Sx Deduplication section of -.Xr zfsconcepts 8 . +.Xr zfsconcepts 7 . .It Xo .Sy dnodesize Ns = Ns Sy legacy Ns | Ns Sy auto Ns | Ns Sy 1k Ns | Ns .Sy 2k Ns | Ns Sy 4k Ns | Ns Sy 8k Ns | Ns Sy 16k @@ -1192,7 +1192,7 @@ does not override the ancestor's but rather imposes an additional limit. This feature must be enabled to be used .Po see -.Xr zpool-features 5 +.Xr zpool-features 7 .Pc . .It Sy special_small_blocks Ns = Ns Ar size This value represents the threshold block size for including small file @@ -1207,14 +1207,14 @@ will be allocated in the special class. Before setting this property, a special class vdev must be added to the pool. See -.Xr zpoolconcepts 8 +.Xr zpoolconcepts 7 for more details on the special allocation class. .It Sy mountpoint Ns = Ns Pa path Ns | Ns Sy none Ns | Ns Sy legacy Controls the mount point used for this file system. See the .Sx Mount Points section of -.Xr zfsconcepts 8 +.Xr zfsconcepts 7 for more information on how this property is used. .Pp When the @@ -1292,7 +1292,7 @@ For example, this means that recursive snapshots taken from the global zone are counted against each delegated dataset within a zone. This feature must be enabled to be used .Po see -.Xr zpool-features 5 +.Xr zpool-features 7 .Pc . .It Sy userquota@ Ns Ar user Ns = Ns Ar size Ns | Ns Sy none Limits the amount of space consumed by the specified user. @@ -1435,7 +1435,7 @@ If the feature is enabled on the pool, the size may be up to .Ar 1MB . See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags. .Pp Changing the file system's @@ -1686,7 +1686,7 @@ directory is hidden or visible in the root of the file system as discussed in the .Sx Snapshots section of -.Xr zfsconcepts 8 . +.Xr zfsconcepts 7 . The default value is .Sy hidden . .It Sy sync Ns = Ns Sy standard Ns | Ns Sy always Ns | Ns Sy disabled diff --git a/man/man5/zpool-features.5 b/man/man7/zpool-features.7 similarity index 99% rename from man/man5/zpool-features.5 rename to man/man7/zpool-features.7 index 2b4cee545e88..83ca91175370 100644 --- a/man/man5/zpool-features.5 +++ b/man/man7/zpool-features.7 @@ -19,7 +19,7 @@ .\" Copyright (c) 2021, Colm Buckley .\" .Dd May 31, 2021 -.Dt ZPOOL-FEATURES 5 +.Dt ZPOOL-FEATURES 7 .Os . .Sh NAME @@ -521,7 +521,7 @@ will not match the source. Its use by .Nm zfs Cm send Fl i has been disabled by default -.Pq see Sy send_holes_without_birth_time No in Xr zfs-module-parameters 5 . +.Pq see Sy send_holes_without_birth_time No in Xr zfs 4 . .Pp This feature improves performance of incremental sends .Pq Nm zfs Cm send Fl i diff --git a/man/man8/zpoolconcepts.8 b/man/man7/zpoolconcepts.7 similarity index 99% rename from man/man8/zpoolconcepts.8 rename to man/man7/zpoolconcepts.7 index 80a1885fb1cb..58132baf5025 100644 --- a/man/man8/zpoolconcepts.8 +++ b/man/man7/zpoolconcepts.7 @@ -27,7 +27,7 @@ .\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved. .\" .Dd June 2, 2021 -.Dt ZPOOLCONCEPTS 8 +.Dt ZPOOLCONCEPTS 7 .Os . .Sh NAME @@ -508,5 +508,5 @@ in the special class by setting the .Sy special_small_blocks property to nonzero. See -.Xr zfsprops 8 +.Xr zfsprops 7 for more info on this property. diff --git a/man/man8/zpoolprops.8 b/man/man7/zpoolprops.7 similarity index 98% rename from man/man8/zpoolprops.8 rename to man/man7/zpoolprops.7 index 050a0507288e..513f02e0314f 100644 --- a/man/man8/zpoolprops.8 +++ b/man/man7/zpoolprops.7 @@ -28,7 +28,7 @@ .\" Copyright (c) 2021, Colm Buckley .\" .Dd May 27, 2021 -.Dt ZPOOLPROPS 8 +.Dt ZPOOLPROPS 7 .Os . .Sh NAME @@ -89,7 +89,7 @@ This discrepancy is due to several factors, including raidz parity; zfs reservation, quota, refreservation, and refquota properties; and space set aside by .Sy spa_slop_shift (see -.Xr zfs-module-parameters 5 +.Xr zfs 4 for more information). .It Sy freeing After a file system or snapshot is destroyed, the space it was using is @@ -121,7 +121,7 @@ Total size of the storage pool. .It Sy unsupported@ Ns Em guid Information about unsupported features that are enabled on the pool. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details. .El .Pp @@ -316,7 +316,7 @@ whitespace and/or commas. Only features present in all files may be enabled. .Pp See -.Xr zpool-features 5 , +.Xr zpool-features 7 , .Xr zpool-create 8 and .Xr zpool-upgrade 8 @@ -357,7 +357,7 @@ which moves .Ar feature_name to the enabled state. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on feature states. .It Sy listsnapshots Ns = Ns Sy on Ns | Ns Sy off Controls whether information about snapshots associated with this pool is @@ -390,13 +390,13 @@ in use. See .Sy zfs_multihost_interval in the -.Xr zfs-module-parameters 5 +.Xr zfs 4 manual page. In order to enable this property each host must set a unique hostid. See .Xr genhostid 1 .Xr zgenhostid 8 -.Xr spl-module-parameters 5 +.Xr spl 4 for additional details. The default value is .Sy off . diff --git a/man/man8/mount.zfs.8 b/man/man8/mount.zfs.8 index 5d36dbdb1692..2101f70cd595 100644 --- a/man/man8/mount.zfs.8 +++ b/man/man8/mount.zfs.8 @@ -56,7 +56,7 @@ in most cases. are handled according to the .Em Temporary Mount Point Properties section in -.Xr zfsprops 8 , +.Xr zfsprops 7 , except for those described below. .Pp If diff --git a/man/man8/zed.8.in b/man/man8/zed.8.in index e0d9f04043dc..b0b26bfcf8e2 100644 --- a/man/man8/zed.8.in +++ b/man/man8/zed.8.in @@ -237,7 +237,6 @@ Terminate the daemon. .El . .Sh SEE ALSO -.Xr zfs-events 5 , .Xr zfs 8 , .Xr zpool 8 , .Xr zpool-events 8 diff --git a/man/man8/zfs-bookmark.8 b/man/man8/zfs-bookmark.8 index d8833c3fbc7d..094a7b30902f 100644 --- a/man/man8/zfs-bookmark.8 +++ b/man/man8/zfs-bookmark.8 @@ -56,7 +56,7 @@ a redaction bookmark. .Pp This feature must be enabled to be used. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags and the .Sy bookmarks feature. diff --git a/man/man8/zfs-clone.8 b/man/man8/zfs-clone.8 index 24784ecb9aa1..0640244f2009 100644 --- a/man/man8/zfs-clone.8 +++ b/man/man8/zfs-clone.8 @@ -47,7 +47,7 @@ See the .Sx Clones section of -.Xr zfsconcepts 8 +.Xr zfsconcepts 7 for details. The target dataset can be located anywhere in the ZFS hierarchy, and is created as the same type as the original. diff --git a/man/man8/zfs-create.8 b/man/man8/zfs-create.8 index 100a6deeda53..55397fa661d5 100644 --- a/man/man8/zfs-create.8 +++ b/man/man8/zfs-create.8 @@ -184,7 +184,7 @@ See in the .Em Native Properties section of -.Xr zfsprops 8 +.Xr zfsprops 7 for more information about sparse volumes. .It Fl n Do a dry-run diff --git a/man/man8/zfs-jail.8 b/man/man8/zfs-jail.8 index d4a04073edbc..4f9faaea9bf5 100644 --- a/man/man8/zfs-jail.8 +++ b/man/man8/zfs-jail.8 @@ -119,5 +119,5 @@ or name .Ar jailname . .El .Sh SEE ALSO -.Xr jail 8 , -.Xr zfsprops 8 +.Xr zfsprops 7 , +.Xr jail 8 diff --git a/man/man8/zfs-list.8 b/man/man8/zfs-list.8 index 0313b3a14ecb..5200483868ff 100644 --- a/man/man8/zfs-list.8 +++ b/man/man8/zfs-list.8 @@ -90,7 +90,7 @@ The property must be: One of the properties described in the .Sx Native Properties section of -.Xr zfsprops 8 +.Xr zfsprops 7 .It A user property .It @@ -118,7 +118,7 @@ value of the property. The property must be one of the properties described in the .Sx Properties section of -.Xr zfsprops 8 +.Xr zfsprops 7 or the value .Sy name to sort by the dataset name. @@ -158,5 +158,5 @@ displays only snapshots. .El . .Sh SEE ALSO -.Xr zfs-get 8 , -.Xr zfsprops 8 +.Xr zfsprops 7 , +.Xr zfs-get 8 diff --git a/man/man8/zfs-load-key.8 b/man/man8/zfs-load-key.8 index f29d3df824fd..ed89b65d7159 100644 --- a/man/man8/zfs-load-key.8 +++ b/man/man8/zfs-load-key.8 @@ -296,6 +296,6 @@ Deduplication with encryption will leak information about which blocks are equivalent in a dataset and will incur an extra CPU cost for each block written. . .Sh SEE ALSO +.Xr zfsprops 7 , .Xr zfs-create 8 , -.Xr zfs-set 8 , -.Xr zfsprops 8 +.Xr zfs-set 8 diff --git a/man/man8/zfs-mount-generator.8.in b/man/man8/zfs-mount-generator.8.in index e4117101beb3..7aa332ba8174 100644 --- a/man/man8/zfs-mount-generator.8.in +++ b/man/man8/zfs-mount-generator.8.in @@ -186,7 +186,7 @@ to re-run all generators: .Xr systemd.mount 5 , .Xr systemd.target 5 , .Xr zfs 5 , -.Xr zfs-events 5 , .Xr systemd.generator 7 , .Xr systemd.special 7 , -.Xr zed 8 +.Xr zed 8 , +.Xr zpool-events 8 diff --git a/man/man8/zfs-mount.8 b/man/man8/zfs-mount.8 index 62275242c9f9..42ce6b5ca155 100644 --- a/man/man8/zfs-mount.8 +++ b/man/man8/zfs-mount.8 @@ -91,7 +91,7 @@ duration of the mount. See the .Em Temporary Mount Point Properties section of -.Xr zfsprops 8 +.Xr zfsprops 7 for details. .It Fl l Load keys for encrypted filesystems as they are being mounted. diff --git a/man/man8/zfs-receive.8 b/man/man8/zfs-receive.8 index ceb6e64ce571..d2cec42a8e71 100644 --- a/man/man8/zfs-receive.8 +++ b/man/man8/zfs-receive.8 @@ -357,7 +357,7 @@ To use this flag, the storage pool must have the .Sy extensible_dataset feature enabled. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags. .It Fl u File system that is associated with the received stream is not mounted. diff --git a/man/man8/zfs-send.8 b/man/man8/zfs-send.8 index 47b6c47ad03e..a3d08fbf6e2c 100644 --- a/man/man8/zfs-send.8 +++ b/man/man8/zfs-send.8 @@ -110,7 +110,7 @@ The receiving system must have the .Sy large_blocks pool feature enabled as well. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags and the .Sy large_blocks feature. @@ -161,7 +161,7 @@ received as an encrypted dataset, since encrypted datasets cannot use the .Sy embedded_data feature. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags and the .Sy embedded_data feature. @@ -308,7 +308,7 @@ The receiving system must have the .Sy large_blocks pool feature enabled as well. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags and the .Sy large_blocks feature. @@ -372,7 +372,7 @@ since encrypted datasets cannot use the .Sy embedded_data feature. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags and the .Sy embedded_data feature. diff --git a/man/man8/zfs-set.8 b/man/man8/zfs-set.8 index 83709fa6149c..a3588cc26638 100644 --- a/man/man8/zfs-set.8 +++ b/man/man8/zfs-set.8 @@ -65,7 +65,7 @@ .Xc Only some properties can be edited. See -.Xr zfsprops 8 +.Xr zfsprops 7 for more information on what properties can be set and acceptable values. Numeric values can be specified as exact values, or in a human-readable form @@ -78,7 +78,7 @@ User properties can be set on snapshots. For more information, see the .Em User Properties section of -.Xr zfsprops 8 . +.Xr zfsprops 7 . .It Xo .Nm zfs .Cm get @@ -114,7 +114,7 @@ This command takes a comma-separated list of properties as described in the and .Sx User Properties sections of -.Xr zfsprops 8 . +.Xr zfsprops 7 . .Pp The value .Sy all @@ -163,7 +163,7 @@ restored to default if no ancestor has the property set, or with the .Fl S option reverted to the received value if one exists. See -.Xr zfsprops 8 +.Xr zfsprops 7 for a listing of default values, and details on which properties can be inherited. .Bl -tag -width "-r" @@ -178,5 +178,5 @@ option was not specified. .El . .Sh SEE ALSO -.Xr zfs-list 8 , -.Xr zfsprops 8 +.Xr zfsprops 7 , +.Xr zfs-list 8 diff --git a/man/man8/zfs-share.8 b/man/man8/zfs-share.8 index 369f667c9d02..e30d538814ca 100644 --- a/man/man8/zfs-share.8 +++ b/man/man8/zfs-share.8 @@ -87,4 +87,4 @@ The command can also be given a path to a ZFS file system shared on the system. .Sh SEE ALSO .Xr exports 5 , .Xr smb.conf 5 , -.Xr zfsprops 8 +.Xr zfsprops 7 diff --git a/man/man8/zfs-snapshot.8 b/man/man8/zfs-snapshot.8 index fdff39fbc4b8..225123f44b2b 100644 --- a/man/man8/zfs-snapshot.8 +++ b/man/man8/zfs-snapshot.8 @@ -54,7 +54,7 @@ can be used as an alias for See the .Sx Snapshots section of -.Xr zfsconcepts 8 +.Xr zfsconcepts 7 for details. .Bl -tag -width "-o" .It Fl o Ar property Ns = Ns Ar value diff --git a/man/man8/zfs-upgrade.8 b/man/man8/zfs-upgrade.8 index 0ba276dc6ad5..f3620faa6135 100644 --- a/man/man8/zfs-upgrade.8 +++ b/man/man8/zfs-upgrade.8 @@ -77,7 +77,7 @@ systems running older versions of ZFS. .Pp In general, the file system version is independent of the pool version. See -.Xr zpool-features 5 +.Xr zpool-features 7 for information on features of ZFS storage pools. .Pp In some cases, the file system version and the pool version are interrelated and diff --git a/man/man8/zfs-userspace.8 b/man/man8/zfs-userspace.8 index d09e35e1fdd8..b7bd61b5709a 100644 --- a/man/man8/zfs-userspace.8 +++ b/man/man8/zfs-userspace.8 @@ -183,5 +183,5 @@ for types. .El . .Sh SEE ALSO -.Xr zfs-set 8 , -.Xr zfsprops 8 +.Xr zfsprops 7 , +.Xr zfs-set 8 diff --git a/man/man8/zfs.8 b/man/man8/zfs.8 index 16c874eb20de..fca1ba00da7d 100644 --- a/man/man8/zfs.8 +++ b/man/man8/zfs.8 @@ -96,7 +96,7 @@ or .El .Pp See -.Xr zfsconcepts 8 +.Xr zfsconcepts 7 for details. . .Ss Properties @@ -108,7 +108,7 @@ In addition, native properties are either editable or read-only. User properties have no effect on ZFS behavior, but you can use them to annotate datasets in a way that is meaningful in your environment. For more information about properties, see -.Xr zfsprops 8 . +.Xr zfsprops 7 . . .Ss Encryption Enabling the @@ -354,7 +354,7 @@ Snapshots are displayed if The default is .Sy off . See -.Xr zpoolprops 8 +.Xr zpoolprops 7 for more information on pool properties. .Bd -literal -compact -offset Ds .No # Nm zfs Cm list @@ -728,6 +728,8 @@ This option is provided for backwards compatibility with older ZFS versions. .Xr acl 5 , .Xr attributes 5 , .Xr exports 5 , +.Xr zfsconcepts 7 , +.Xr zfsprops 7 , .Xr exportfs 8 , .Xr mount 8 , .Xr net 8 , @@ -768,6 +770,4 @@ This option is provided for backwards compatibility with older ZFS versions. .Xr zfs-upgrade 8 , .Xr zfs-userspace 8 , .Xr zfs-wait 8 , -.Xr zfsconcepts 8 , -.Xr zfsprops 8 , .Xr zpool 8 diff --git a/man/man8/zgenhostid.8 b/man/man8/zgenhostid.8 index 4f926f473b9c..3eff55b6d861 100644 --- a/man/man8/zgenhostid.8 +++ b/man/man8/zgenhostid.8 @@ -83,7 +83,7 @@ digits long, optionally prefixed by .Xr genhostid 1 , .Xr hostid 1 , .Xr sethostid 3 , -.Xr spl-module-parameters 5 +.Xr spl 4 .Sh HISTORY .Nm emulates the diff --git a/man/man8/zpool-add.8 b/man/man8/zpool-add.8 index a0f15076f230..26cf33c5538c 100644 --- a/man/man8/zpool-add.8 +++ b/man/man8/zpool-add.8 @@ -46,7 +46,7 @@ The specification is described in the .Em Virtual Devices section of -.Xr zpoolconcepts 8 . +.Xr zpoolconcepts 7 . The behavior of the .Fl f option, and the device checks performed are described in the @@ -87,7 +87,7 @@ flag. .It Fl o Ar property Ns = Ns Ar value Sets the given pool properties. See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for a list of valid properties that can be set. The only property supported at the moment is .Sy ashift . diff --git a/man/man8/zpool-attach.8 b/man/man8/zpool-attach.8 index 04c0fca21d0d..19d8f6ac07ac 100644 --- a/man/man8/zpool-attach.8 +++ b/man/man8/zpool-attach.8 @@ -71,7 +71,7 @@ Not all devices can be overridden in this manner. .It Fl o Ar property Ns = Ns Ar value Sets the given pool properties. See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for a list of valid properties that can be set. The only property supported at the moment is .Sy ashift . diff --git a/man/man8/zpool-create.8 b/man/man8/zpool-create.8 index 91e6f427d837..e902c770076d 100644 --- a/man/man8/zpool-create.8 +++ b/man/man8/zpool-create.8 @@ -80,7 +80,7 @@ The specification is described in the .Sx Virtual Devices section of -.Xr zpoolconcepts 8 . +.Xr zpoolconcepts 7 . .Pp The command attempts to verify that each device specified is accessible and not currently in use by another subsystem. @@ -139,7 +139,7 @@ Individual features can be enabled by setting their corresponding properties to with .Fl o . See -.Xr zpool-features 5 +.Xr zpool-features 7 for details about feature properties. .It Fl f Forces use of @@ -160,7 +160,7 @@ The mount point must be an absolute path, or .Sy none . For more information on dataset mount points, see -.Xr zfsprops 8 . +.Xr zfsprops 7 . .It Fl n Displays the configuration that would be used without actually creating the pool. @@ -169,23 +169,23 @@ device sharing. .It Fl o Ar property Ns = Ns Ar value Sets the given pool properties. See -.Xr zpoolprops 8 +.Xr zpoolprops 7 for a list of valid properties that can be set. .It Fl o Ar compatibility Ns = Ns Sy off Ns | Ns Sy legacy Ns | Ns Ar file Ns Oo , Ns Ar file Oc Ns … Specifies compatibility feature sets. See -.Xr zpool-features 5 +.Xr zpool-features 7 for more information about compatibility feature sets. .It Fl o Sy feature@ Ns Ar feature Ns = Ns Ar value Sets the given pool feature. See the -.Xr zpool-features 5 +.Xr zpool-features 7 section for a list of valid features that can be set. Value can be either disabled or enabled. .It Fl O Ar file-system-property Ns = Ns Ar value Sets the given file system properties in the root file system of the pool. See -.Xr zfsprops 8 +.Xr zfsprops 7 for a list of valid properties that can be set. .It Fl R Ar root Equivalent to diff --git a/man/man8/zpool-events.8 b/man/man8/zpool-events.8 index a95ce48d93a8..ab1d6ea56213 100644 --- a/man/man8/zpool-events.8 +++ b/man/man8/zpool-events.8 @@ -49,10 +49,11 @@ These events are consumed by the and used to automate administrative tasks such as replacing a failed device with a hot spare. For more information about the subclasses and event payloads -that can be generated see the -.Xr zfs-events 5 -man page. -.Pp +that can be generated see +.Sx EVENTS +and the following sections. +. +.Sh OPTIONS .Bl -tag -compact -width Ds .It Fl c Clear all previous events. @@ -66,8 +67,417 @@ single tab instead of arbitrary space. Print the entire payload for each event. .El . +.Sh EVENTS +Theese are the different event subclasses. +The full event name would be +.Sy ereport.fs.zfs.\& Ns Em SUBCLASS , +but only the last part is listed here. +.Pp +.Bl -tag -compact -width "vdev.bad_guid_sum" +.It Sy checksum +Issued when a checksum error has been detected. +.It Sy io +Issued when there is an I/O error in a vdev in the pool. +.It Sy data +Issued when there have been data errors in the pool. +.It Sy deadman +Issued when an I/O request is determined to be "hung", this can be caused +by lost completion events due to flaky hardware or drivers. +See +.Sy zfs_deadman_failmode +in +.Xr zfs 4 +for additional information regarding "hung" I/O detection and configuration. +.It Sy delay +Issued when a completed I/O request exceeds the maximum allowed time +specified by the +.Sy zio_slow_io_ms +module parameter. +This can be an indicator of problems with the underlying storage device. +The number of delay events is ratelimited by the +.Sy zfs_slow_io_events_per_second +module parameter. +.It Sy config +Issued every time a vdev change have been done to the pool. +.It Sy zpool +Issued when a pool cannot be imported. +.It Sy zpool.destroy +Issued when a pool is destroyed. +.It Sy zpool.export +Issued when a pool is exported. +.It Sy zpool.import +Issued when a pool is imported. +.It Sy zpool.reguid +Issued when a REGUID (new unique identifier for the pool have been regenerated) have been detected. +.It Sy vdev.unknown +Issued when the vdev is unknown. +Such as trying to clear device errors on a vdev that have failed/been kicked +from the system/pool and is no longer available. +.It Sy vdev.open_failed +Issued when a vdev could not be opened (because it didn't exist for example). +.It Sy vdev.corrupt_data +Issued when corrupt data have been detected on a vdev. +.It Sy vdev.no_replicas +Issued when there are no more replicas to sustain the pool. +This would lead to the pool being +.Em DEGRADED . +.It Sy vdev.bad_guid_sum +Issued when a missing device in the pool have been detected. +.It Sy vdev.too_small +Issued when the system (kernel) have removed a device, and ZFS +notices that the device isn't there any more. +This is usually followed by a +.Sy probe_failure +event. +.It Sy vdev.bad_label +Issued when the label is OK but invalid. +.It Sy vdev.bad_ashift +Issued when the ashift alignment requirement has increased. +.It Sy vdev.remove +Issued when a vdev is detached from a mirror (or a spare detached from a +vdev where it have been used to replace a failed drive - only works if +the original drive have been readded). +.It Sy vdev.clear +Issued when clearing device errors in a pool. +Such as running +.Nm zpool Cm clear +on a device in the pool. +.It Sy vdev.check +Issued when a check to see if a given vdev could be opened is started. +.It Sy vdev.spare +Issued when a spare have kicked in to replace a failed device. +.It Sy vdev.autoexpand +Issued when a vdev can be automatically expanded. +.It Sy io_failure +Issued when there is an I/O failure in a vdev in the pool. +.It Sy probe_failure +Issued when a probe fails on a vdev. +This would occur if a vdev +have been kicked from the system outside of ZFS (such as the kernel +have removed the device). +.It Sy log_replay +Issued when the intent log cannot be replayed. +The can occur in the case of a missing or damaged log device. +.It Sy resilver.start +Issued when a resilver is started. +.It Sy resilver.finish +Issued when the running resilver have finished. +.It Sy scrub.start +Issued when a scrub is started on a pool. +.It Sy scrub.finish +Issued when a pool has finished scrubbing. +.It Sy scrub.abort +Issued when a scrub is aborted on a pool. +.It Sy scrub.resume +Issued when a scrub is resumed on a pool. +.It Sy scrub.paused +Issued when a scrub is paused on a pool. +.It Sy bootfs.vdev.attach +.El +. +.Sh PAYLOADS +This is the payload (data, information) that accompanies an +event. +.Pp +For +.Xr zed 8 , +these are set to uppercase and prefixed with +.Sy ZEVENT_ . +.Pp +.Bl -tag -compact -width "vdev_cksum_errors" +.It Sy pool +Pool name. +.It Sy pool_failmode +Failmode - +.Sy wait , +.Sy continue , +or +.Sy panic . +See the +.Sy failmode +property in +.Xr zpoolprops 7 +for more information. +.It Sy pool_guid +The GUID of the pool. +.It Sy pool_context +The load state for the pool (0=none, 1=open, 2=import, 3=tryimport, 4=recover +5=error). +.It Sy vdev_guid +The GUID of the vdev in question (the vdev failing or operated upon with +.Nm zpool Cm clear , +etc.). +.It Sy vdev_type +Type of vdev - +.Sy disk , +.Sy file , +.Sy mirror , +etc. +See the +.Sy Virtual Devices +section of +.Xr zpoolconcepts 7 +for more information on possible values. +.It Sy vdev_path +Full path of the vdev, including any +.Em -partX . +.It Sy vdev_devid +ID of vdev (if any). +.It Sy vdev_fru +Physical FRU location. +.It Sy vdev_state +State of vdev (0=uninitialized, 1=closed, 2=offline, 3=removed, 4=failed to open, 5=faulted, 6=degraded, 7=healthy). +.It Sy vdev_ashift +The ashift value of the vdev. +.It Sy vdev_complete_ts +The time the last I/O request completed for the specified vdev. +.It Sy vdev_delta_ts +The time since the last I/O request completed for the specified vdev. +.It Sy vdev_spare_paths +List of spares, including full path and any +.Em -partX . +.It Sy vdev_spare_guids +GUID(s) of spares. +.It Sy vdev_read_errors +How many read errors that have been detected on the vdev. +.It Sy vdev_write_errors +How many write errors that have been detected on the vdev. +.It Sy vdev_cksum_errors +How many checksum errors that have been detected on the vdev. +.It Sy parent_guid +GUID of the vdev parent. +.It Sy parent_type +Type of parent. +See +.Sy vdev_type . +.It Sy parent_path +Path of the vdev parent (if any). +.It Sy parent_devid +ID of the vdev parent (if any). +.It Sy zio_objset +The object set number for a given I/O request. +.It Sy zio_object +The object number for a given I/O request. +.It Sy zio_level +The indirect level for the block. +Level 0 is the lowest level and includes data blocks. +Values > 0 indicate metadata blocks at the appropriate level. +.It Sy zio_blkid +The block ID for a given I/O request. +.It Sy zio_err +The error number for a failure when handling a given I/O request, +compatible with +.Xr errno 3 +with the value of +.Sy EBADE +used to indicate a ZFS checksum error. +.It Sy zio_offset +The offset in bytes of where to write the I/O request for the specified vdev. +.It Sy zio_size +The size in bytes of the I/O request. +.It Sy zio_flags +The current flags describing how the I/O request should be handled. +See the +.Sy I/O FLAGS +section for the full list of I/O flags. +.It Sy zio_stage +The current stage of the I/O in the pipeline. +See the +.Sy I/O STAGES +section for a full list of all the I/O stages. +.It Sy zio_pipeline +The valid pipeline stages for the I/O. +See the +.Sy I/O STAGES +section for a full list of all the I/O stages. +.It Sy zio_delay +The time elapsed (in nanoseconds) waiting for the block layer to complete the +I/O request. +Unlike +.Sy zio_delta , +this does not include any vdev queuing time and is +therefore solely a measure of the block layer performance. +.It Sy zio_timestamp +The time when a given I/O request was submitted. +.It Sy zio_delta +The time required to service a given I/O request. +.It Sy prev_state +The previous state of the vdev. +.It Sy cksum_expected +The expected checksum value for the block. +.It Sy cksum_actual +The actual checksum value for an errant block. +.It Sy cksum_algorithm +Checksum algorithm used. +See +.Xr zfsprops 7 +for more information on the available checksum algorithms. +.It Sy cksum_byteswap +Whether or not the data is byteswapped. +.It Sy bad_ranges +.No [\& Ns Ar start , end ) +pairs of corruption offsets. +Offsets are always aligned on a 64-bit boundary, +and can include some gaps of non-corruption. +(See +.Sy bad_ranges_min_gap ) +.It Sy bad_ranges_min_gap +In order to bound the size of the +.Sy bad_ranges +array, gaps of non-corruption +less than or equal to +.Sy bad_ranges_min_gap +bytes have been merged with +adjacent corruption. +Always at least 8 bytes, since corruption is detected on a 64-bit word basis. +.It Sy bad_range_sets +This array has one element per range in +.Sy bad_ranges . +Each element contains +the count of bits in that range which were clear in the good data and set +in the bad data. +.It Sy bad_range_clears +This array has one element per range in +.Sy bad_ranges . +Each element contains +the count of bits for that range which were set in the good data and clear in +the bad data. +.It Sy bad_set_bits +If this field exists, it is an array of +.Pq Ar bad data No & ~( Ns Ar good data ) ; +that is, the bits set in the bad data which are cleared in the good data. +Each element corresponds a byte whose offset is in a range in +.Sy bad_ranges , +and the array is ordered by offset. +Thus, the first element is the first byte in the first +.Sy bad_ranges +range, and the last element is the last byte in the last +.Sy bad_ranges +range. +.It Sy bad_cleared_bits +Like +.Sy bad_set_bits , +but contains +.Pq Ar good data No & ~( Ns Ar bad data ) ; +that is, the bits set in the good data which are cleared in the bad data. +.It Sy bad_set_histogram +If this field exists, it is an array of counters. +Each entry counts bits set in a particular bit of a big-endian uint64 type. +The first entry counts bits +set in the high-order bit of the first byte, the 9th byte, etc, and the last +entry counts bits set of the low-order bit of the 8th byte, the 16th byte, etc. +This information is useful for observing a stuck bit in a parallel data path, +such as IDE or parallel SCSI. +.It Sy bad_cleared_histogram +If this field exists, it is an array of counters. +Each entry counts bit clears in a particular bit of a big-endian uint64 type. +The first entry counts bits +clears of the high-order bit of the first byte, the 9th byte, etc, and the +last entry counts clears of the low-order bit of the 8th byte, the 16th byte, etc. +This information is useful for observing a stuck bit in a parallel data +path, such as IDE or parallel SCSI. +.El +. +.Sh I/O STAGES +The ZFS I/O pipeline is comprised of various stages which are defined below. +The individual stages are used to construct these basic I/O +operations: Read, Write, Free, Claim, and Ioctl. +These stages may be +set on an event to describe the life cycle of a given I/O request. +.Pp +.TS +tab(:); +l l l . +Stage:Bit Mask:Operations +_:_:_ +ZIO_STAGE_OPEN:0x00000001:RWFCI + +ZIO_STAGE_READ_BP_INIT:0x00000002:R---- +ZIO_STAGE_WRITE_BP_INIT:0x00000004:-W--- +ZIO_STAGE_FREE_BP_INIT:0x00000008:--F-- +ZIO_STAGE_ISSUE_ASYNC:0x00000010:RWF-- +ZIO_STAGE_WRITE_COMPRESS:0x00000020:-W--- + +ZIO_STAGE_ENCRYPT:0x00000040:-W--- +ZIO_STAGE_CHECKSUM_GENERATE:0x00000080:-W--- + +ZIO_STAGE_NOP_WRITE:0x00000100:-W--- + +ZIO_STAGE_DDT_READ_START:0x00000200:R---- +ZIO_STAGE_DDT_READ_DONE:0x00000400:R---- +ZIO_STAGE_DDT_WRITE:0x00000800:-W--- +ZIO_STAGE_DDT_FREE:0x00001000:--F-- + +ZIO_STAGE_GANG_ASSEMBLE:0x00002000:RWFC- +ZIO_STAGE_GANG_ISSUE:0x00004000:RWFC- + +ZIO_STAGE_DVA_THROTTLE:0x00008000:-W--- +ZIO_STAGE_DVA_ALLOCATE:0x00010000:-W--- +ZIO_STAGE_DVA_FREE:0x00020000:--F-- +ZIO_STAGE_DVA_CLAIM:0x00040000:---C- + +ZIO_STAGE_READY:0x00080000:RWFCI + +ZIO_STAGE_VDEV_IO_START:0x00100000:RW--I +ZIO_STAGE_VDEV_IO_DONE:0x00200000:RW--I +ZIO_STAGE_VDEV_IO_ASSESS:0x00400000:RW--I + +ZIO_STAGE_CHECKSUM_VERIFY:0x00800000:R---- + +ZIO_STAGE_DONE:0x01000000:RWFCI +.TE +. +.Sh I/O FLAGS +Every I/O request in the pipeline contains a set of flags which describe its +function and are used to govern its behavior. +These flags will be set in an event as a +.Sy zio_flags +payload entry. +.Pp +.TS +tab(:); +l l . +Flag:Bit Mask +_:_ +ZIO_FLAG_DONT_AGGREGATE:0x00000001 +ZIO_FLAG_IO_REPAIR:0x00000002 +ZIO_FLAG_SELF_HEAL:0x00000004 +ZIO_FLAG_RESILVER:0x00000008 +ZIO_FLAG_SCRUB:0x00000010 +ZIO_FLAG_SCAN_THREAD:0x00000020 +ZIO_FLAG_PHYSICAL:0x00000040 + +ZIO_FLAG_CANFAIL:0x00000080 +ZIO_FLAG_SPECULATIVE:0x00000100 +ZIO_FLAG_CONFIG_WRITER:0x00000200 +ZIO_FLAG_DONT_RETRY:0x00000400 +ZIO_FLAG_DONT_CACHE:0x00000800 +ZIO_FLAG_NODATA:0x00001000 +ZIO_FLAG_INDUCE_DAMAGE:0x00002000 + +ZIO_FLAG_IO_ALLOCATING:0x00004000 +ZIO_FLAG_IO_RETRY:0x00008000 +ZIO_FLAG_PROBE:0x00010000 +ZIO_FLAG_TRYHARD:0x00020000 +ZIO_FLAG_OPTIONAL:0x00040000 + +ZIO_FLAG_DONT_QUEUE:0x00080000 +ZIO_FLAG_DONT_PROPAGATE:0x00100000 +ZIO_FLAG_IO_BYPASS:0x00200000 +ZIO_FLAG_IO_REWRITE:0x00400000 +ZIO_FLAG_RAW_COMPRESS:0x00800000 +ZIO_FLAG_RAW_ENCRYPT:0x01000000 + +ZIO_FLAG_GANG_CHILD:0x02000000 +ZIO_FLAG_DDT_CHILD:0x04000000 +ZIO_FLAG_GODFATHER:0x08000000 +ZIO_FLAG_NOPWRITE:0x10000000 +ZIO_FLAG_REEXECUTED:0x20000000 +ZIO_FLAG_DELEGATED:0x40000000 +ZIO_FLAG_FASTWRITE:0x80000000 +.TE +. .Sh SEE ALSO -.Xr zfs-events 5 , -.Xr zfs-module-parameters 5 , +.Xr zfs 4 , .Xr zed 8 , .Xr zpool-wait 8 diff --git a/man/man8/zpool-get.8 b/man/man8/zpool-get.8 index 06908238999c..55904f169e24 100644 --- a/man/man8/zpool-get.8 +++ b/man/man8/zpool-get.8 @@ -76,7 +76,7 @@ Property source, either .El .Pp See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for more information on the available pool properties. .Bl -tag -compact -offset Ds -width "-o field" .It Fl H @@ -97,12 +97,12 @@ Display numbers in parsable (exact) values. .Xc Sets the given property on the specified pool. See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for more information on what properties can be set and acceptable values. .El . .Sh SEE ALSO -.Xr zpool-features 5 , -.Xr zpool-list 8 , -.Xr zpoolprops 8 +.Xr zpool-features 7 , +.Xr zpoolprops 7 , +.Xr zpool-list 8 diff --git a/man/man8/zpool-import.8 b/man/man8/zpool-import.8 index 1b1f3c5ae5b0..518e3cf1d76a 100644 --- a/man/man8/zpool-import.8 +++ b/man/man8/zpool-import.8 @@ -201,7 +201,7 @@ for a description of dataset properties and mount options. .It Fl o Ar property Ns = Ns Ar value Sets the specified property on the imported pool. See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for more information on the available pool properties. .It Fl R Ar root Sets the @@ -347,7 +347,7 @@ for a description of dataset properties and mount options. .It Fl o Ar property Ns = Ns Ar value Sets the specified property on the imported pool. See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for more information on the available pool properties. .It Fl R Ar root Sets the diff --git a/man/man8/zpool-list.8 b/man/man8/zpool-list.8 index 3dec7370c5e8..dd4e13c16042 100644 --- a/man/man8/zpool-list.8 +++ b/man/man8/zpool-list.8 @@ -69,7 +69,7 @@ space. .It Fl o Ar property Comma-separated list of properties to display. See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for a list of valid properties. The default list is .Sy name , size , allocated , free , checkpoint, expandsize , fragmentation , diff --git a/man/man8/zpool-remove.8 b/man/man8/zpool-remove.8 index 5d866cb50d4d..1429180385cc 100644 --- a/man/man8/zpool-remove.8 +++ b/man/man8/zpool-remove.8 @@ -70,7 +70,7 @@ If an IO error is encountered during the removal process it will be cancelled. The .Sy device_removal feature flag must be enabled to remove a top-level vdev, see -.Xr zpool-features 5 . +.Xr zpool-features 7 . .Pp A mirrored top-level device (log or data) can be removed by specifying the top-level mirror for the same. diff --git a/man/man8/zpool-replace.8 b/man/man8/zpool-replace.8 index eadb5681895b..2b2875ed4292 100644 --- a/man/man8/zpool-replace.8 +++ b/man/man8/zpool-replace.8 @@ -77,7 +77,7 @@ Not all devices can be overridden in this manner. .It Fl o Ar property Ns = Ns Ar value Sets the given pool properties. See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for a list of valid properties that can be set. The only property supported at the moment is .Sy ashift . diff --git a/man/man8/zpool-split.8 b/man/man8/zpool-split.8 index 7a1a13d5db41..c3b05c2366bf 100644 --- a/man/man8/zpool-split.8 +++ b/man/man8/zpool-split.8 @@ -98,7 +98,7 @@ flag. Sets the specified property for .Ar newpool . See the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page for more information on the available pool properties. .It Fl R Ar root Set diff --git a/man/man8/zpool-status.8 b/man/man8/zpool-status.8 index da5f95e29cdc..7c825f69d8e2 100644 --- a/man/man8/zpool-status.8 +++ b/man/man8/zpool-status.8 @@ -50,7 +50,7 @@ is specified, then the status of each pool in the system is displayed. For more information on pool and device health, see the .Sx Device Failure and Recovery section of -.Xr zpoolconcepts 8 . +.Xr zpoolconcepts 7 . .Pp If a scrub or resilver is in progress, this command reports the percentage done and the estimated time to completion. diff --git a/man/man8/zpool-sync.8 b/man/man8/zpool-sync.8 index 6d4aa2c29c48..aa68a5729e9f 100644 --- a/man/man8/zpool-sync.8 +++ b/man/man8/zpool-sync.8 @@ -48,6 +48,6 @@ will sync all pools on the system. Otherwise, it will sync only the specified pools. . .Sh SEE ALSO +.Xr zpoolconcepts 7 , .Xr zpool-export 8 , -.Xr zpool-iostat 8 , -.Xr zpoolconcepts 8 +.Xr zpool-iostat 8 diff --git a/man/man8/zpool-trim.8 b/man/man8/zpool-trim.8 index f709dd85414c..d9a7b4400301 100644 --- a/man/man8/zpool-trim.8 +++ b/man/man8/zpool-trim.8 @@ -86,6 +86,6 @@ Wait until the devices are done being trimmed before returning. .El . .Sh SEE ALSO +.Xr zpoolprops 7 , .Xr zpool-initialize 8 , -.Xr zpool-wait 8 , -.Xr zpoolprops 8 +.Xr zpool-wait 8 diff --git a/man/man8/zpool-upgrade.8 b/man/man8/zpool-upgrade.8 index 0e67e7884c72..1b13bad898bf 100644 --- a/man/man8/zpool-upgrade.8 +++ b/man/man8/zpool-upgrade.8 @@ -66,7 +66,7 @@ property). .Xc Displays legacy ZFS versions supported by the this version of ZFS. See -.Xr zpool-features 5 +.Xr zpool-features 7 for a description of feature flags features supported by this version of ZFS. .It Xo .Nm zpool @@ -87,7 +87,7 @@ then no upgrade will take place. Once this is done, the pool will no longer be accessible on systems that do not support feature flags. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on compatibility with systems that support feature flags, but do not support all features enabled on the pool. .Bl -tag -width Ds @@ -103,7 +103,7 @@ supported legacy version number. .El . .Sh SEE ALSO -.Xr zpool-features 5 , -.Xr zpool-history 8 , -.Xr zpoolconcepts 8 , -.Xr zpoolprops 8 +.Xr zpool-features 7 , +.Xr zpoolconcepts 7 , +.Xr zpoolprops 7 , +.Xr zpool-history 8 diff --git a/man/man8/zpool.8 b/man/man8/zpool.8 index dac35eee77b9..192a8e2eac8d 100644 --- a/man/man8/zpool.8 +++ b/man/man8/zpool.8 @@ -54,7 +54,7 @@ See for information on managing datasets. .Pp For an overview of creating and managing ZFS storage pools see the -.Xr zpoolconcepts 8 +.Xr zpoolconcepts 7 manual page. . .Sh SUBCOMMANDS @@ -126,7 +126,7 @@ Creates a new pool by splitting all mirrors in an existing pool (which decreases . .Ss Properties Available pool properties listed in the -.Xr zpoolprops 8 +.Xr zpoolprops 7 manual page. .Bl -tag -width Ds .It Xr zpool-list 8 @@ -157,10 +157,8 @@ These events are consumed by the .Xr zed 8 and used to automate administrative tasks such as replacing a failed device with a hot spare. -For more information about the subclasses and event payloads -that can be generated see the -.Xr zfs-events 5 -man page. +That manual page also describes the subclasses and event payloads +that can be generated. .It Xr zpool-history 8 Displays the command history of the specified pool(s) or all pools if no pool is specified. @@ -523,9 +521,10 @@ is not set, it is assumed that the user is allowed to run .Sy Evolving . .Sh SEE ALSO -.Xr zfs-events 5 , -.Xr zfs-module-parameters 5 , -.Xr zpool-features 5 , +.Xr zfs 4 , +.Xr zpool-features 7 , +.Xr zpoolconcepts 7 , +.Xr zpoolprops 7 , .Xr zed 8 , .Xr zfs 8 , .Xr zpool-add 8 , @@ -558,6 +557,4 @@ is not set, it is assumed that the user is allowed to run .Xr zpool-sync 8 , .Xr zpool-trim 8 , .Xr zpool-upgrade 8 , -.Xr zpool-wait 8 , -.Xr zpoolconcepts 8 , -.Xr zpoolprops 8 +.Xr zpool-wait 8 diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index b073d68a46cf..6ce64db4f17b 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -477,7 +477,9 @@ systemctl --system daemon-reload >/dev/null || true %{_bindir}/dbufstat # Man pages %{_mandir}/man1/* +%{_mandir}/man4/* %{_mandir}/man5/* +%{_mandir}/man7/* %{_mandir}/man8/* # Configuration files and scripts %{_libexecdir}/%{name} diff --git a/scripts/zol2zfs-patch.sed b/scripts/zol2zfs-patch.sed index bb6d9faac450..0ca4b6cd6b7e 100755 --- a/scripts/zol2zfs-patch.sed +++ b/scripts/zol2zfs-patch.sed @@ -12,7 +12,7 @@ s:lib/libzfs:usr/src/lib/libzfs/common:g s:lib/libzfs_core:usr/src/lib/libzfs_core/common:g s:lib/libzpool:lib/libzpool/common:g s:lib/libzpool:usr/src/lib/libzpool:g -s:man/man5/zpool-features.5:usr/src/man/man5/zpool-features.5:g +s:man/man7/zpool-features.7:usr/src/man/man5/zpool-features.5:g s:man/man8/zfs.8:usr/src/man/man1m/zfs.1m:g s:module/nvpair:usr/src/common/nvpair:g s:module/zcommon:usr/src/common/zfs/:g diff --git a/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh b/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh index 489360d8c523..5d0198c90c16 100755 --- a/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh +++ b/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh @@ -84,7 +84,7 @@ log_must zpool import -d $VDIR $TESTPOOL # from ARC, accessed later on as prefetches and transition to MRU as # prefetches. # If accessed again they are counted as MRU and the l2arc_mru_asize arcstat -# will not be 0 (mentioned also in zfs-module-parameters.5) +# will not be 0 (mentioned also in zfs.4) # For the purposes of this test we mitigate this by disabling (predictive) # ZFS prefetches with zfs_prefetch_disable=1. log_must test $(get_arcstat l2_mru_asize) -eq 0 From 1b37cc1abee9a1c58ed54a93df569a81f86072c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 4 Jun 2021 22:08:50 +0200 Subject: [PATCH 08/24] Consistentify miscellaneous style on remaining manpages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most notably this fixes the vdev_id(8) non-.Xrs in vdev_id.conf.5 Reviewed-by: Richard Laager Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12212 --- man/man1/arcstat.1 | 16 +++++++++------- man/man1/cstyle.1 | 21 ++++++++++----------- man/man1/raidz_test.1 | 28 ++++++++++++++-------------- man/man1/zhack.1 | 8 +++----- man/man5/vdev_id.conf.5 | 38 ++++++++++++++++++-------------------- man/man8/fsck.zfs.8 | 8 ++++++-- man/man8/zed.8.in | 6 +++--- man/man8/zpool_influxdb.8 | 4 ++-- 8 files changed, 65 insertions(+), 64 deletions(-) diff --git a/man/man1/arcstat.1 b/man/man1/arcstat.1 index a0240e40e4b8..a69cd8937bdf 100644 --- a/man/man1/arcstat.1 +++ b/man/man1/arcstat.1 @@ -22,7 +22,7 @@ .Sh SYNOPSIS .Nm .Op Fl havxp -.Op Fl f Ar field Ns Op , Ns Ar field Ns ... +.Op Fl f Ar field Ns Op , Ns Ar field Ns … .Op Fl o Ar file .Op Fl s Ar string .Op Ar interval @@ -31,7 +31,7 @@ .Sh DESCRIPTION .Nm prints various ZFS ARC and L2ARC statistics in vmstat-like fashion: -.Bl -tag -width "l2asize" +.Bl -tag -compact -offset Ds -width "l2asize" .It Sy c ARC target size .It Sy dh% @@ -155,7 +155,7 @@ Print all possible stats. .It Fl f Display only specific fields. See -.Sy DESCRIPTION +.Sx DESCRIPTION for supported statistics. .It Fl h Display help message. @@ -166,17 +166,19 @@ Disable auto-scaling of numerical fields (for raw, machine-parsable values). .It Fl s Display data with a specified separator (default: 2 spaces). .It Fl x -Print extended stats (same as -.Fl f Ar time,mfu,mru,mfug,mrug,eskip,mtxmis,dread,pread,read Ns No ). +Print extended stats +.Pq same as Fl f Sy time , Ns Sy mfu , Ns Sy mru , Ns Sy mfug , Ns Sy mrug , Ns Sy eskip , Ns Sy mtxmis , Ns Sy dread , Ns Sy pread , Ns Sy read . .It Fl v Show field headers and definitions .El . .Sh OPERANDS The following operands are supported: -.Bl -tag -width "interval" +.Bl -tag -compact -offset Ds -width "interval" .It Ar interval Specify the sampling interval in seconds. .It Ar count -Display only \fIcount\fR reports. +Display only +.Ar count +reports. .El diff --git a/man/man1/cstyle.1 b/man/man1/cstyle.1 index 16f47ba35c1f..f5f9ec78f827 100644 --- a/man/man1/cstyle.1 +++ b/man/man1/cstyle.1 @@ -31,7 +31,7 @@ .Nm .Op Fl chpvCP .Op Fl o Ar construct Ns Op , Ns Ar construct Ns … -.Op Ar file… +.Oo Ar file Oc Ns … .Sh DESCRIPTION .Nm inspects C source files (*.c and *.h) for common stylistic errors. @@ -99,7 +99,7 @@ Allow doxygen-style block comments .Pq Sy /** No and Sy /*!\& . .It Sy splint Allow splint-style lint comments -.Pq Sy /*@...@*/ . +.Pq Sy /*@ Ns ... Ns Sy @*/ . .El .El . @@ -118,29 +118,28 @@ statement has balanced parenthesis. .It Some .Xr cpp 1 -macros do not require \fB;\fPs after them. +macros do not require +.Sy ;\& Ns s after them. Any such macros .Em must be ALL_CAPS; any lower case letters will cause bad output. .Pp -The bad output will generally be corrected after the next \fB;\fP, -.Sy { , -or -.Sy } . +The bad output will generally be corrected after the next +.Sy ;\& , { , No or Sy } . .El Some continuation error messages deserve some additional explanation: .Bl -tag -width Ds .It Sy multiple statements continued over multiple lines A multi-line statement which is not broken at statement boundaries. For example: -.Bd -literal +.Bd -literal -compact -offset Ds if (this_is_a_long_variable == another_variable) a = b + c; .Ed .Pp Will trigger this error. Instead, do: -.Bd -literal +.Bd -literal -compact -offset Ds if (this_is_a_long_variable == another_variable) a = b + c; .Ed @@ -148,13 +147,13 @@ if (this_is_a_long_variable == another_variable) For visibility, empty bodies for if, for, and while statements should be on their own line. For example: -.Bd -literal +.Bd -literal -compact -offset Ds while (do_something(&x) == 0); .Ed .Pp Will trigger this error. Instead, do: -.Bd -literal +.Bd -literal -compact -offset Ds while (do_something(&x) == 0) ; .Ed diff --git a/man/man1/raidz_test.1 b/man/man1/raidz_test.1 index 1c61c7a8772b..4283a4b527f3 100644 --- a/man/man1/raidz_test.1 +++ b/man/man1/raidz_test.1 @@ -50,44 +50,44 @@ option. .Bl -tag -width "-B(enchmark)" .It Fl h Print a help summary. -.It Fl a Ar ashift No (default: Sy 9 ) +.It Fl a Ar ashift Pq default: Sy 9 Ashift value. -.It Fl o Ar zio_off_shift No (default: Sy 0 ) +.It Fl o Ar zio_off_shift Pq default: Sy 0 ZIO offset for each raidz block. The offset's value is -.Sy 1 << zio_off_shift . -.It Fl d Ar raidz_data_disks No (default: Sy 8 ) +.Em 2^zio_off_shift . +.It Fl d Ar raidz_data_disks Pq default: Sy 8 Number of raidz data disks to use. Additional disks will be used for parity. -.It Fl s Ar zio_size_shift No (default: Sy 19 ) +.It Fl s Ar zio_size_shift Pq default: Sy 19 Size of data for raidz block. The real size is -.Sy 1 << zio_size_shift . -.It Fl r Ar reflow_offset No (default: Sy uint max ) +.Em 2^zio_size_shift . +.It Fl r Ar reflow_offset Pq default: Sy uint max Set raidz expansion offset. The expanded raidz map allocation function will produce different map configurations depending on this value. -.It Fl S Ns No (weep) +.It Fl S Ns Pq weep Sweep parameter space while verifying the raidz implementations. This option will exhaust all most of valid values for the .Fl aods options. Runtime using this option will be long. -.It Fl t Ns No (imeout) +.It Fl t Ns Pq imeout Wall time for sweep test in seconds. The actual runtime could be longer. -.It Fl B Ns No (enchmark) +.It Fl B Ns Pq enchmark All implementations are benchmarked using increasing per disk data size. Results are given as throughput per disk, measured in MiB/s. -.It Fl e Ns No (xpansion) +.It Fl e Ns Pq xpansion Use expanded raidz map allocation function. -.It Fl v Ns No (erbose) +.It Fl v Ns Pq erbose Increase verbosity. -.It Fl T Ns No (est the test) +.It Fl T Ns Pq est the test Debugging option: fail all tests. This is to check if tests would properly verify bit-exactness. -.It Fl D Ns No (ebug) +.It Fl D Ns Pq ebug Debugging option: attach .Xr gdb 1 when diff --git a/man/man1/zhack.1 b/man/man1/zhack.1 index b18b3a4c0996..83046ee8f515 100644 --- a/man/man1/zhack.1 +++ b/man/man1/zhack.1 @@ -119,7 +119,7 @@ Can be specified more than once. . .Sh EXAMPLES .Bd -literal -# zhack feature stat tank +.No # Nm zhack Cm feature stat Ar tank for_read_obj: org.illumos:lz4_compress = 0 for_write_obj: @@ -130,10 +130,8 @@ descriptions_obj: com.delphix:empty_bpobj = Snapshots use less space. org.illumos:lz4_compress = LZ4 compression algorithm support. -# zhack feature enable -d 'Predict future disk failures.' \\ - tank com.example:clairvoyance - -# zhack feature ref tank com.example:clairvoyance +.No # Nm zhack Cm feature enable Fl d No 'Predict future disk failures.' Ar tank com.example:clairvoyance +.No # Nm zhack Cm feature ref Ar tank com.example:clairvoyance .Ed . .Sh SEE ALSO diff --git a/man/man5/vdev_id.conf.5 b/man/man5/vdev_id.conf.5 index 1268114bdbc6..a2d38add4ee0 100644 --- a/man/man5/vdev_id.conf.5 +++ b/man/man5/vdev_id.conf.5 @@ -14,13 +14,13 @@ . .Sh NAME .Nm vdev_id.conf -.Nd Configuration file for vdev_id +.Nd configuration file for vdev_id(8) .Sh DESCRIPTION .Nm is the configuration file for -.Nm vdev_id Ns Sy (8) . +.Xr vdev_id 8 . It controls the default behavior of -.Nm vdev_id Ns Sy (8) +.Xr vdev_id 8 while it is mapping a disk device name to an alias. .Pp The @@ -37,7 +37,7 @@ Maps a device link in the .Pa /dev directory hierarchy to a new device name. The udev rule defining the device link must have run prior to -.Nm vdev_id Ns Sy (8) . +.Xr vdev_id 8 . A defined alias takes precedence over a topology-derived name, but the two naming methods can otherwise coexist. For example, one might name drives in a JBOD with the @@ -94,12 +94,12 @@ and a default mapping applied to the others. . .It Sy multipath Sy yes Ns | Ns Sy no Specifies whether -.Nm vdev_id Ns Sy (8) +.Xr vdev_id 8 will handle only dm-multipath devices. If set to .Sy yes then -.Nm vdev_id Ns Sy (8) +.Xr vdev_id 8 will examine the first running component disk of a dm-multipath device as provided by the driver command to determine the physical path. . @@ -116,7 +116,7 @@ channels are uniquely identified by a SAS switch port number .It Sy phys_per_port Ar num Specifies the number of PHY devices associated with a SAS HBA port or SAS switch port. -.Nm vdev_id Ns Sy (8) +.Xr vdev_id 8 internally uses this value to determine which HBA or switch port a device is connected to. The default is @@ -157,13 +157,13 @@ may be unstable across disk replacement. .Bl -tag -width "-v v" .It Pa /etc/zfs/vdev_id.conf The configuration file for -.Nm vdev_id Ns Sy (8) . +.Xr vdev_id 8 . .El . .Sh EXAMPLES A non-multipath configuration with direct-attached SAS enclosures and an arbitrary slot re-mapping: -.Bd -literal -offset Ds +.Bd -literal -compact -offset Ds multipath no topology sas_direct phys_per_port 4 @@ -195,8 +195,8 @@ slot 4 3 A SAS-switch topology. Note, that the .Ar channel -keyword takes only two arguments in this example. -.Bd -literal -offset Ds +keyword takes only two arguments in this example: +.Bd -literal -compact -offset Ds topology sas_switch # SWITCH PORT CHANNEL NAME @@ -207,9 +207,8 @@ channel 4 D .Ed .Pp A multipath configuration. -Note that channel names have multiple -definitions - one per physical path. -.Bd -literal -offset Ds +Note that channel names have multiple definitions - one per physical path: +.Bd -literal -compact -offset Ds multipath yes # PCI_SLOT HBA PORT CHANNEL NAME @@ -219,8 +218,8 @@ channel 86:00.0 1 A channel 86:00.0 0 B .Ed .Pp -A configuration with enclosure_symlinks enabled. -.Bd -literal -offset Ds +A configuration with enclosure_symlinks enabled: +.Bd -literal -compact -offset Ds multipath yes enclosure_symlinks yes @@ -230,17 +229,16 @@ channel 05:00.0 0 L channel 06:00.0 1 U channel 06:00.0 0 L .Ed -.Pp In addition to the disks symlinks, this configuration will create: -.Bd -literal -offset Ds +.Bd -literal -compact -offset Ds /dev/by-enclosure/enc-L0 /dev/by-enclosure/enc-L1 /dev/by-enclosure/enc-U0 /dev/by-enclosure/enc-U1 .Ed .Pp -A configuration using device link aliases. -.Bd -literal -offset Ds +A configuration using device link aliases: +.Bd -literal -compact -offset Ds # by-vdev # name fully qualified or base name of device link alias d1 /dev/disk/by-id/wwn-0x5000c5002de3b9ca diff --git a/man/man8/fsck.zfs.8 b/man/man8/fsck.zfs.8 index b88dd847b1bb..0ce7576ebe63 100644 --- a/man/man8/fsck.zfs.8 +++ b/man/man8/fsck.zfs.8 @@ -58,7 +58,9 @@ interface still allows it to communicate some errors: if the .Ar dataset is in a degraded pool, then .Nm -will return exit code 4 to indicate an uncorrected filesystem error. +will return exit code +.Sy 4 +to indicate an uncorrected filesystem error. .Pp Similarly, if the .Ar dataset @@ -66,7 +68,9 @@ is in a faulted pool and has a legacy .Pa /etc/fstab record, then .Nm -will return exit code 8 to indicate a fatal operational error. +will return exit code +.Sy 8 +to indicate a fatal operational error. .Sh SEE ALSO .Xr fstab 5 , .Xr fsck 8 , diff --git a/man/man8/zed.8.in b/man/man8/zed.8.in index b0b26bfcf8e2..d3297605206e 100644 --- a/man/man8/zed.8.in +++ b/man/man8/zed.8.in @@ -147,7 +147,7 @@ is sourced by scripts; these variables should be prefixed with The zevent nvpairs are passed to ZEDLETs as environment variables. Each nvpair name is converted to an environment variable in the following manner: -.Bl -enum +.Bl -enum -compact .It it is prefixed with .Sy ZEVENT_ , @@ -160,7 +160,7 @@ each non-alphanumeric character is converted to an underscore. Some additional environment variables have been defined to present certain nvpair values in a more convenient form. An incomplete list of zevent environment variables is as follows: -.Bl -tag -width "ZEVENT_TIME_STRING" +.Bl -tag -compact -width "ZEVENT_TIME_STRING" .It Sy ZEVENT_EID The Event IDentifier. .It Sy ZEVENT_CLASS @@ -187,7 +187,7 @@ An almost-RFC3339-compliant string for .El .Pp Additionally, the following ZED & ZFS variables are defined: -.Bl -tag -width "ZEVENT_TIME_STRING" +.Bl -tag -compact -width "ZEVENT_TIME_STRING" .It Sy ZED_PID The daemon's process ID. .It Sy ZED_ZEDLET_DIR diff --git a/man/man8/zpool_influxdb.8 b/man/man8/zpool_influxdb.8 index a4e417078fd3..021fbdeaac8a 100644 --- a/man/man8/zpool_influxdb.8 +++ b/man/man8/zpool_influxdb.8 @@ -32,7 +32,7 @@ .Op Fl e Ns | Ns Fl -execd .Op Fl n Ns | Ns Fl -no-histogram .Op Fl s Ns | Ns Fl -sum-histogram-buckets -.Op Fl t Ns | Ns Fl -tags Ar key Ns = Ns Ar value Ns Op , Ns Ar key Ns = Ns Ar value Ns … +.Op Fl t Ns | Ns Fl -tags Ar key Ns = Ns Ar value Ns Oo , Ns Ar key Ns = Ns Ar value Oc Ns … .Op Ar pool . .Sh DESCRIPTION @@ -80,7 +80,7 @@ By default, the values are not accumulated and the raw data appears as shown by .Nm zpool Cm iostat . This works well for Grafana's heatmap plugin. Summing the buckets produces output similar to Prometheus histograms. -.It Fl t , Fl -tags Ar key Ns = Ns Ar value Ns Op , Ns Ar key Ns = Ns Ar value Ns … +.It Fl t , Fl -tags Ar key Ns = Ns Ar value Ns Oo , Ns Ar key Ns = Ns Ar value Oc Ns … Adds specified tags to the tag set. No sanity checking is performed. See the InfluxDB Line Protocol format documentation for details on escaping From 4b7ed6a286c3c92e34f2941dafd822cfa6a880dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 4 Jun 2021 22:43:21 +0200 Subject: [PATCH 09/24] zgenhostid.8: revisit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Richard Laager Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12212 --- man/man8/zgenhostid.8 | 60 ++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/man/man8/zgenhostid.8 b/man/man8/zgenhostid.8 index 3eff55b6d861..0dcebef73c31 100644 --- a/man/man8/zgenhostid.8 +++ b/man/man8/zgenhostid.8 @@ -18,72 +18,78 @@ .\" .\" CDDL HEADER END .\" -.\" .\" Copyright (c) 2017 by Lawrence Livermore National Security, LLC. .\" .Dd May 26, 2021 -.Dt ZGENHOSTID 8 SMM +.Dt ZGENHOSTID 8 .Os +. .Sh NAME .Nm zgenhostid -.Nd generate and store a hostid in -.Em /etc/hostid +.Nd generate host ID into /etc/hostid .Sh SYNOPSIS .Nm .Op Fl f .Op Fl o Ar filename .Op Ar hostid +. .Sh DESCRIPTION Creates .Pa /etc/hostid -file and stores hostid in it. -If the user provides -.Op Ar hostid -on the command line, validates and stores that value. -Otherwise, randomly generates a value to store. -.Bl -tag -width "hostid" +file and stores the host ID in it. +If +.Ar hostid +was provided, validate and store that value. +Otherwise, randomly generate an ID. +. +.Sh OPTIONS +.Bl -tag -width "-o filename" .It Fl h Display a summary of the command-line options. .It Fl f -Force file overwrite. +Allow output overwrite. .It Fl o Ar filename Write to .Pa filename -instead of default -.Pa /etc/hostid +instead of the default +.Pa /etc/hostid . .It Ar hostid Specifies the value to be placed in .Pa /etc/hostid . It should be a number with a value between 1 and 2^32-1. -If it is 0, zgenhostid will generate a random hostid. +If +.Sy 0 , +generate a random ID. This value -.Sy must +.Em must be unique among your systems. It -.Sy must -be expressed in hexadecimal and be exactly -.Em 8 -digits long, optionally prefixed by -.Em 0x . +.Em must +be an 8-digit-long hexadecimal number, optionally prefixed by +.Qq 0x . .El +. .Sh FILES .Pa /etc/hostid +. .Sh EXAMPLES .Bl -tag -width Bd .It Generate a random hostid and store it -.Dl # zgenhostid +.Dl # Nm .It Record the libc-generated hostid in Pa /etc/hostid -.Dl # zgenhostid "$(hostid)" -.It Record a custom hostid (0xdeadbeef) in Pa /etc/hostid -.Dl # zgenhostid deadbeef -.It Record a custom hostid (0x01234567) in Pa /tmp/hostid No and ovewrite the file if it exists -.Dl # zgenhostid -f -o /tmp/hostid 0x01234567 +.Dl # Nm Qq $ Ns Pq Nm hostid +.It Record a custom hostid Po Ar 0xdeadbeef Pc in Pa /etc/hostid +.Dl # Nm Ar deadbeef +.It Record a custom hostid Po Ar 0x01234567 Pc in Pa /tmp/hostid No and ovewrite the file if it exists +.Dl # Nm Fl f o Ar /tmp/hostid 0x01234567 .El +. .Sh SEE ALSO .Xr genhostid 1 , .Xr hostid 1 , .Xr sethostid 3 , .Xr spl 4 +. .Sh HISTORY .Nm emulates the @@ -91,4 +97,4 @@ emulates the utility and is provided for use on systems which do not include the utility or do not provide the .Xr sethostid 3 -call. +function. From d406a695c640dd93f49f8dcb532bfa0394ad1812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 3 Jun 2021 23:34:27 +0200 Subject: [PATCH 10/24] libefi: remove efi_auto_sense() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's present (but undocumented) in the illumos gate and used exclusively by rmformat(1) (which I recommend as a nice blast from the past), and also the math assumes 512B sectors and is therefore wrong Reviewed-by: Matthew Ahrens Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12191 --- include/sys/efi_partition.h | 1 - lib/libefi/rdwr_efi.c | 54 - lib/libzfs_core/libzfs_core.abi | 3491 ++++++++++++++++--------------- 3 files changed, 1749 insertions(+), 1797 deletions(-) diff --git a/include/sys/efi_partition.h b/include/sys/efi_partition.h index 88bdfd2b1ca3..fbb58013e22a 100644 --- a/include/sys/efi_partition.h +++ b/include/sys/efi_partition.h @@ -370,7 +370,6 @@ extern int efi_rescan(int); extern void efi_free(struct dk_gpt *); extern int efi_type(int); extern void efi_err_check(struct dk_gpt *); -extern int efi_auto_sense(int fd, struct dk_gpt **); extern int efi_use_whole_disk(int fd); #endif diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index 1e022cc8eeaa..39b3509a5c4b 100644 --- a/lib/libefi/rdwr_efi.c +++ b/lib/libefi/rdwr_efi.c @@ -1692,57 +1692,3 @@ efi_err_check(struct dk_gpt *vtoc) "no reserved partition found\n"); } } - -/* - * We need to get information necessary to construct a *new* efi - * label type - */ -int -efi_auto_sense(int fd, struct dk_gpt **vtoc) -{ - - int i; - - /* - * Now build the default partition table - */ - if (efi_alloc_and_init(fd, EFI_NUMPAR, vtoc) != 0) { - if (efi_debug) { - (void) fprintf(stderr, "efi_alloc_and_init failed.\n"); - } - return (-1); - } - - for (i = 0; i < MIN((*vtoc)->efi_nparts, V_NUMPAR); i++) { - (*vtoc)->efi_parts[i].p_tag = default_vtoc_map[i].p_tag; - (*vtoc)->efi_parts[i].p_flag = default_vtoc_map[i].p_flag; - (*vtoc)->efi_parts[i].p_start = 0; - (*vtoc)->efi_parts[i].p_size = 0; - } - /* - * Make constants first - * and variable partitions later - */ - - /* root partition - s0 128 MB */ - (*vtoc)->efi_parts[0].p_start = 34; - (*vtoc)->efi_parts[0].p_size = 262144; - - /* partition - s1 128 MB */ - (*vtoc)->efi_parts[1].p_start = 262178; - (*vtoc)->efi_parts[1].p_size = 262144; - - /* partition -s2 is NOT the Backup disk */ - (*vtoc)->efi_parts[2].p_tag = V_UNASSIGNED; - - /* partition -s6 /usr partition - HOG */ - (*vtoc)->efi_parts[6].p_start = 524322; - (*vtoc)->efi_parts[6].p_size = (*vtoc)->efi_last_u_lba - 524322 - - (1024 * 16); - - /* efi reserved partition - s9 16K */ - (*vtoc)->efi_parts[8].p_start = (*vtoc)->efi_last_u_lba - (1024 * 16); - (*vtoc)->efi_parts[8].p_size = (1024 * 16); - (*vtoc)->efi_parts[8].p_tag = V_RESERVED; - return (0); -} diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index 574928cba089..79567d1504db 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -154,7 +154,6 @@ - @@ -291,60 +290,60 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -354,117 +353,104 @@ - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - - + + + - - + + - - - - - - - + + + + + + + - + - + - + - + - + - - - - - - - - - - - - - - + @@ -472,116 +458,129 @@ - + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -589,12 +588,12 @@ - + - + @@ -605,48 +604,48 @@ - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + @@ -656,105 +655,105 @@ - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -762,78 +761,78 @@ - + - + - + - + - - - - + + + + - + - - - - + + + + - - - + + + - - + + - - - - + + + + - + - + - + - + - + - + - - - + + + @@ -865,66 +864,66 @@ - + - + - + - - - - + + + + - + - - - - + + + + - + - - + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - + @@ -932,133 +931,133 @@ - - - - - + + + + + - - - - - - - - + + + + + + + + - + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - + - + - + - + - + - + - - - - - - - + + + + + + + - + - + - + - + - + @@ -1073,55 +1072,55 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1129,58 +1128,58 @@ - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1258,79 +1257,79 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1346,53 +1345,53 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1400,116 +1399,116 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1517,187 +1516,187 @@ - + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + - + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - - - + + + + + + + - + - - + + - - + + - - - - - - - + + + + + + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - - + + + - + - - - - - - + + + + + + - + - - - - - - - - + + + + + + + + - - - - + + + + - + @@ -1709,377 +1708,390 @@ - + - - - - + + + + - + - - - - - + + + + + - + - - - - - + + + + + - - - + + + - - - + + + - - - - - - + + + + + + - + - + + + + + + + + - - - + + + - + - - - - + + + + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + - - - - - + + + + + - + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - + - - + + - + - + - - + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - - - + + + + - - + + - - - + + + + + + + + + + - - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - + - + - + @@ -2089,202 +2101,202 @@ - + - + + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - + + + + + + - - + + + - + + + + + + + + + + - + - + - + - + - - - - - - + + + + + + + + + + + + + + + + + + - + - + - + - + - - + + - + - - + + - + - + - - + + - + - + - + - + - + - + @@ -2293,79 +2305,79 @@ - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - + - + - + - + - - + + @@ -2373,12 +2385,12 @@ - - - + + + - + @@ -2386,71 +2398,71 @@ - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -2458,21 +2470,21 @@ - + - - - + + + - + - + @@ -2480,167 +2492,167 @@ - - - - - - + + + + + + - - - - + + + + - - + + - + - - + + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + @@ -2658,432 +2670,432 @@ - + - + - - + + - - + + - + - + - + - + - - - + + + - - + + - - + + - + - + - - + + - - + + - - - + + + - - + + - + - + - + - - + + - + - + - + - - - - - + - + + + + + - - - + + + - + - + - - - - + + + + - + - + - + - + - + - + - + - + - - - - + + + + - + - - - - + + + + - - + + - + - + - - + + - - - - + + + + - - - - - + + + + + - - + + - - + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - + + - - - + + + - - + + - - - + + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -3096,70 +3108,70 @@ - - + + - + - + - + - - + + - + - + - + - + - - - - - + + + + + - + - + - + - + - - + + - + - + - + - + @@ -3167,103 +3179,103 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - + - + @@ -3273,80 +3285,80 @@ - + - + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + @@ -3354,726 +3366,726 @@ - - + + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -4088,378 +4100,378 @@ - + - - + + - + - + - + - + - + - - - - + + + + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - + + + + + + + - - - - + + + + - - + + - + - + - + - + - + - + - + - - - - + + + + - - + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - + - - - + + + - - + + - - + + - - + + - - - - - + + + + + - - + + - + - + - - + + - - - - - + + + + + - - - - - + + + + + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -4467,19 +4479,19 @@ - - - + + + - - + + - + - + @@ -4487,76 +4499,71 @@ - - - - - - + + + + + + - + - - - + + + - - + + - - + + - - - + + + - + - + - + - + - + - + - - + + - - - - - From 327c904615db9cfcd8c9e07cb56b8e36050a4048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 3 Jun 2021 23:50:07 +0200 Subject: [PATCH 11/24] lib{efi,avl,share,tpool,zfs_core,zfsbootenv,zutil}: -fvisibility=hidden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No symbols affected in libavl No symbols affected by libtpool, but pre-ANSI declarations got purged No symbols affected by libzfs_core No symbols affected by libzfs_bootenv libefi got cleaned, gained efi_debug documentation in efi_partition.h, and removes one undocumented and unused symbol from libzfs_core: D default_vtoc_map libnvpair saw removal of these symbols: D nv_alloc_nosleep_def D nv_alloc_sleep D nv_alloc_sleep_def D nv_fixed_ops_def D nvlist_hashtable_init_size D nvpair_max_recursion libshare saw removal of these symbols from libzfs: T libshare_nfs_init T libshare_smb_init T register_fstype B smb_shares libzutil saw removal of these internal symbols from libzfs_core: T label_paths T slice_cache_compare T zpool_find_import_blkid T zpool_open_func T zutil_alloc T zutil_strdup Reviewed-by: Matthew Ahrens Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12191 --- include/libnvpair.h | 37 +- include/libzfs_core.h | 130 +- include/libzfsbootenv.h | 20 +- include/sys/avl.h | 36 +- include/sys/avl_impl.h | 5 +- include/sys/efi_partition.h | 19 +- include/sys/nvpair.h | 427 +++--- include/thread_pool.h | 36 +- lib/libavl/Makefile.am | 1 + lib/libefi/Makefile.am | 1 + lib/libefi/rdwr_efi.c | 34 - lib/libnvpair/Makefile.am | 1 + lib/libnvpair/libnvpair.abi | 2484 +++++++++++++++---------------- lib/libshare/Makefile.am | 2 + lib/libshare/nfs.c | 2 +- lib/libshare/os/freebsd/nfs.c | 2 +- lib/libshare/os/linux/nfs.c | 2 +- lib/libspl/include/libshare.h | 14 +- lib/libtpool/Makefile.am | 2 + lib/libzfs/libzfs.abi | 183 +-- lib/libzfs_core/Makefile.am | 2 + lib/libzfs_core/libzfs_core.abi | 1629 ++++++++++---------- lib/libzfsbootenv/Makefile.am | 2 + lib/libzutil/Makefile.am | 1 + 24 files changed, 2493 insertions(+), 2579 deletions(-) diff --git a/include/libnvpair.h b/include/libnvpair.h index 5277f9574ddf..bc50c3b7e1f8 100644 --- a/include/libnvpair.h +++ b/include/libnvpair.h @@ -24,7 +24,7 @@ */ #ifndef _LIBNVPAIR_H -#define _LIBNVPAIR_H +#define _LIBNVPAIR_H extern __attribute__((visibility("default"))) #include #include @@ -42,13 +42,13 @@ extern "C" { * are all imported from included above. */ -extern int nvpair_value_match(nvpair_t *, int, char *, char **); -extern int nvpair_value_match_regex(nvpair_t *, int, char *, regex_t *, +_LIBNVPAIR_H int nvpair_value_match(nvpair_t *, int, char *, char **); +_LIBNVPAIR_H int nvpair_value_match_regex(nvpair_t *, int, char *, regex_t *, char **); -extern void nvlist_print(FILE *, nvlist_t *); -int nvlist_print_json(FILE *, nvlist_t *); -extern void dump_nvlist(nvlist_t *, int); +_LIBNVPAIR_H void nvlist_print(FILE *, nvlist_t *); +_LIBNVPAIR_H int nvlist_print_json(FILE *, nvlist_t *); +_LIBNVPAIR_H void dump_nvlist(nvlist_t *, int); /* * Private nvlist printing interface that allows the caller some control @@ -88,18 +88,18 @@ enum nvlist_indent_mode { NVLIST_INDENT_TABBED /* Indent with tabstops */ }; -extern nvlist_prtctl_t nvlist_prtctl_alloc(void); -extern void nvlist_prtctl_free(nvlist_prtctl_t); -extern void nvlist_prt(nvlist_t *, nvlist_prtctl_t); +_LIBNVPAIR_H nvlist_prtctl_t nvlist_prtctl_alloc(void); +_LIBNVPAIR_H void nvlist_prtctl_free(nvlist_prtctl_t); +_LIBNVPAIR_H void nvlist_prt(nvlist_t *, nvlist_prtctl_t); /* Output stream */ -extern void nvlist_prtctl_setdest(nvlist_prtctl_t, FILE *); -extern FILE *nvlist_prtctl_getdest(nvlist_prtctl_t); +_LIBNVPAIR_H void nvlist_prtctl_setdest(nvlist_prtctl_t, FILE *); +_LIBNVPAIR_H FILE *nvlist_prtctl_getdest(nvlist_prtctl_t); /* Indentation mode, start indent, indent increment; default tabbed/0/1 */ -extern void nvlist_prtctl_setindent(nvlist_prtctl_t, enum nvlist_indent_mode, - int, int); -extern void nvlist_prtctl_doindent(nvlist_prtctl_t, int); +_LIBNVPAIR_H void nvlist_prtctl_setindent(nvlist_prtctl_t, + enum nvlist_indent_mode, int, int); +_LIBNVPAIR_H void nvlist_prtctl_doindent(nvlist_prtctl_t, int); enum nvlist_prtctl_fmt { NVLIST_FMT_MEMBER_NAME, /* name fmt; default "%s = " */ @@ -107,9 +107,10 @@ enum nvlist_prtctl_fmt { NVLIST_FMT_BTWN_ARRAY /* between array members; default " " */ }; -extern void nvlist_prtctl_setfmt(nvlist_prtctl_t, enum nvlist_prtctl_fmt, +_LIBNVPAIR_H void nvlist_prtctl_setfmt(nvlist_prtctl_t, enum nvlist_prtctl_fmt, const char *); -extern void nvlist_prtctl_dofmt(nvlist_prtctl_t, enum nvlist_prtctl_fmt, ...); +_LIBNVPAIR_H void nvlist_prtctl_dofmt(nvlist_prtctl_t, enum nvlist_prtctl_fmt, + ...); /* * Function prototypes for interfaces that appoint a new rendering function @@ -139,7 +140,7 @@ extern void nvlist_prtctl_dofmt(nvlist_prtctl_t, enum nvlist_prtctl_fmt, ...); */ #define NVLIST_PRINTCTL_SVDECL(funcname, valtype) \ - extern void funcname(nvlist_prtctl_t, \ + _LIBNVPAIR_H void funcname(nvlist_prtctl_t, \ int (*)(nvlist_prtctl_t, void *, nvlist_t *, const char *, valtype), \ void *) @@ -170,7 +171,7 @@ NVLIST_PRINTCTL_SVDECL(nvlist_prtctlop_nvlist, nvlist_t *); * Return values as above. */ #define NVLIST_PRINTCTL_AVDECL(funcname, vtype) \ - extern void funcname(nvlist_prtctl_t, \ + _LIBNVPAIR_H void funcname(nvlist_prtctl_t, \ int (*)(nvlist_prtctl_t, void *, nvlist_t *, const char *, vtype, uint_t), \ void *) diff --git a/include/libzfs_core.h b/include/libzfs_core.h index 34161a06fb45..83d8211ab615 100644 --- a/include/libzfs_core.h +++ b/include/libzfs_core.h @@ -27,7 +27,7 @@ */ #ifndef _LIBZFS_CORE_H -#define _LIBZFS_CORE_H +#define _LIBZFS_CORE_H extern __attribute__((visibility("default"))) #include #include @@ -38,41 +38,42 @@ extern "C" { #endif -int libzfs_core_init(void); -void libzfs_core_fini(void); +_LIBZFS_CORE_H int libzfs_core_init(void); +_LIBZFS_CORE_H void libzfs_core_fini(void); /* - * NB: this type should be kept binary compatible with dmu_objset_type_t. + * NB: this type should be kept binary-compatible with dmu_objset_type_t. */ enum lzc_dataset_type { LZC_DATSET_TYPE_ZFS = 2, LZC_DATSET_TYPE_ZVOL }; -int lzc_snapshot(nvlist_t *, nvlist_t *, nvlist_t **); -int lzc_create(const char *, enum lzc_dataset_type, nvlist_t *, uint8_t *, +_LIBZFS_CORE_H int lzc_snapshot(nvlist_t *, nvlist_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_create(const char *, enum lzc_dataset_type, nvlist_t *, + uint8_t *, uint_t); +_LIBZFS_CORE_H int lzc_clone(const char *, const char *, nvlist_t *); +_LIBZFS_CORE_H int lzc_promote(const char *, char *, int); +_LIBZFS_CORE_H int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **); +_LIBZFS_CORE_H int lzc_bookmark(nvlist_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_get_bookmark_props(const char *, nvlist_t **); +_LIBZFS_CORE_H int lzc_destroy_bookmarks(nvlist_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_load_key(const char *, boolean_t, uint8_t *, uint_t); +_LIBZFS_CORE_H int lzc_unload_key(const char *); +_LIBZFS_CORE_H int lzc_change_key(const char *, uint64_t, nvlist_t *, uint8_t *, uint_t); -int lzc_clone(const char *, const char *, nvlist_t *); -int lzc_promote(const char *, char *, int); -int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **); -int lzc_bookmark(nvlist_t *, nvlist_t **); -int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **); -int lzc_get_bookmark_props(const char *, nvlist_t **); -int lzc_destroy_bookmarks(nvlist_t *, nvlist_t **); -int lzc_load_key(const char *, boolean_t, uint8_t *, uint_t); -int lzc_unload_key(const char *); -int lzc_change_key(const char *, uint64_t, nvlist_t *, uint8_t *, uint_t); -int lzc_initialize(const char *, pool_initialize_func_t, nvlist_t *, - nvlist_t **); -int lzc_trim(const char *, pool_trim_func_t, uint64_t, boolean_t, +_LIBZFS_CORE_H int lzc_initialize(const char *, pool_initialize_func_t, nvlist_t *, nvlist_t **); -int lzc_redact(const char *, const char *, nvlist_t *); +_LIBZFS_CORE_H int lzc_trim(const char *, pool_trim_func_t, uint64_t, boolean_t, + nvlist_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_redact(const char *, const char *, nvlist_t *); -int lzc_snaprange_space(const char *, const char *, uint64_t *); +_LIBZFS_CORE_H int lzc_snaprange_space(const char *, const char *, uint64_t *); -int lzc_hold(nvlist_t *, int, nvlist_t **); -int lzc_release(nvlist_t *, nvlist_t **); -int lzc_get_holds(const char *, nvlist_t **); +_LIBZFS_CORE_H int lzc_hold(nvlist_t *, int, nvlist_t **); +_LIBZFS_CORE_H int lzc_release(nvlist_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_get_holds(const char *, nvlist_t **); enum lzc_send_flags { LZC_SEND_FLAG_EMBED_DATA = 1 << 0, @@ -82,61 +83,66 @@ enum lzc_send_flags { LZC_SEND_FLAG_SAVED = 1 << 4, }; -int lzc_send(const char *, const char *, int, enum lzc_send_flags); -int lzc_send_resume(const char *, const char *, int, +_LIBZFS_CORE_H int lzc_send(const char *, const char *, int, + enum lzc_send_flags); +_LIBZFS_CORE_H int lzc_send_resume(const char *, const char *, int, enum lzc_send_flags, uint64_t, uint64_t); -int lzc_send_space(const char *, const char *, enum lzc_send_flags, uint64_t *); +_LIBZFS_CORE_H int lzc_send_space(const char *, const char *, + enum lzc_send_flags, uint64_t *); struct dmu_replay_record; -int lzc_send_redacted(const char *, const char *, int, enum lzc_send_flags, - const char *); -int lzc_send_resume_redacted(const char *, const char *, int, +_LIBZFS_CORE_H int lzc_send_redacted(const char *, const char *, int, + enum lzc_send_flags, const char *); +_LIBZFS_CORE_H int lzc_send_resume_redacted(const char *, const char *, int, enum lzc_send_flags, uint64_t, uint64_t, const char *); -int lzc_receive(const char *, nvlist_t *, const char *, boolean_t, boolean_t, - int); -int lzc_receive_resumable(const char *, nvlist_t *, const char *, boolean_t, - boolean_t, int); -int lzc_receive_with_header(const char *, nvlist_t *, const char *, boolean_t, - boolean_t, boolean_t, int, const struct dmu_replay_record *); -int lzc_receive_one(const char *, nvlist_t *, const char *, boolean_t, - boolean_t, boolean_t, int, const struct dmu_replay_record *, int, +_LIBZFS_CORE_H int lzc_receive(const char *, nvlist_t *, const char *, + boolean_t, boolean_t, int); +_LIBZFS_CORE_H int lzc_receive_resumable(const char *, nvlist_t *, const char *, + boolean_t, boolean_t, int); +_LIBZFS_CORE_H int lzc_receive_with_header(const char *, nvlist_t *, + const char *, boolean_t, boolean_t, boolean_t, int, + const struct dmu_replay_record *); +_LIBZFS_CORE_H int lzc_receive_one(const char *, nvlist_t *, const char *, + boolean_t, boolean_t, boolean_t, int, const struct dmu_replay_record *, int, uint64_t *, uint64_t *, uint64_t *, nvlist_t **); -int lzc_receive_with_cmdprops(const char *, nvlist_t *, nvlist_t *, - uint8_t *, uint_t, const char *, boolean_t, boolean_t, boolean_t, int, - const struct dmu_replay_record *, int, uint64_t *, uint64_t *, - uint64_t *, nvlist_t **); -int lzc_send_space(const char *, const char *, enum lzc_send_flags, uint64_t *); -int lzc_send_space_resume_redacted(const char *, const char *, +_LIBZFS_CORE_H int lzc_receive_with_cmdprops(const char *, nvlist_t *, + nvlist_t *, uint8_t *, uint_t, const char *, boolean_t, boolean_t, + boolean_t, int, const struct dmu_replay_record *, int, uint64_t *, + uint64_t *, uint64_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_send_space(const char *, const char *, + enum lzc_send_flags, uint64_t *); +_LIBZFS_CORE_H int lzc_send_space_resume_redacted(const char *, const char *, enum lzc_send_flags, uint64_t, uint64_t, uint64_t, const char *, int, uint64_t *); -uint64_t lzc_send_progress(int); +_LIBZFS_CORE_H uint64_t lzc_send_progress(int); -boolean_t lzc_exists(const char *); +_LIBZFS_CORE_H boolean_t lzc_exists(const char *); -int lzc_rollback(const char *, char *, int); -int lzc_rollback_to(const char *, const char *); +_LIBZFS_CORE_H int lzc_rollback(const char *, char *, int); +_LIBZFS_CORE_H int lzc_rollback_to(const char *, const char *); -int lzc_rename(const char *, const char *); -int lzc_destroy(const char *); +_LIBZFS_CORE_H int lzc_rename(const char *, const char *); +_LIBZFS_CORE_H int lzc_destroy(const char *); -int lzc_channel_program(const char *, const char *, uint64_t, - uint64_t, nvlist_t *, nvlist_t **); -int lzc_channel_program_nosync(const char *, const char *, uint64_t, +_LIBZFS_CORE_H int lzc_channel_program(const char *, const char *, uint64_t, uint64_t, nvlist_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_channel_program_nosync(const char *, const char *, + uint64_t, uint64_t, nvlist_t *, nvlist_t **); -int lzc_sync(const char *, nvlist_t *, nvlist_t **); -int lzc_reopen(const char *, boolean_t); +_LIBZFS_CORE_H int lzc_sync(const char *, nvlist_t *, nvlist_t **); +_LIBZFS_CORE_H int lzc_reopen(const char *, boolean_t); -int lzc_pool_checkpoint(const char *); -int lzc_pool_checkpoint_discard(const char *); +_LIBZFS_CORE_H int lzc_pool_checkpoint(const char *); +_LIBZFS_CORE_H int lzc_pool_checkpoint_discard(const char *); -int lzc_wait(const char *, zpool_wait_activity_t, boolean_t *); -int lzc_wait_tag(const char *, zpool_wait_activity_t, uint64_t, boolean_t *); -int lzc_wait_fs(const char *, zfs_wait_activity_t, boolean_t *); +_LIBZFS_CORE_H int lzc_wait(const char *, zpool_wait_activity_t, boolean_t *); +_LIBZFS_CORE_H int lzc_wait_tag(const char *, zpool_wait_activity_t, uint64_t, + boolean_t *); +_LIBZFS_CORE_H int lzc_wait_fs(const char *, zfs_wait_activity_t, boolean_t *); -int lzc_set_bootenv(const char *, const nvlist_t *); -int lzc_get_bootenv(const char *, nvlist_t **); +_LIBZFS_CORE_H int lzc_set_bootenv(const char *, const nvlist_t *); +_LIBZFS_CORE_H int lzc_get_bootenv(const char *, nvlist_t **); #ifdef __cplusplus } #endif diff --git a/include/libzfsbootenv.h b/include/libzfsbootenv.h index b078b605db7f..cbc8751dc51b 100644 --- a/include/libzfsbootenv.h +++ b/include/libzfsbootenv.h @@ -14,7 +14,7 @@ */ #ifndef _LIBZFSBOOTENV_H -#define _LIBZFSBOOTENV_H +#define _LIBZFSBOOTENV_H extern __attribute__((visibility("default"))) #ifdef __cplusplus extern "C" { @@ -25,14 +25,16 @@ typedef enum lzbe_flags { lzbe_replace /* replace current nvlist */ } lzbe_flags_t; -extern int lzbe_nvlist_get(const char *, const char *, void **); -extern int lzbe_nvlist_set(const char *, const char *, void *); -extern void lzbe_nvlist_free(void *); -extern int lzbe_add_pair(void *, const char *, const char *, void *, size_t); -extern int lzbe_remove_pair(void *, const char *); -extern int lzbe_set_boot_device(const char *, lzbe_flags_t, const char *); -extern int lzbe_get_boot_device(const char *, char **); -extern int lzbe_bootenv_print(const char *, const char *, FILE *); +_LIBZFSBOOTENV_H int lzbe_nvlist_get(const char *, const char *, void **); +_LIBZFSBOOTENV_H int lzbe_nvlist_set(const char *, const char *, void *); +_LIBZFSBOOTENV_H void lzbe_nvlist_free(void *); +_LIBZFSBOOTENV_H int lzbe_add_pair(void *, const char *, const char *, void *, + size_t); +_LIBZFSBOOTENV_H int lzbe_remove_pair(void *, const char *); +_LIBZFSBOOTENV_H int lzbe_set_boot_device(const char *, lzbe_flags_t, + const char *); +_LIBZFSBOOTENV_H int lzbe_get_boot_device(const char *, char **); +_LIBZFSBOOTENV_H int lzbe_bootenv_print(const char *, const char *, FILE *); #ifdef __cplusplus } diff --git a/include/sys/avl.h b/include/sys/avl.h index ed3c6f86a568..20e88f2a6b06 100644 --- a/include/sys/avl.h +++ b/include/sys/avl.h @@ -28,7 +28,7 @@ */ #ifndef _AVL_H -#define _AVL_H +#define _AVL_H extern __attribute__((visibility("default"))) /* * This is a private header file. Applications should not directly include @@ -160,7 +160,7 @@ typedef uintptr_t avl_index_t; * size - the value of sizeof(struct my_type) * offset - the value of OFFSETOF(struct my_type, my_link) */ -extern void avl_create(avl_tree_t *tree, +_AVL_H void avl_create(avl_tree_t *tree, int (*compar) (const void *, const void *), size_t size, size_t offset); @@ -172,7 +172,7 @@ extern void avl_create(avl_tree_t *tree, * node - node that has the value being looked for * where - position for use with avl_nearest() or avl_insert(), may be NULL */ -extern void *avl_find(avl_tree_t *tree, const void *node, avl_index_t *where); +_AVL_H void *avl_find(avl_tree_t *tree, const void *node, avl_index_t *where); /* * Insert a node into the tree. @@ -180,7 +180,7 @@ extern void *avl_find(avl_tree_t *tree, const void *node, avl_index_t *where); * node - the node to insert * where - position as returned from avl_find() */ -extern void avl_insert(avl_tree_t *tree, void *node, avl_index_t where); +_AVL_H void avl_insert(avl_tree_t *tree, void *node, avl_index_t where); /* * Insert "new_data" in "tree" in the given "direction" either after @@ -193,7 +193,7 @@ extern void avl_insert(avl_tree_t *tree, void *node, avl_index_t where); * here - existing node in "tree" * direction - either AVL_AFTER or AVL_BEFORE the data "here". */ -extern void avl_insert_here(avl_tree_t *tree, void *new_data, void *here, +_AVL_H void avl_insert_here(avl_tree_t *tree, void *new_data, void *here, int direction); @@ -202,8 +202,8 @@ extern void avl_insert_here(avl_tree_t *tree, void *new_data, void *here, * if the tree is empty. * */ -extern void *avl_first(avl_tree_t *tree); -extern void *avl_last(avl_tree_t *tree); +_AVL_H void *avl_first(avl_tree_t *tree); +_AVL_H void *avl_last(avl_tree_t *tree); /* @@ -239,7 +239,7 @@ extern void *avl_last(avl_tree_t *tree); * else * less = avl_nearest(tree, where, AVL_BEFORE); */ -extern void *avl_nearest(avl_tree_t *tree, avl_index_t where, int direction); +_AVL_H void *avl_nearest(avl_tree_t *tree, avl_index_t where, int direction); /* @@ -249,7 +249,7 @@ extern void *avl_nearest(avl_tree_t *tree, avl_index_t where, int direction); * * node - the node to add */ -extern void avl_add(avl_tree_t *tree, void *node); +_AVL_H void avl_add(avl_tree_t *tree, void *node); /* @@ -257,7 +257,7 @@ extern void avl_add(avl_tree_t *tree, void *node); * * node - the node to remove */ -extern void avl_remove(avl_tree_t *tree, void *node); +_AVL_H void avl_remove(avl_tree_t *tree, void *node); /* * Reinsert a node only if its order has changed relative to its nearest @@ -266,24 +266,24 @@ extern void avl_remove(avl_tree_t *tree, void *node); * avl_update_gt() only if you know the direction in which the order of the * node may change. */ -extern boolean_t avl_update(avl_tree_t *, void *); -extern boolean_t avl_update_lt(avl_tree_t *, void *); -extern boolean_t avl_update_gt(avl_tree_t *, void *); +_AVL_H boolean_t avl_update(avl_tree_t *, void *); +_AVL_H boolean_t avl_update_lt(avl_tree_t *, void *); +_AVL_H boolean_t avl_update_gt(avl_tree_t *, void *); /* * Swaps the contents of the two trees. */ -extern void avl_swap(avl_tree_t *tree1, avl_tree_t *tree2); +_AVL_H void avl_swap(avl_tree_t *tree1, avl_tree_t *tree2); /* * Return the number of nodes in the tree */ -extern ulong_t avl_numnodes(avl_tree_t *tree); +_AVL_H ulong_t avl_numnodes(avl_tree_t *tree); /* * Return B_TRUE if there are zero nodes in the tree, B_FALSE otherwise. */ -extern boolean_t avl_is_empty(avl_tree_t *tree); +_AVL_H boolean_t avl_is_empty(avl_tree_t *tree); /* * Used to destroy any remaining nodes in a tree. The cookie argument should @@ -306,7 +306,7 @@ extern boolean_t avl_is_empty(avl_tree_t *tree); * free(node); * avl_destroy(tree); */ -extern void *avl_destroy_nodes(avl_tree_t *tree, void **cookie); +_AVL_H void *avl_destroy_nodes(avl_tree_t *tree, void **cookie); /* @@ -314,7 +314,7 @@ extern void *avl_destroy_nodes(avl_tree_t *tree, void **cookie); * * tree - the empty tree to destroy */ -extern void avl_destroy(avl_tree_t *tree); +_AVL_H void avl_destroy(avl_tree_t *tree); diff --git a/include/sys/avl_impl.h b/include/sys/avl_impl.h index fddf76906dee..f577ecd42f7c 100644 --- a/include/sys/avl_impl.h +++ b/include/sys/avl_impl.h @@ -25,8 +25,7 @@ */ #ifndef _AVL_IMPL_H -#define _AVL_IMPL_H - +#define _AVL_IMPL_H extern __attribute__((visibility("default"))) /* @@ -155,7 +154,7 @@ struct avl_tree { /* * This will only by used via AVL_NEXT() or AVL_PREV() */ -extern void *avl_walk(struct avl_tree *, void *, int); +_AVL_IMPL_H void *avl_walk(struct avl_tree *, void *, int); #ifdef __cplusplus } diff --git a/include/sys/efi_partition.h b/include/sys/efi_partition.h index fbb58013e22a..cda2c98e5d53 100644 --- a/include/sys/efi_partition.h +++ b/include/sys/efi_partition.h @@ -24,7 +24,7 @@ */ #ifndef _SYS_EFI_PARTITION_H -#define _SYS_EFI_PARTITION_H +#define _SYS_EFI_PARTITION_H extern __attribute__((visibility("default"))) #include @@ -363,14 +363,15 @@ struct partition64 { #endif #ifndef _KERNEL -extern int efi_alloc_and_init(int, uint32_t, struct dk_gpt **); -extern int efi_alloc_and_read(int, struct dk_gpt **); -extern int efi_write(int, struct dk_gpt *); -extern int efi_rescan(int); -extern void efi_free(struct dk_gpt *); -extern int efi_type(int); -extern void efi_err_check(struct dk_gpt *); -extern int efi_use_whole_disk(int fd); +_SYS_EFI_PARTITION_H int efi_debug; +_SYS_EFI_PARTITION_H int efi_alloc_and_init(int, uint32_t, struct dk_gpt **); +_SYS_EFI_PARTITION_H int efi_alloc_and_read(int, struct dk_gpt **); +_SYS_EFI_PARTITION_H int efi_write(int, struct dk_gpt *); +_SYS_EFI_PARTITION_H int efi_rescan(int); +_SYS_EFI_PARTITION_H void efi_free(struct dk_gpt *); +_SYS_EFI_PARTITION_H int efi_type(int); +_SYS_EFI_PARTITION_H void efi_err_check(struct dk_gpt *); +_SYS_EFI_PARTITION_H int efi_use_whole_disk(int fd); #endif #ifdef __cplusplus diff --git a/include/sys/nvpair.h b/include/sys/nvpair.h index b0be8bd7ada1..76d383a3c681 100644 --- a/include/sys/nvpair.h +++ b/include/sys/nvpair.h @@ -24,7 +24,7 @@ */ #ifndef _SYS_NVPAIR_H -#define _SYS_NVPAIR_H +#define _SYS_NVPAIR_H extern __attribute__((visibility("default"))) #include #include @@ -135,221 +135,270 @@ struct nv_alloc_ops { void (*nv_ao_reset)(nv_alloc_t *); }; -extern const nv_alloc_ops_t *nv_fixed_ops; -extern nv_alloc_t *nv_alloc_nosleep; +_SYS_NVPAIR_H const nv_alloc_ops_t *nv_fixed_ops; +_SYS_NVPAIR_H nv_alloc_t *nv_alloc_nosleep; #if defined(_KERNEL) -extern nv_alloc_t *nv_alloc_sleep; -extern nv_alloc_t *nv_alloc_pushpage; +_SYS_NVPAIR_H nv_alloc_t *nv_alloc_sleep; +_SYS_NVPAIR_H nv_alloc_t *nv_alloc_pushpage; #endif -int nv_alloc_init(nv_alloc_t *, const nv_alloc_ops_t *, /* args */ ...); -void nv_alloc_reset(nv_alloc_t *); -void nv_alloc_fini(nv_alloc_t *); +_SYS_NVPAIR_H int nv_alloc_init(nv_alloc_t *, const nv_alloc_ops_t *, + /* args */ ...); +_SYS_NVPAIR_H void nv_alloc_reset(nv_alloc_t *); +_SYS_NVPAIR_H void nv_alloc_fini(nv_alloc_t *); /* list management */ -int nvlist_alloc(nvlist_t **, uint_t, int); -void nvlist_free(nvlist_t *); -int nvlist_size(nvlist_t *, size_t *, int); -int nvlist_pack(nvlist_t *, char **, size_t *, int, int); -int nvlist_unpack(char *, size_t, nvlist_t **, int); -int nvlist_dup(nvlist_t *, nvlist_t **, int); -int nvlist_merge(nvlist_t *, nvlist_t *, int); +_SYS_NVPAIR_H int nvlist_alloc(nvlist_t **, uint_t, int); +_SYS_NVPAIR_H void nvlist_free(nvlist_t *); +_SYS_NVPAIR_H int nvlist_size(nvlist_t *, size_t *, int); +_SYS_NVPAIR_H int nvlist_pack(nvlist_t *, char **, size_t *, int, int); +_SYS_NVPAIR_H int nvlist_unpack(char *, size_t, nvlist_t **, int); +_SYS_NVPAIR_H int nvlist_dup(nvlist_t *, nvlist_t **, int); +_SYS_NVPAIR_H int nvlist_merge(nvlist_t *, nvlist_t *, int); -uint_t nvlist_nvflag(nvlist_t *); +_SYS_NVPAIR_H uint_t nvlist_nvflag(nvlist_t *); -int nvlist_xalloc(nvlist_t **, uint_t, nv_alloc_t *); -int nvlist_xpack(nvlist_t *, char **, size_t *, int, nv_alloc_t *); -int nvlist_xunpack(char *, size_t, nvlist_t **, nv_alloc_t *); -int nvlist_xdup(nvlist_t *, nvlist_t **, nv_alloc_t *); -nv_alloc_t *nvlist_lookup_nv_alloc(nvlist_t *); +_SYS_NVPAIR_H int nvlist_xalloc(nvlist_t **, uint_t, nv_alloc_t *); +_SYS_NVPAIR_H int nvlist_xpack(nvlist_t *, char **, size_t *, int, + nv_alloc_t *); +_SYS_NVPAIR_H int nvlist_xunpack(char *, size_t, nvlist_t **, nv_alloc_t *); +_SYS_NVPAIR_H int nvlist_xdup(nvlist_t *, nvlist_t **, nv_alloc_t *); +_SYS_NVPAIR_H nv_alloc_t *nvlist_lookup_nv_alloc(nvlist_t *); -int nvlist_add_nvpair(nvlist_t *, nvpair_t *); -int nvlist_add_boolean(nvlist_t *, const char *); -int nvlist_add_boolean_value(nvlist_t *, const char *, boolean_t); -int nvlist_add_byte(nvlist_t *, const char *, uchar_t); -int nvlist_add_int8(nvlist_t *, const char *, int8_t); -int nvlist_add_uint8(nvlist_t *, const char *, uint8_t); -int nvlist_add_int16(nvlist_t *, const char *, int16_t); -int nvlist_add_uint16(nvlist_t *, const char *, uint16_t); -int nvlist_add_int32(nvlist_t *, const char *, int32_t); -int nvlist_add_uint32(nvlist_t *, const char *, uint32_t); -int nvlist_add_int64(nvlist_t *, const char *, int64_t); -int nvlist_add_uint64(nvlist_t *, const char *, uint64_t); -int nvlist_add_string(nvlist_t *, const char *, const char *); -int nvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *); -int nvlist_add_boolean_array(nvlist_t *, const char *, boolean_t *, uint_t); -int nvlist_add_byte_array(nvlist_t *, const char *, uchar_t *, uint_t); -int nvlist_add_int8_array(nvlist_t *, const char *, int8_t *, uint_t); -int nvlist_add_uint8_array(nvlist_t *, const char *, uint8_t *, uint_t); -int nvlist_add_int16_array(nvlist_t *, const char *, int16_t *, uint_t); -int nvlist_add_uint16_array(nvlist_t *, const char *, uint16_t *, uint_t); -int nvlist_add_int32_array(nvlist_t *, const char *, int32_t *, uint_t); -int nvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, uint_t); -int nvlist_add_int64_array(nvlist_t *, const char *, int64_t *, uint_t); -int nvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t); -int nvlist_add_string_array(nvlist_t *, const char *, char *const *, uint_t); -int nvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t); -int nvlist_add_hrtime(nvlist_t *, const char *, hrtime_t); +_SYS_NVPAIR_H int nvlist_add_nvpair(nvlist_t *, nvpair_t *); +_SYS_NVPAIR_H int nvlist_add_boolean(nvlist_t *, const char *); +_SYS_NVPAIR_H int nvlist_add_boolean_value(nvlist_t *, const char *, boolean_t); +_SYS_NVPAIR_H int nvlist_add_byte(nvlist_t *, const char *, uchar_t); +_SYS_NVPAIR_H int nvlist_add_int8(nvlist_t *, const char *, int8_t); +_SYS_NVPAIR_H int nvlist_add_uint8(nvlist_t *, const char *, uint8_t); +_SYS_NVPAIR_H int nvlist_add_int16(nvlist_t *, const char *, int16_t); +_SYS_NVPAIR_H int nvlist_add_uint16(nvlist_t *, const char *, uint16_t); +_SYS_NVPAIR_H int nvlist_add_int32(nvlist_t *, const char *, int32_t); +_SYS_NVPAIR_H int nvlist_add_uint32(nvlist_t *, const char *, uint32_t); +_SYS_NVPAIR_H int nvlist_add_int64(nvlist_t *, const char *, int64_t); +_SYS_NVPAIR_H int nvlist_add_uint64(nvlist_t *, const char *, uint64_t); +_SYS_NVPAIR_H int nvlist_add_string(nvlist_t *, const char *, const char *); +_SYS_NVPAIR_H int nvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *); +_SYS_NVPAIR_H int nvlist_add_boolean_array(nvlist_t *, const char *, + boolean_t *, uint_t); +_SYS_NVPAIR_H int nvlist_add_byte_array(nvlist_t *, const char *, uchar_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_int8_array(nvlist_t *, const char *, int8_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_uint8_array(nvlist_t *, const char *, uint8_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_int16_array(nvlist_t *, const char *, int16_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_uint16_array(nvlist_t *, const char *, uint16_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_int32_array(nvlist_t *, const char *, int32_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_int64_array(nvlist_t *, const char *, int64_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, + uint_t); +_SYS_NVPAIR_H int nvlist_add_string_array(nvlist_t *, const char *, + char * const *, uint_t); +_SYS_NVPAIR_H int nvlist_add_nvlist_array(nvlist_t *, const char *, + nvlist_t **, uint_t); +_SYS_NVPAIR_H int nvlist_add_hrtime(nvlist_t *, const char *, hrtime_t); #if !defined(_KERNEL) && !defined(_STANDALONE) -int nvlist_add_double(nvlist_t *, const char *, double); +_SYS_NVPAIR_H int nvlist_add_double(nvlist_t *, const char *, double); #endif -int nvlist_remove(nvlist_t *, const char *, data_type_t); -int nvlist_remove_all(nvlist_t *, const char *); -int nvlist_remove_nvpair(nvlist_t *, nvpair_t *); +_SYS_NVPAIR_H int nvlist_remove(nvlist_t *, const char *, data_type_t); +_SYS_NVPAIR_H int nvlist_remove_all(nvlist_t *, const char *); +_SYS_NVPAIR_H int nvlist_remove_nvpair(nvlist_t *, nvpair_t *); -int nvlist_lookup_boolean(nvlist_t *, const char *); -int nvlist_lookup_boolean_value(nvlist_t *, const char *, boolean_t *); -int nvlist_lookup_byte(nvlist_t *, const char *, uchar_t *); -int nvlist_lookup_int8(nvlist_t *, const char *, int8_t *); -int nvlist_lookup_uint8(nvlist_t *, const char *, uint8_t *); -int nvlist_lookup_int16(nvlist_t *, const char *, int16_t *); -int nvlist_lookup_uint16(nvlist_t *, const char *, uint16_t *); -int nvlist_lookup_int32(nvlist_t *, const char *, int32_t *); -int nvlist_lookup_uint32(nvlist_t *, const char *, uint32_t *); -int nvlist_lookup_int64(nvlist_t *, const char *, int64_t *); -int nvlist_lookup_uint64(nvlist_t *, const char *, uint64_t *); -int nvlist_lookup_string(nvlist_t *, const char *, char **); -int nvlist_lookup_nvlist(nvlist_t *, const char *, nvlist_t **); -int nvlist_lookup_boolean_array(nvlist_t *, const char *, +_SYS_NVPAIR_H int nvlist_lookup_boolean(nvlist_t *, const char *); +_SYS_NVPAIR_H int nvlist_lookup_boolean_value(nvlist_t *, const char *, + boolean_t *); +_SYS_NVPAIR_H int nvlist_lookup_byte(nvlist_t *, const char *, uchar_t *); +_SYS_NVPAIR_H int nvlist_lookup_int8(nvlist_t *, const char *, int8_t *); +_SYS_NVPAIR_H int nvlist_lookup_uint8(nvlist_t *, const char *, uint8_t *); +_SYS_NVPAIR_H int nvlist_lookup_int16(nvlist_t *, const char *, int16_t *); +_SYS_NVPAIR_H int nvlist_lookup_uint16(nvlist_t *, const char *, uint16_t *); +_SYS_NVPAIR_H int nvlist_lookup_int32(nvlist_t *, const char *, int32_t *); +_SYS_NVPAIR_H int nvlist_lookup_uint32(nvlist_t *, const char *, uint32_t *); +_SYS_NVPAIR_H int nvlist_lookup_int64(nvlist_t *, const char *, int64_t *); +_SYS_NVPAIR_H int nvlist_lookup_uint64(nvlist_t *, const char *, uint64_t *); +_SYS_NVPAIR_H int nvlist_lookup_string(nvlist_t *, const char *, char **); +_SYS_NVPAIR_H int nvlist_lookup_nvlist(nvlist_t *, const char *, nvlist_t **); +_SYS_NVPAIR_H int nvlist_lookup_boolean_array(nvlist_t *, const char *, boolean_t **, uint_t *); -int nvlist_lookup_byte_array(nvlist_t *, const char *, uchar_t **, uint_t *); -int nvlist_lookup_int8_array(nvlist_t *, const char *, int8_t **, uint_t *); -int nvlist_lookup_uint8_array(nvlist_t *, const char *, uint8_t **, uint_t *); -int nvlist_lookup_int16_array(nvlist_t *, const char *, int16_t **, uint_t *); -int nvlist_lookup_uint16_array(nvlist_t *, const char *, uint16_t **, uint_t *); -int nvlist_lookup_int32_array(nvlist_t *, const char *, int32_t **, uint_t *); -int nvlist_lookup_uint32_array(nvlist_t *, const char *, uint32_t **, uint_t *); -int nvlist_lookup_int64_array(nvlist_t *, const char *, int64_t **, uint_t *); -int nvlist_lookup_uint64_array(nvlist_t *, const char *, uint64_t **, uint_t *); -int nvlist_lookup_string_array(nvlist_t *, const char *, char ***, uint_t *); -int nvlist_lookup_nvlist_array(nvlist_t *, const char *, +_SYS_NVPAIR_H int nvlist_lookup_byte_array(nvlist_t *, const char *, uchar_t **, + uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_int8_array(nvlist_t *, const char *, int8_t **, + uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_uint8_array(nvlist_t *, const char *, + uint8_t **, uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_int16_array(nvlist_t *, const char *, + int16_t **, uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_uint16_array(nvlist_t *, const char *, + uint16_t **, uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_int32_array(nvlist_t *, const char *, + int32_t **, uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_uint32_array(nvlist_t *, const char *, + uint32_t **, uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_int64_array(nvlist_t *, const char *, + int64_t **, uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_uint64_array(nvlist_t *, const char *, + uint64_t **, uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_string_array(nvlist_t *, const char *, + char ***, uint_t *); +_SYS_NVPAIR_H int nvlist_lookup_nvlist_array(nvlist_t *, const char *, nvlist_t ***, uint_t *); -int nvlist_lookup_hrtime(nvlist_t *, const char *, hrtime_t *); -int nvlist_lookup_pairs(nvlist_t *, int, ...); +_SYS_NVPAIR_H int nvlist_lookup_hrtime(nvlist_t *, const char *, hrtime_t *); +_SYS_NVPAIR_H int nvlist_lookup_pairs(nvlist_t *, int, ...); #if !defined(_KERNEL) && !defined(_STANDALONE) -int nvlist_lookup_double(nvlist_t *, const char *, double *); +_SYS_NVPAIR_H int nvlist_lookup_double(nvlist_t *, const char *, double *); #endif -int nvlist_lookup_nvpair(nvlist_t *, const char *, nvpair_t **); -int nvlist_lookup_nvpair_embedded_index(nvlist_t *, const char *, nvpair_t **, - int *, char **); -boolean_t nvlist_exists(nvlist_t *, const char *); -boolean_t nvlist_empty(nvlist_t *); +_SYS_NVPAIR_H int nvlist_lookup_nvpair(nvlist_t *, const char *, nvpair_t **); +_SYS_NVPAIR_H int nvlist_lookup_nvpair_embedded_index(nvlist_t *, const char *, + nvpair_t **, int *, char **); +_SYS_NVPAIR_H boolean_t nvlist_exists(nvlist_t *, const char *); +_SYS_NVPAIR_H boolean_t nvlist_empty(nvlist_t *); /* processing nvpair */ -nvpair_t *nvlist_next_nvpair(nvlist_t *, nvpair_t *); -nvpair_t *nvlist_prev_nvpair(nvlist_t *, nvpair_t *); -char *nvpair_name(nvpair_t *); -data_type_t nvpair_type(nvpair_t *); -int nvpair_type_is_array(nvpair_t *); -int nvpair_value_boolean_value(nvpair_t *, boolean_t *); -int nvpair_value_byte(nvpair_t *, uchar_t *); -int nvpair_value_int8(nvpair_t *, int8_t *); -int nvpair_value_uint8(nvpair_t *, uint8_t *); -int nvpair_value_int16(nvpair_t *, int16_t *); -int nvpair_value_uint16(nvpair_t *, uint16_t *); -int nvpair_value_int32(nvpair_t *, int32_t *); -int nvpair_value_uint32(nvpair_t *, uint32_t *); -int nvpair_value_int64(nvpair_t *, int64_t *); -int nvpair_value_uint64(nvpair_t *, uint64_t *); -int nvpair_value_string(nvpair_t *, char **); -int nvpair_value_nvlist(nvpair_t *, nvlist_t **); -int nvpair_value_boolean_array(nvpair_t *, boolean_t **, uint_t *); -int nvpair_value_byte_array(nvpair_t *, uchar_t **, uint_t *); -int nvpair_value_int8_array(nvpair_t *, int8_t **, uint_t *); -int nvpair_value_uint8_array(nvpair_t *, uint8_t **, uint_t *); -int nvpair_value_int16_array(nvpair_t *, int16_t **, uint_t *); -int nvpair_value_uint16_array(nvpair_t *, uint16_t **, uint_t *); -int nvpair_value_int32_array(nvpair_t *, int32_t **, uint_t *); -int nvpair_value_uint32_array(nvpair_t *, uint32_t **, uint_t *); -int nvpair_value_int64_array(nvpair_t *, int64_t **, uint_t *); -int nvpair_value_uint64_array(nvpair_t *, uint64_t **, uint_t *); -int nvpair_value_string_array(nvpair_t *, char ***, uint_t *); -int nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *); -int nvpair_value_hrtime(nvpair_t *, hrtime_t *); +_SYS_NVPAIR_H nvpair_t *nvlist_next_nvpair(nvlist_t *, nvpair_t *); +_SYS_NVPAIR_H nvpair_t *nvlist_prev_nvpair(nvlist_t *, nvpair_t *); +_SYS_NVPAIR_H char *nvpair_name(nvpair_t *); +_SYS_NVPAIR_H data_type_t nvpair_type(nvpair_t *); +_SYS_NVPAIR_H int nvpair_type_is_array(nvpair_t *); +_SYS_NVPAIR_H int nvpair_value_boolean_value(nvpair_t *, boolean_t *); +_SYS_NVPAIR_H int nvpair_value_byte(nvpair_t *, uchar_t *); +_SYS_NVPAIR_H int nvpair_value_int8(nvpair_t *, int8_t *); +_SYS_NVPAIR_H int nvpair_value_uint8(nvpair_t *, uint8_t *); +_SYS_NVPAIR_H int nvpair_value_int16(nvpair_t *, int16_t *); +_SYS_NVPAIR_H int nvpair_value_uint16(nvpair_t *, uint16_t *); +_SYS_NVPAIR_H int nvpair_value_int32(nvpair_t *, int32_t *); +_SYS_NVPAIR_H int nvpair_value_uint32(nvpair_t *, uint32_t *); +_SYS_NVPAIR_H int nvpair_value_int64(nvpair_t *, int64_t *); +_SYS_NVPAIR_H int nvpair_value_uint64(nvpair_t *, uint64_t *); +_SYS_NVPAIR_H int nvpair_value_string(nvpair_t *, char **); +_SYS_NVPAIR_H int nvpair_value_nvlist(nvpair_t *, nvlist_t **); +_SYS_NVPAIR_H int nvpair_value_boolean_array(nvpair_t *, boolean_t **, + uint_t *); +_SYS_NVPAIR_H int nvpair_value_byte_array(nvpair_t *, uchar_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_int8_array(nvpair_t *, int8_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_uint8_array(nvpair_t *, uint8_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_int16_array(nvpair_t *, int16_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_uint16_array(nvpair_t *, uint16_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_int32_array(nvpair_t *, int32_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_uint32_array(nvpair_t *, uint32_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_int64_array(nvpair_t *, int64_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_uint64_array(nvpair_t *, uint64_t **, uint_t *); +_SYS_NVPAIR_H int nvpair_value_string_array(nvpair_t *, char ***, uint_t *); +_SYS_NVPAIR_H int nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *); +_SYS_NVPAIR_H int nvpair_value_hrtime(nvpair_t *, hrtime_t *); #if !defined(_KERNEL) && !defined(_STANDALONE) -int nvpair_value_double(nvpair_t *, double *); +_SYS_NVPAIR_H int nvpair_value_double(nvpair_t *, double *); #endif -nvlist_t *fnvlist_alloc(void); -void fnvlist_free(nvlist_t *); -size_t fnvlist_size(nvlist_t *); -char *fnvlist_pack(nvlist_t *, size_t *); -void fnvlist_pack_free(char *, size_t); -nvlist_t *fnvlist_unpack(char *, size_t); -nvlist_t *fnvlist_dup(nvlist_t *); -void fnvlist_merge(nvlist_t *, nvlist_t *); -size_t fnvlist_num_pairs(nvlist_t *); +_SYS_NVPAIR_H nvlist_t *fnvlist_alloc(void); +_SYS_NVPAIR_H void fnvlist_free(nvlist_t *); +_SYS_NVPAIR_H size_t fnvlist_size(nvlist_t *); +_SYS_NVPAIR_H char *fnvlist_pack(nvlist_t *, size_t *); +_SYS_NVPAIR_H void fnvlist_pack_free(char *, size_t); +_SYS_NVPAIR_H nvlist_t *fnvlist_unpack(char *, size_t); +_SYS_NVPAIR_H nvlist_t *fnvlist_dup(nvlist_t *); +_SYS_NVPAIR_H void fnvlist_merge(nvlist_t *, nvlist_t *); +_SYS_NVPAIR_H size_t fnvlist_num_pairs(nvlist_t *); -void fnvlist_add_boolean(nvlist_t *, const char *); -void fnvlist_add_boolean_value(nvlist_t *, const char *, boolean_t); -void fnvlist_add_byte(nvlist_t *, const char *, uchar_t); -void fnvlist_add_int8(nvlist_t *, const char *, int8_t); -void fnvlist_add_uint8(nvlist_t *, const char *, uint8_t); -void fnvlist_add_int16(nvlist_t *, const char *, int16_t); -void fnvlist_add_uint16(nvlist_t *, const char *, uint16_t); -void fnvlist_add_int32(nvlist_t *, const char *, int32_t); -void fnvlist_add_uint32(nvlist_t *, const char *, uint32_t); -void fnvlist_add_int64(nvlist_t *, const char *, int64_t); -void fnvlist_add_uint64(nvlist_t *, const char *, uint64_t); -void fnvlist_add_string(nvlist_t *, const char *, const char *); -void fnvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *); -void fnvlist_add_nvpair(nvlist_t *, nvpair_t *); -void fnvlist_add_boolean_array(nvlist_t *, const char *, boolean_t *, uint_t); -void fnvlist_add_byte_array(nvlist_t *, const char *, uchar_t *, uint_t); -void fnvlist_add_int8_array(nvlist_t *, const char *, int8_t *, uint_t); -void fnvlist_add_uint8_array(nvlist_t *, const char *, uint8_t *, uint_t); -void fnvlist_add_int16_array(nvlist_t *, const char *, int16_t *, uint_t); -void fnvlist_add_uint16_array(nvlist_t *, const char *, uint16_t *, uint_t); -void fnvlist_add_int32_array(nvlist_t *, const char *, int32_t *, uint_t); -void fnvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, uint_t); -void fnvlist_add_int64_array(nvlist_t *, const char *, int64_t *, uint_t); -void fnvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t); -void fnvlist_add_string_array(nvlist_t *, const char *, char * const *, uint_t); -void fnvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t); +_SYS_NVPAIR_H void fnvlist_add_boolean(nvlist_t *, const char *); +_SYS_NVPAIR_H void fnvlist_add_boolean_value(nvlist_t *, const char *, + boolean_t); +_SYS_NVPAIR_H void fnvlist_add_byte(nvlist_t *, const char *, uchar_t); +_SYS_NVPAIR_H void fnvlist_add_int8(nvlist_t *, const char *, int8_t); +_SYS_NVPAIR_H void fnvlist_add_uint8(nvlist_t *, const char *, uint8_t); +_SYS_NVPAIR_H void fnvlist_add_int16(nvlist_t *, const char *, int16_t); +_SYS_NVPAIR_H void fnvlist_add_uint16(nvlist_t *, const char *, uint16_t); +_SYS_NVPAIR_H void fnvlist_add_int32(nvlist_t *, const char *, int32_t); +_SYS_NVPAIR_H void fnvlist_add_uint32(nvlist_t *, const char *, uint32_t); +_SYS_NVPAIR_H void fnvlist_add_int64(nvlist_t *, const char *, int64_t); +_SYS_NVPAIR_H void fnvlist_add_uint64(nvlist_t *, const char *, uint64_t); +_SYS_NVPAIR_H void fnvlist_add_string(nvlist_t *, const char *, const char *); +_SYS_NVPAIR_H void fnvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *); +_SYS_NVPAIR_H void fnvlist_add_nvpair(nvlist_t *, nvpair_t *); +_SYS_NVPAIR_H void fnvlist_add_boolean_array(nvlist_t *, const char *, + boolean_t *, uint_t); +_SYS_NVPAIR_H void fnvlist_add_byte_array(nvlist_t *, const char *, uchar_t *, + uint_t); +_SYS_NVPAIR_H void fnvlist_add_int8_array(nvlist_t *, const char *, int8_t *, + uint_t); +_SYS_NVPAIR_H void fnvlist_add_uint8_array(nvlist_t *, const char *, uint8_t *, + uint_t); +_SYS_NVPAIR_H void fnvlist_add_int16_array(nvlist_t *, const char *, int16_t *, + uint_t); +_SYS_NVPAIR_H void fnvlist_add_uint16_array(nvlist_t *, const char *, + uint16_t *, uint_t); +_SYS_NVPAIR_H void fnvlist_add_int32_array(nvlist_t *, const char *, int32_t *, + uint_t); +_SYS_NVPAIR_H void fnvlist_add_uint32_array(nvlist_t *, const char *, + uint32_t *, uint_t); +_SYS_NVPAIR_H void fnvlist_add_int64_array(nvlist_t *, const char *, int64_t *, + uint_t); +_SYS_NVPAIR_H void fnvlist_add_uint64_array(nvlist_t *, const char *, + uint64_t *, uint_t); +_SYS_NVPAIR_H void fnvlist_add_string_array(nvlist_t *, const char *, + char * const *, uint_t); +_SYS_NVPAIR_H void fnvlist_add_nvlist_array(nvlist_t *, const char *, + nvlist_t **, uint_t); -void fnvlist_remove(nvlist_t *, const char *); -void fnvlist_remove_nvpair(nvlist_t *, nvpair_t *); +_SYS_NVPAIR_H void fnvlist_remove(nvlist_t *, const char *); +_SYS_NVPAIR_H void fnvlist_remove_nvpair(nvlist_t *, nvpair_t *); -nvpair_t *fnvlist_lookup_nvpair(nvlist_t *, const char *); -boolean_t fnvlist_lookup_boolean(nvlist_t *, const char *); -boolean_t fnvlist_lookup_boolean_value(nvlist_t *, const char *); -uchar_t fnvlist_lookup_byte(nvlist_t *, const char *); -int8_t fnvlist_lookup_int8(nvlist_t *, const char *); -int16_t fnvlist_lookup_int16(nvlist_t *, const char *); -int32_t fnvlist_lookup_int32(nvlist_t *, const char *); -int64_t fnvlist_lookup_int64(nvlist_t *, const char *); -uint8_t fnvlist_lookup_uint8(nvlist_t *, const char *); -uint16_t fnvlist_lookup_uint16(nvlist_t *, const char *); -uint32_t fnvlist_lookup_uint32(nvlist_t *, const char *); -uint64_t fnvlist_lookup_uint64(nvlist_t *, const char *); -char *fnvlist_lookup_string(nvlist_t *, const char *); -nvlist_t *fnvlist_lookup_nvlist(nvlist_t *, const char *); -boolean_t *fnvlist_lookup_boolean_array(nvlist_t *, const char *, uint_t *); -uchar_t *fnvlist_lookup_byte_array(nvlist_t *, const char *, uint_t *); -int8_t *fnvlist_lookup_int8_array(nvlist_t *, const char *, uint_t *); -uint8_t *fnvlist_lookup_uint8_array(nvlist_t *, const char *, uint_t *); -int16_t *fnvlist_lookup_int16_array(nvlist_t *, const char *, uint_t *); -uint16_t *fnvlist_lookup_uint16_array(nvlist_t *, const char *, uint_t *); -int32_t *fnvlist_lookup_int32_array(nvlist_t *, const char *, uint_t *); -uint32_t *fnvlist_lookup_uint32_array(nvlist_t *, const char *, uint_t *); -int64_t *fnvlist_lookup_int64_array(nvlist_t *, const char *, uint_t *); -uint64_t *fnvlist_lookup_uint64_array(nvlist_t *, const char *, uint_t *); +_SYS_NVPAIR_H nvpair_t *fnvlist_lookup_nvpair(nvlist_t *, const char *); +_SYS_NVPAIR_H boolean_t fnvlist_lookup_boolean(nvlist_t *, const char *); +_SYS_NVPAIR_H boolean_t fnvlist_lookup_boolean_value(nvlist_t *, const char *); +_SYS_NVPAIR_H uchar_t fnvlist_lookup_byte(nvlist_t *, const char *); +_SYS_NVPAIR_H int8_t fnvlist_lookup_int8(nvlist_t *, const char *); +_SYS_NVPAIR_H int16_t fnvlist_lookup_int16(nvlist_t *, const char *); +_SYS_NVPAIR_H int32_t fnvlist_lookup_int32(nvlist_t *, const char *); +_SYS_NVPAIR_H int64_t fnvlist_lookup_int64(nvlist_t *, const char *); +_SYS_NVPAIR_H uint8_t fnvlist_lookup_uint8(nvlist_t *, const char *); +_SYS_NVPAIR_H uint16_t fnvlist_lookup_uint16(nvlist_t *, const char *); +_SYS_NVPAIR_H uint32_t fnvlist_lookup_uint32(nvlist_t *, const char *); +_SYS_NVPAIR_H uint64_t fnvlist_lookup_uint64(nvlist_t *, const char *); +_SYS_NVPAIR_H char *fnvlist_lookup_string(nvlist_t *, const char *); +_SYS_NVPAIR_H nvlist_t *fnvlist_lookup_nvlist(nvlist_t *, const char *); +_SYS_NVPAIR_H boolean_t *fnvlist_lookup_boolean_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H uchar_t *fnvlist_lookup_byte_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H int8_t *fnvlist_lookup_int8_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H uint8_t *fnvlist_lookup_uint8_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H int16_t *fnvlist_lookup_int16_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H uint16_t *fnvlist_lookup_uint16_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H int32_t *fnvlist_lookup_int32_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H uint32_t *fnvlist_lookup_uint32_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H int64_t *fnvlist_lookup_int64_array(nvlist_t *, const char *, + uint_t *); +_SYS_NVPAIR_H uint64_t *fnvlist_lookup_uint64_array(nvlist_t *, const char *, + uint_t *); -boolean_t fnvpair_value_boolean_value(nvpair_t *nvp); -uchar_t fnvpair_value_byte(nvpair_t *nvp); -int8_t fnvpair_value_int8(nvpair_t *nvp); -int16_t fnvpair_value_int16(nvpair_t *nvp); -int32_t fnvpair_value_int32(nvpair_t *nvp); -int64_t fnvpair_value_int64(nvpair_t *nvp); -uint8_t fnvpair_value_uint8(nvpair_t *nvp); -uint16_t fnvpair_value_uint16(nvpair_t *nvp); -uint32_t fnvpair_value_uint32(nvpair_t *nvp); -uint64_t fnvpair_value_uint64(nvpair_t *nvp); -char *fnvpair_value_string(nvpair_t *nvp); -nvlist_t *fnvpair_value_nvlist(nvpair_t *nvp); +_SYS_NVPAIR_H boolean_t fnvpair_value_boolean_value(nvpair_t *nvp); +_SYS_NVPAIR_H uchar_t fnvpair_value_byte(nvpair_t *nvp); +_SYS_NVPAIR_H int8_t fnvpair_value_int8(nvpair_t *nvp); +_SYS_NVPAIR_H int16_t fnvpair_value_int16(nvpair_t *nvp); +_SYS_NVPAIR_H int32_t fnvpair_value_int32(nvpair_t *nvp); +_SYS_NVPAIR_H int64_t fnvpair_value_int64(nvpair_t *nvp); +_SYS_NVPAIR_H uint8_t fnvpair_value_uint8(nvpair_t *nvp); +_SYS_NVPAIR_H uint16_t fnvpair_value_uint16(nvpair_t *nvp); +_SYS_NVPAIR_H uint32_t fnvpair_value_uint32(nvpair_t *nvp); +_SYS_NVPAIR_H uint64_t fnvpair_value_uint64(nvpair_t *nvp); +_SYS_NVPAIR_H char *fnvpair_value_string(nvpair_t *nvp); +_SYS_NVPAIR_H nvlist_t *fnvpair_value_nvlist(nvpair_t *nvp); #ifdef __cplusplus } diff --git a/include/thread_pool.h b/include/thread_pool.h index 57266f11c5a6..43090c3c6644 100644 --- a/include/thread_pool.h +++ b/include/thread_pool.h @@ -25,7 +25,7 @@ */ #ifndef _THREAD_POOL_H_ -#define _THREAD_POOL_H_ +#define _THREAD_POOL_H_ extern __attribute__((visibility("default"))) #include #include @@ -37,33 +37,17 @@ extern "C" { typedef struct tpool tpool_t; /* opaque thread pool descriptor */ -#if defined(__STDC__) - -extern tpool_t *tpool_create(uint_t min_threads, uint_t max_threads, +_THREAD_POOL_H_ tpool_t *tpool_create(uint_t min_threads, uint_t max_threads, uint_t linger, pthread_attr_t *attr); -extern int tpool_dispatch(tpool_t *tpool, +_THREAD_POOL_H_ int tpool_dispatch(tpool_t *tpool, void (*func)(void *), void *arg); -extern void tpool_destroy(tpool_t *tpool); -extern void tpool_abandon(tpool_t *tpool); -extern void tpool_wait(tpool_t *tpool); -extern void tpool_suspend(tpool_t *tpool); -extern int tpool_suspended(tpool_t *tpool); -extern void tpool_resume(tpool_t *tpool); -extern int tpool_member(tpool_t *tpool); - -#else /* Non ANSI */ - -extern tpool_t *tpool_create(); -extern int tpool_dispatch(); -extern void tpool_destroy(); -extern void tpool_abandon(); -extern void tpool_wait(); -extern void tpool_suspend(); -extern int tpool_suspended(); -extern void tpool_resume(); -extern int tpool_member(); - -#endif /* __STDC__ */ +_THREAD_POOL_H_ void tpool_destroy(tpool_t *tpool); +_THREAD_POOL_H_ void tpool_abandon(tpool_t *tpool); +_THREAD_POOL_H_ void tpool_wait(tpool_t *tpool); +_THREAD_POOL_H_ void tpool_suspend(tpool_t *tpool); +_THREAD_POOL_H_ int tpool_suspended(tpool_t *tpool); +_THREAD_POOL_H_ void tpool_resume(tpool_t *tpool); +_THREAD_POOL_H_ int tpool_member(tpool_t *tpool); #ifdef __cplusplus } diff --git a/lib/libavl/Makefile.am b/lib/libavl/Makefile.am index 2e0a431c77fb..3166febd02c5 100644 --- a/lib/libavl/Makefile.am +++ b/lib/libavl/Makefile.am @@ -4,6 +4,7 @@ VPATH = $(top_srcdir)/module/avl/ # Includes kernel code, generate warnings for large stack frames AM_CFLAGS += $(FRAME_LARGER_THAN) +AM_CFLAGS += -fvisibility=hidden noinst_LTLIBRARIES = libavl.la diff --git a/lib/libefi/Makefile.am b/lib/libefi/Makefile.am index b26f7a6dcd5b..580319a31495 100644 --- a/lib/libefi/Makefile.am +++ b/lib/libefi/Makefile.am @@ -1,6 +1,7 @@ include $(top_srcdir)/config/Rules.am AM_CFLAGS += $(LIBUUID_CFLAGS) $(ZLIB_CFLAGS) +AM_CFLAGS += -fvisibility=hidden noinst_LTLIBRARIES = libefi.la diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index 39b3509a5c4b..fd243e230e7d 100644 --- a/lib/libefi/rdwr_efi.c +++ b/lib/libefi/rdwr_efi.c @@ -140,40 +140,6 @@ static struct uuid_to_ptag { { EFI_FREEDESKTOP_BOOT } }; -/* - * Default vtoc information for non-SVr4 partitions - */ -struct dk_map2 default_vtoc_map[NDKMAP] = { - { V_ROOT, 0 }, /* a - 0 */ - { V_SWAP, V_UNMNT }, /* b - 1 */ - { V_BACKUP, V_UNMNT }, /* c - 2 */ - { V_UNASSIGNED, 0 }, /* d - 3 */ - { V_UNASSIGNED, 0 }, /* e - 4 */ - { V_UNASSIGNED, 0 }, /* f - 5 */ - { V_USR, 0 }, /* g - 6 */ - { V_UNASSIGNED, 0 }, /* h - 7 */ - -#if defined(_SUNOS_VTOC_16) - -#if defined(i386) || defined(__amd64) || defined(__arm) || \ - defined(__powerpc) || defined(__sparc) || defined(__s390__) || \ - defined(__mips__) || defined(__rv64g__) - { V_BOOT, V_UNMNT }, /* i - 8 */ - { V_ALTSCTR, 0 }, /* j - 9 */ - -#else -#error No VTOC format defined. -#endif /* defined(i386) */ - - { V_UNASSIGNED, 0 }, /* k - 10 */ - { V_UNASSIGNED, 0 }, /* l - 11 */ - { V_UNASSIGNED, 0 }, /* m - 12 */ - { V_UNASSIGNED, 0 }, /* n - 13 */ - { V_UNASSIGNED, 0 }, /* o - 14 */ - { V_UNASSIGNED, 0 }, /* p - 15 */ -#endif /* defined(_SUNOS_VTOC_16) */ -}; - int efi_debug = 0; static int efi_read(int, struct dk_gpt *); diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am index a3e1fa307f7c..7b9ebebe7906 100644 --- a/lib/libnvpair/Makefile.am +++ b/lib/libnvpair/Makefile.am @@ -7,6 +7,7 @@ VPATH = \ # 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 lib_LTLIBRARIES = libnvpair.la diff --git a/lib/libnvpair/libnvpair.abi b/lib/libnvpair/libnvpair.abi index 697a67b7fc61..8c503fecd152 100644 --- a/lib/libnvpair/libnvpair.abi +++ b/lib/libnvpair/libnvpair.abi @@ -232,132 +232,126 @@ - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -367,7 +361,7 @@ - + @@ -376,677 +370,677 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - + + - - - - - + + + + + - - - + + + - + - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - - + + - - - + + + - + - + - + - + - + - + - + @@ -1078,280 +1072,280 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - - - - - - + + + + + + - + - + - + - + - + - + @@ -1359,11 +1353,11 @@ - - - - - + + + + + @@ -1823,45 +1817,45 @@ - - - - + + + + - + - + - + - + - + - + - + - + - + @@ -1869,36 +1863,36 @@ - + - + - + - + - + - + - + - + - + - + @@ -1907,7 +1901,7 @@ - + @@ -1915,46 +1909,46 @@ - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1962,13 +1956,10 @@ - + - - - - + @@ -1990,721 +1981,718 @@ - - - + + - - - - - - + + + + - - + + - - + + - - + + - - + + - - - - + + + + - - - - + + + + - - + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - - - - + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - - - + + + + @@ -2718,92 +2706,71 @@ - + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - + @@ -2812,7 +2779,28 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -2874,40 +2862,40 @@ - - + + - + - - + + - + - - + + - + - - - + + + - + @@ -2915,734 +2903,734 @@ - - - + + + - - - + + + - + - - + + - + - - - + + + - + - - + + - - - + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/lib/libshare/Makefile.am b/lib/libshare/Makefile.am index e42609c6496d..dff3e5382d6e 100644 --- a/lib/libshare/Makefile.am +++ b/lib/libshare/Makefile.am @@ -2,6 +2,8 @@ include $(top_srcdir)/config/Rules.am DEFAULT_INCLUDES += -I$(srcdir) +AM_CFLAGS += -fvisibility=hidden + noinst_LTLIBRARIES = libshare.la USER_C = \ diff --git a/lib/libshare/nfs.c b/lib/libshare/nfs.c index 44d3e93d42f0..e339ebc81f1b 100644 --- a/lib/libshare/nfs.c +++ b/lib/libshare/nfs.c @@ -119,7 +119,7 @@ nfs_fini_tmpfile(const char *exports, char *tmpfile) return (SA_OK); } -__attribute__((visibility("hidden"))) int +int 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, char *filename)) diff --git a/lib/libshare/os/freebsd/nfs.c b/lib/libshare/os/freebsd/nfs.c index b82491f2ebe8..0041bc228bb5 100644 --- a/lib/libshare/os/freebsd/nfs.c +++ b/lib/libshare/os/freebsd/nfs.c @@ -147,7 +147,7 @@ translate_opts(const char *shareopts) * This function copies all entries from the exports file to "filename", * omitting any entries for the specified mountpoint. */ -__attribute__((visibility("hidden"))) int +int nfs_copy_entries(char *filename, const char *mountpoint) { int error = SA_OK; diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index c236f25698f2..bd578adeec5d 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -400,7 +400,7 @@ nfs_add_entry(const char *filename, const char *sharepath, * This function copies all entries from the exports file to "filename", * omitting any entries for the specified mountpoint. */ -__attribute__((visibility("hidden"))) int +int nfs_copy_entries(char *filename, const char *mountpoint) { char *buf = NULL; diff --git a/lib/libspl/include/libshare.h b/lib/libspl/include/libshare.h index ea53f8c15089..5d06b163a3ba 100644 --- a/lib/libspl/include/libshare.h +++ b/lib/libspl/include/libshare.h @@ -25,7 +25,7 @@ * Copyright (c) 2019, 2020 by Delphix. All rights reserved. */ #ifndef _LIBSPL_LIBSHARE_H -#define _LIBSPL_LIBSHARE_H +#define _LIBSPL_LIBSHARE_H extern __attribute__((visibility("default"))) /* API Initialization */ #define SA_INIT_SHARE_API 0x0001 /* init share specific interface */ @@ -71,16 +71,16 @@ #define SA_SHARE_EXISTS 33 /* path or file is already shared */ /* initialization */ -extern char *sa_errorstr(int); +_LIBSPL_LIBSHARE_H char *sa_errorstr(int); /* share control */ -extern int sa_enable_share(const char *, const char *, const char *, +_LIBSPL_LIBSHARE_H int sa_enable_share(const char *, const char *, const char *, char *); -extern int sa_disable_share(const char *, char *); -extern boolean_t sa_is_shared(const char *, char *); -extern void sa_commit_shares(const 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 *); /* protocol specific interfaces */ -extern int sa_validate_shareopts(char *, char *); +_LIBSPL_LIBSHARE_H int sa_validate_shareopts(char *, char *); #endif /* _LIBSPL_LIBSHARE_H */ diff --git a/lib/libtpool/Makefile.am b/lib/libtpool/Makefile.am index aa8bde32f963..40fd137b4335 100644 --- a/lib/libtpool/Makefile.am +++ b/lib/libtpool/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += -fvisibility=hidden + noinst_LTLIBRARIES = libtpool.la USER_C = \ diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 3dd8b2b14510..9a1d95d96ce9 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -34,8 +34,6 @@ - - @@ -59,7 +57,6 @@ - @@ -350,7 +347,6 @@ - @@ -2686,13 +2682,6 @@ - - - - - - - @@ -2701,6 +2690,13 @@ + + + + + + + @@ -7576,6 +7572,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7643,23 +7684,21 @@ - + - - - - + + + + - - - - - - - - - - + + + + + + + + @@ -7668,6 +7707,11 @@ + + + + + @@ -7686,93 +7730,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -7789,10 +7752,10 @@ - + - + diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am index 67e554dc8706..b2101e21144d 100644 --- a/lib/libzfs_core/Makefile.am +++ b/lib/libzfs_core/Makefile.am @@ -2,6 +2,8 @@ include $(top_srcdir)/config/Rules.am pkgconfig_DATA = libzfs_core.pc +AM_CFLAGS += -fvisibility=hidden + lib_LTLIBRARIES = libzfs_core.la include $(top_srcdir)/config/Abigail.am diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index 79567d1504db..f397929e1afe 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -166,7 +166,6 @@ - @@ -240,7 +239,6 @@ - @@ -276,17 +274,12 @@ - - - - - @@ -1802,63 +1795,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + @@ -1870,14 +1811,14 @@ - + - + - + @@ -1888,16 +1829,16 @@ - + - + - + @@ -1909,20 +1850,20 @@ - + - + - + - - - + + + - + @@ -1931,10 +1872,10 @@ - + - + @@ -1942,74 +1883,74 @@ - - + + - + - + - + - + - - + + - + - + - - + + - + - - + + - - - - - + + + + + - - + + - - - + + + - + - + - - + + - + - + @@ -2019,25 +1960,13 @@ - - - - - - - - - - - - - - + + - - + + @@ -2046,7 +1975,7 @@ - + @@ -2072,12 +2001,27 @@ - - + + + + + + + + + + + + + + + + + - - + + @@ -2086,72 +2030,97 @@ - + - + - + - - + + - + - - + - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - - - - - + + + + + - + - + - - + + @@ -2197,8 +2166,8 @@ - - + + @@ -2212,8 +2181,8 @@ - - + + @@ -2225,42 +2194,42 @@ - - + + - - + + - + - + + - - + - + - + - + @@ -2275,12 +2244,12 @@ - + - - + + @@ -2303,21 +2272,21 @@ - - + + - + - + - + - + - + @@ -2326,15 +2295,15 @@ - - - + + + - - + + - + @@ -2344,13 +2313,13 @@ - + - + @@ -2359,28 +2328,28 @@ - + - + - + - - + + - + @@ -2390,7 +2359,7 @@ - + @@ -2402,7 +2371,7 @@ - + @@ -2431,7 +2400,7 @@ - + @@ -2457,25 +2426,25 @@ - - - - + + + + - + - - + + - - - + + + - - + + @@ -2490,14 +2459,14 @@ - - + + - - + + @@ -2519,15 +2488,15 @@ - + - + - + - + @@ -2536,10 +2505,10 @@ - + - - + + @@ -2555,7 +2524,7 @@ - + @@ -2569,16 +2538,16 @@ - + - + - + - + @@ -2587,27 +2556,27 @@ - + - + - + - - - - + + + + - + - + @@ -2619,65 +2588,65 @@ - - + + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - - + + - + - + @@ -2688,27 +2657,27 @@ - - + + + + + + + + + + - - - - - - - - - + - - + + @@ -2716,23 +2685,19 @@ - - - - - + - + - + @@ -2744,122 +2709,111 @@ - + - + - + - + - - - + + + - + - - + + - - + + - + - - + + - - + + - + - + - - - - - - - - - - - - - - + + + - + - + - - + + - - + + - + - + - - - + + + - - + + - + - + - + - + - + - + @@ -2878,143 +2832,145 @@ - - + + - + + + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -3038,38 +2994,39 @@ - - - + + + + - + - + - + - + - + - + - + - + - + - + @@ -3078,19 +3035,19 @@ - + - + - + - + - - + + @@ -3099,212 +3056,212 @@ - + - - + + - - + + - + - + - - - - + + + + - + - + - - + + - - + + - - + + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - - + + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - - + + - - + + - - + + - + - - + + - + - + - + - - + + - + - + - + - + - - + + - - + + - + - - + + - + - + @@ -3312,56 +3269,56 @@ - + - + - + - + - + - + - + - - + + - + - + - + - + - + @@ -3370,603 +3327,603 @@ - - + + - + - - - + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - - - + + + - - + + - - + + - + - + - + - + - + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - - + + - + - - + + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - + - + - - + + - + - - + + - - - + + + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - + + + - + - + - + - + - + - + - + - + - - + + - - + + - + - - - + + + - - - + + + - - - + + + - + - + - - - + + + - + - + - - - + + + - - - + + + - - - + + + - + - + - - - + + + - + - + - - - - + + + + - - - - + + + + - - - - + + + + - + - + - - - - + + + + - + - + - + - - - + + + - - - + + + - - - + + + - + - + - - - + + + - + - + - + - + @@ -3996,7 +3953,7 @@ - + @@ -4034,10 +3991,10 @@ - + - + @@ -4046,28 +4003,28 @@ - + - + - + - + - + - + - + - + @@ -4079,36 +4036,36 @@ - + - - - - + + + + - - + + - - - - + + + + - - + + - + - - - + + + @@ -4122,14 +4079,14 @@ - + - - - + + + - + @@ -4149,24 +4106,24 @@ - + - - + + - + - + - - + + - + @@ -4186,76 +4143,76 @@ - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - + + + + + + + - + - + - - + + - + @@ -4263,126 +4220,126 @@ - + - + - + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - + - + - + - + - + - + - - + + - + @@ -4418,16 +4375,16 @@ - + - + - + @@ -4462,49 +4419,35 @@ - - - + + + - - + + - - + + - + - + - + - - - - - - - - - - - - - - - + @@ -4513,7 +4456,7 @@ - + @@ -4526,18 +4469,18 @@ - + - - + + - + - + @@ -4562,7 +4505,7 @@ - + diff --git a/lib/libzfsbootenv/Makefile.am b/lib/libzfsbootenv/Makefile.am index 984df0b8a353..0c454a5e031b 100644 --- a/lib/libzfsbootenv/Makefile.am +++ b/lib/libzfsbootenv/Makefile.am @@ -2,6 +2,8 @@ include $(top_srcdir)/config/Rules.am pkgconfig_DATA = libzfsbootenv.pc +AM_CFLAGS += -fvisibility=hidden + lib_LTLIBRARIES = libzfsbootenv.la include $(top_srcdir)/config/Abigail.am diff --git a/lib/libzutil/Makefile.am b/lib/libzutil/Makefile.am index 2f0357e9f900..0bc29f05e0fb 100644 --- a/lib/libzutil/Makefile.am +++ b/lib/libzutil/Makefile.am @@ -3,6 +3,7 @@ include $(top_srcdir)/config/Rules.am # Suppress unused but set variable warnings often due to ASSERTs AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS) +AM_CFLAGS += -fvisibility=hidden DEFAULT_INCLUDES += -I$(srcdir) From 860051f1d1ef7ee995188b852d8da36bce85b1dc Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Wed, 9 Jun 2021 20:57:57 -0400 Subject: [PATCH 12/24] Added error for writing to /dev/ on Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Starting in Linux 5.10, trying to write to /dev/{null,zero} errors out. Prefer to inform people when this happens rather than hoping they guess what's wrong. Reviewed-by: Antonio Russo Reviewed-by: Ahelenia Ziemiańska Reviewed-by: Brian Behlendorf Reviewed-by: John Kennedy Signed-off-by: Rich Ercolani Closes: #11991 --- cmd/zfs/zfs_main.c | 38 ++++++++++++++++++++++++++++++++++-- lib/libzfs/libzfs_sendrecv.c | 1 + 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index c583053dbaec..38bfdc91aeaf 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -728,6 +728,32 @@ finish_progress(char *done) pt_header = NULL; } +/* This function checks if the passed fd refers to /dev/null or /dev/zero */ +#ifdef __linux__ +static boolean_t +is_dev_nullzero(int fd) +{ + struct stat st; + fstat(fd, &st); + return (major(st.st_rdev) == 1 && (minor(st.st_rdev) == 3 /* null */ || + minor(st.st_rdev) == 5 /* zero */)); +} +#endif + +static void +note_dev_error(int err, int fd) +{ +#ifdef __linux__ + if (err == EINVAL && is_dev_nullzero(fd)) { + (void) fprintf(stderr, + gettext("Error: Writing directly to /dev/{null,zero} files" + " on certain kernels is not currently implemented.\n" + "(As a workaround, " + "try \"zfs send [...] | cat > /dev/null\")\n")); + } +#endif +} + static int zfs_mount_and_share(libzfs_handle_t *hdl, const char *dataset, zfs_type_t type) { @@ -4572,11 +4598,16 @@ zfs_do_send(int argc, char **argv) err = zfs_send_saved(zhp, &flags, STDOUT_FILENO, resume_token); + if (err != 0) + note_dev_error(errno, STDOUT_FILENO); zfs_close(zhp); return (err != 0); } else if (resume_token != NULL) { - return (zfs_send_resume(g_zfs, &flags, STDOUT_FILENO, - resume_token)); + err = zfs_send_resume(g_zfs, &flags, STDOUT_FILENO, + resume_token); + if (err != 0) + note_dev_error(errno, STDOUT_FILENO); + return (err); } if (flags.skipmissing && !flags.replicate) { @@ -4627,6 +4658,8 @@ zfs_do_send(int argc, char **argv) err = zfs_send_one(zhp, fromname, STDOUT_FILENO, &flags, redactbook); zfs_close(zhp); + if (err != 0) + note_dev_error(errno, STDOUT_FILENO); return (err != 0); } @@ -4703,6 +4736,7 @@ zfs_do_send(int argc, char **argv) nvlist_free(dbgnv); } zfs_close(zhp); + note_dev_error(errno, STDOUT_FILENO); return (err != 0); } diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 2ba673fd09f7..136255786cc1 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -849,6 +849,7 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj, case ERANGE: case EFAULT: case EROFS: + case EINVAL: zfs_error_aux(hdl, "%s", strerror(errno)); return (zfs_error(hdl, EZFS_BADBACKUP, errbuf)); From 371f88d96fe0aeb46a72fec78f90e1d777493ee5 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Thu, 10 Jun 2021 11:27:33 -0400 Subject: [PATCH 13/24] Remove pool io kstats (#12212) This mostly reverts "3537 want pool io kstats" commit of 8 years ago. From one side this code using pool-wide locks became pretty bad for performance, creating significant lock contention in I/O pipeline. From another, there are more efficient ways now to obtain detailed statistics, while this statistics is illumos-specific and much less usable on Linux and FreeBSD, reported only via procfs/sysctls. This commit does not remove KSTAT_TYPE_IO implementation, that may be removed later together with already unused KSTAT_TYPE_INTR and KSTAT_TYPE_TIMER. Reviewed-by: Matthew Ahrens Reviewed-by: Brian Behlendorf Signed-off-by: Alexander Motin Sponsored-By: iXsystems, Inc. Closes #12212 --- include/os/freebsd/spl/sys/kstat.h | 4 -- include/os/linux/spl/sys/kstat.h | 4 -- include/sys/spa.h | 1 - include/sys/zfs_context.h | 6 --- lib/libspl/include/sys/kstat.h | 6 --- lib/libzpool/kernel.c | 30 -------------- module/os/freebsd/spl/spl_kstat.c | 62 ---------------------------- module/os/linux/spl/spl-kstat.c | 66 ------------------------------ module/zfs/spa_stats.c | 50 ---------------------- module/zfs/vdev_queue.c | 47 --------------------- 10 files changed, 276 deletions(-) diff --git a/include/os/freebsd/spl/sys/kstat.h b/include/os/freebsd/spl/sys/kstat.h index f5157c7f4fe3..947dfee62393 100644 --- a/include/os/freebsd/spl/sys/kstat.h +++ b/include/os/freebsd/spl/sys/kstat.h @@ -210,10 +210,6 @@ extern kstat_t *__kstat_create(const char *ks_module, int ks_instance, extern void __kstat_install(kstat_t *ksp); extern void __kstat_delete(kstat_t *ksp); -extern void kstat_waitq_enter(kstat_io_t *); -extern void kstat_waitq_exit(kstat_io_t *); -extern void kstat_runq_enter(kstat_io_t *); -extern void kstat_runq_exit(kstat_io_t *); #define kstat_set_seq_raw_ops(k, h, d, a) \ __kstat_set_seq_raw_ops(k, h, d, a) diff --git a/include/os/linux/spl/sys/kstat.h b/include/os/linux/spl/sys/kstat.h index 905d8257c8d3..928f70757545 100644 --- a/include/os/linux/spl/sys/kstat.h +++ b/include/os/linux/spl/sys/kstat.h @@ -206,10 +206,6 @@ extern void kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode, extern void __kstat_install(kstat_t *ksp); extern void __kstat_delete(kstat_t *ksp); -extern void kstat_waitq_enter(kstat_io_t *); -extern void kstat_waitq_exit(kstat_io_t *); -extern void kstat_runq_enter(kstat_io_t *); -extern void kstat_runq_exit(kstat_io_t *); #define kstat_set_raw_ops(k, h, d, a) \ __kstat_set_raw_ops(k, h, d, a) diff --git a/include/sys/spa.h b/include/sys/spa.h index 374d36e7327e..d37c6c923d8c 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -895,7 +895,6 @@ typedef struct spa_stats { spa_history_list_t read_history; spa_history_list_t txg_history; spa_history_kstat_t tx_assign_histogram; - spa_history_kstat_t io_history; spa_history_list_t mmp_history; spa_history_kstat_t state; /* pool state */ spa_history_kstat_t iostats; diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 89afa98253f7..aa4338ed2859 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -360,12 +360,6 @@ extern kstat_t *kstat_create(const char *, int, const char *, const char *, uchar_t, ulong_t, uchar_t); extern void kstat_install(kstat_t *); extern void kstat_delete(kstat_t *); -extern void kstat_waitq_enter(kstat_io_t *); -extern void kstat_waitq_exit(kstat_io_t *); -extern void kstat_runq_enter(kstat_io_t *); -extern void kstat_runq_exit(kstat_io_t *); -extern void kstat_waitq_to_runq(kstat_io_t *); -extern void kstat_runq_back_to_waitq(kstat_io_t *); extern void kstat_set_raw_ops(kstat_t *ksp, int (*headers)(char *buf, size_t size), int (*data)(char *buf, size_t size, void *data), diff --git a/lib/libspl/include/sys/kstat.h b/lib/libspl/include/sys/kstat.h index 69fb6d401fc7..f73fb92eb797 100644 --- a/lib/libspl/include/sys/kstat.h +++ b/lib/libspl/include/sys/kstat.h @@ -796,12 +796,6 @@ extern void kstat_delete_byname(const char *, int, const char *); extern void kstat_delete_byname_zone(const char *, int, const char *, zoneid_t); extern void kstat_named_init(kstat_named_t *, const char *, uchar_t); extern void kstat_timer_init(kstat_timer_t *, const char *); -extern void kstat_waitq_enter(kstat_io_t *); -extern void kstat_waitq_exit(kstat_io_t *); -extern void kstat_runq_enter(kstat_io_t *); -extern void kstat_runq_exit(kstat_io_t *); -extern void kstat_waitq_to_runq(kstat_io_t *); -extern void kstat_runq_back_to_waitq(kstat_io_t *); extern void kstat_timer_start(kstat_timer_t *); extern void kstat_timer_stop(kstat_timer_t *); diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index e96a1d7521d9..cc8e534e7eb5 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -146,36 +146,6 @@ void kstat_delete(kstat_t *ksp) {} -/*ARGSUSED*/ -void -kstat_waitq_enter(kstat_io_t *kiop) -{} - -/*ARGSUSED*/ -void -kstat_waitq_exit(kstat_io_t *kiop) -{} - -/*ARGSUSED*/ -void -kstat_runq_enter(kstat_io_t *kiop) -{} - -/*ARGSUSED*/ -void -kstat_runq_exit(kstat_io_t *kiop) -{} - -/*ARGSUSED*/ -void -kstat_waitq_to_runq(kstat_io_t *kiop) -{} - -/*ARGSUSED*/ -void -kstat_runq_back_to_waitq(kstat_io_t *kiop) -{} - void kstat_set_raw_ops(kstat_t *ksp, int (*headers)(char *buf, size_t size), diff --git a/module/os/freebsd/spl/spl_kstat.c b/module/os/freebsd/spl/spl_kstat.c index e591921ace1b..059ada235c4a 100644 --- a/module/os/freebsd/spl/spl_kstat.c +++ b/module/os/freebsd/spl/spl_kstat.c @@ -508,65 +508,3 @@ kstat_delete(kstat_t *ksp) kmem_free(ksp->ks_data, ksp->ks_data_size); free(ksp, M_KSTAT); } - -void -kstat_waitq_enter(kstat_io_t *kiop) -{ - hrtime_t new, delta; - ulong_t wcnt; - - new = gethrtime(); - delta = new - kiop->wlastupdate; - kiop->wlastupdate = new; - wcnt = kiop->wcnt++; - if (wcnt != 0) { - kiop->wlentime += delta * wcnt; - kiop->wtime += delta; - } -} - -void -kstat_waitq_exit(kstat_io_t *kiop) -{ - hrtime_t new, delta; - ulong_t wcnt; - - new = gethrtime(); - delta = new - kiop->wlastupdate; - kiop->wlastupdate = new; - wcnt = kiop->wcnt--; - ASSERT3S(wcnt, >, 0); - kiop->wlentime += delta * wcnt; - kiop->wtime += delta; -} - -void -kstat_runq_enter(kstat_io_t *kiop) -{ - hrtime_t new, delta; - ulong_t rcnt; - - new = gethrtime(); - delta = new - kiop->rlastupdate; - kiop->rlastupdate = new; - rcnt = kiop->rcnt++; - if (rcnt != 0) { - kiop->rlentime += delta * rcnt; - kiop->rtime += delta; - } -} - -void -kstat_runq_exit(kstat_io_t *kiop) -{ - hrtime_t new, delta; - ulong_t rcnt; - - new = gethrtime(); - delta = new - kiop->rlastupdate; - kiop->rlastupdate = new; - rcnt = kiop->rcnt--; - ASSERT3S(rcnt, >, 0); - kiop->rlentime += delta * rcnt; - kiop->rtime += delta; -} diff --git a/module/os/linux/spl/spl-kstat.c b/module/os/linux/spl/spl-kstat.c index c7f1aadf784e..0c46708326d8 100644 --- a/module/os/linux/spl/spl-kstat.c +++ b/module/os/linux/spl/spl-kstat.c @@ -50,72 +50,6 @@ kstat_resize_raw(kstat_t *ksp) return (0); } -void -kstat_waitq_enter(kstat_io_t *kiop) -{ - hrtime_t new, delta; - ulong_t wcnt; - - new = gethrtime(); - delta = new - kiop->wlastupdate; - kiop->wlastupdate = new; - wcnt = kiop->wcnt++; - if (wcnt != 0) { - kiop->wlentime += delta * wcnt; - kiop->wtime += delta; - } -} -EXPORT_SYMBOL(kstat_waitq_enter); - -void -kstat_waitq_exit(kstat_io_t *kiop) -{ - hrtime_t new, delta; - ulong_t wcnt; - - new = gethrtime(); - delta = new - kiop->wlastupdate; - kiop->wlastupdate = new; - wcnt = kiop->wcnt--; - ASSERT((int)wcnt > 0); - kiop->wlentime += delta * wcnt; - kiop->wtime += delta; -} -EXPORT_SYMBOL(kstat_waitq_exit); - -void -kstat_runq_enter(kstat_io_t *kiop) -{ - hrtime_t new, delta; - ulong_t rcnt; - - new = gethrtime(); - delta = new - kiop->rlastupdate; - kiop->rlastupdate = new; - rcnt = kiop->rcnt++; - if (rcnt != 0) { - kiop->rlentime += delta * rcnt; - kiop->rtime += delta; - } -} -EXPORT_SYMBOL(kstat_runq_enter); - -void -kstat_runq_exit(kstat_io_t *kiop) -{ - hrtime_t new, delta; - ulong_t rcnt; - - new = gethrtime(); - delta = new - kiop->rlastupdate; - kiop->rlastupdate = new; - rcnt = kiop->rcnt--; - ASSERT((int)rcnt > 0); - kiop->rlentime += delta * rcnt; - kiop->rtime += delta; -} -EXPORT_SYMBOL(kstat_runq_exit); - static int kstat_seq_show_headers(struct seq_file *f) { diff --git a/module/zfs/spa_stats.c b/module/zfs/spa_stats.c index c3eacc14239e..534ac72fee7b 100644 --- a/module/zfs/spa_stats.c +++ b/module/zfs/spa_stats.c @@ -548,54 +548,6 @@ spa_tx_assign_add_nsecs(spa_t *spa, uint64_t nsecs) atomic_inc_64(&((kstat_named_t *)shk->priv)[idx].value.ui64); } -/* - * ========================================================================== - * SPA IO History Routines - * ========================================================================== - */ -static int -spa_io_history_update(kstat_t *ksp, int rw) -{ - if (rw == KSTAT_WRITE) - memset(ksp->ks_data, 0, ksp->ks_data_size); - - return (0); -} - -static void -spa_io_history_init(spa_t *spa) -{ - spa_history_kstat_t *shk = &spa->spa_stats.io_history; - 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, "io", "disk", KSTAT_TYPE_IO, 1, 0); - shk->kstat = ksp; - - if (ksp) { - ksp->ks_lock = &shk->lock; - ksp->ks_private = spa; - ksp->ks_update = spa_io_history_update; - kstat_install(ksp); - } - kmem_strfree(name); -} - -static void -spa_io_history_destroy(spa_t *spa) -{ - spa_history_kstat_t *shk = &spa->spa_stats.io_history; - - if (shk->kstat) - kstat_delete(shk->kstat); - - mutex_destroy(&shk->lock); -} - /* * ========================================================================== * SPA MMP History Routines @@ -996,7 +948,6 @@ spa_stats_init(spa_t *spa) spa_read_history_init(spa); spa_txg_history_init(spa); spa_tx_assign_init(spa); - spa_io_history_init(spa); spa_mmp_history_init(spa); spa_state_init(spa); spa_iostats_init(spa); @@ -1010,7 +961,6 @@ spa_stats_destroy(spa_t *spa) spa_tx_assign_destroy(spa); spa_txg_history_destroy(spa); spa_read_history_destroy(spa); - spa_io_history_destroy(spa); spa_mmp_history_destroy(spa); } diff --git a/module/zfs/vdev_queue.c b/module/zfs/vdev_queue.c index 25a4bc69cc23..198861edb816 100644 --- a/module/zfs/vdev_queue.c +++ b/module/zfs/vdev_queue.c @@ -35,8 +35,6 @@ #include #include #include -#include -#include #include /* @@ -516,35 +514,17 @@ vdev_queue_fini(vdev_t *vd) static void vdev_queue_io_add(vdev_queue_t *vq, zio_t *zio) { - spa_t *spa = zio->io_spa; - spa_history_kstat_t *shk = &spa->spa_stats.io_history; - ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); avl_add(vdev_queue_class_tree(vq, zio->io_priority), zio); avl_add(vdev_queue_type_tree(vq, zio->io_type), zio); - - if (shk->kstat != NULL) { - mutex_enter(&shk->lock); - kstat_waitq_enter(shk->kstat->ks_data); - mutex_exit(&shk->lock); - } } static void vdev_queue_io_remove(vdev_queue_t *vq, zio_t *zio) { - spa_t *spa = zio->io_spa; - spa_history_kstat_t *shk = &spa->spa_stats.io_history; - ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); avl_remove(vdev_queue_class_tree(vq, zio->io_priority), zio); avl_remove(vdev_queue_type_tree(vq, zio->io_type), zio); - - if (shk->kstat != NULL) { - mutex_enter(&shk->lock); - kstat_waitq_exit(shk->kstat->ks_data); - mutex_exit(&shk->lock); - } } static boolean_t @@ -564,9 +544,6 @@ vdev_queue_is_interactive(zio_priority_t p) static void vdev_queue_pending_add(vdev_queue_t *vq, zio_t *zio) { - spa_t *spa = zio->io_spa; - spa_history_kstat_t *shk = &spa->spa_stats.io_history; - ASSERT(MUTEX_HELD(&vq->vq_lock)); ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); vq->vq_class[zio->io_priority].vqc_active++; @@ -577,20 +554,11 @@ vdev_queue_pending_add(vdev_queue_t *vq, zio_t *zio) vq->vq_nia_credit--; } avl_add(&vq->vq_active_tree, zio); - - if (shk->kstat != NULL) { - mutex_enter(&shk->lock); - kstat_runq_enter(shk->kstat->ks_data); - mutex_exit(&shk->lock); - } } static void vdev_queue_pending_remove(vdev_queue_t *vq, zio_t *zio) { - spa_t *spa = zio->io_spa; - spa_history_kstat_t *shk = &spa->spa_stats.io_history; - ASSERT(MUTEX_HELD(&vq->vq_lock)); ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE); vq->vq_class[zio->io_priority].vqc_active--; @@ -602,21 +570,6 @@ vdev_queue_pending_remove(vdev_queue_t *vq, zio_t *zio) } else if (vq->vq_ia_active == 0) vq->vq_nia_credit++; avl_remove(&vq->vq_active_tree, zio); - - if (shk->kstat != NULL) { - kstat_io_t *ksio = shk->kstat->ks_data; - - mutex_enter(&shk->lock); - kstat_runq_exit(ksio); - if (zio->io_type == ZIO_TYPE_READ) { - ksio->reads++; - ksio->nread += zio->io_size; - } else if (zio->io_type == ZIO_TYPE_WRITE) { - ksio->writes++; - ksio->nwritten += zio->io_size; - } - mutex_exit(&shk->lock); - } } static void From eec5ba113e1d285d445333079a3e8184872ad00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 10 Jun 2021 18:26:37 +0200 Subject: [PATCH 14/24] dracut: 90zfs: respect zfs_force=1 on systemd systems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On systemd systems provide an environment generator in order to respect the zfs_force=1 kernel command line option. Reviewed-by: Brian Behlendorf Reviewed-by: Tony Nguyen Signed-off-by: Ahelenia Ziemiańska Closes #11403 Closes #12195 --- contrib/dracut/90zfs/.gitignore | 13 ++------- contrib/dracut/90zfs/Makefile.am | 3 ++- .../dracut/90zfs/import-opts-generator.sh.in | 5 ++++ contrib/dracut/90zfs/module-setup.sh.in | 27 +++++++++++++------ .../system/zfs-import-cache.service.in | 2 +- etc/systemd/system/zfs-import-scan.service.in | 2 +- 6 files changed, 30 insertions(+), 22 deletions(-) create mode 100755 contrib/dracut/90zfs/import-opts-generator.sh.in diff --git a/contrib/dracut/90zfs/.gitignore b/contrib/dracut/90zfs/.gitignore index dce24393479b..cb84212f3a2a 100644 --- a/contrib/dracut/90zfs/.gitignore +++ b/contrib/dracut/90zfs/.gitignore @@ -1,11 +1,2 @@ -export-zfs.sh -module-setup.sh -mount-zfs.sh -parse-zfs.sh -zfs-generator.sh -zfs-lib.sh -zfs-load-key.sh -zfs-needshutdown.sh -zfs-env-bootfs.service -zfs-snapshot-bootfs.service -zfs-rollback-bootfs.service +*.sh +*.service diff --git a/contrib/dracut/90zfs/Makefile.am b/contrib/dracut/90zfs/Makefile.am index ff3a2b27f24e..3f7050300994 100644 --- a/contrib/dracut/90zfs/Makefile.am +++ b/contrib/dracut/90zfs/Makefile.am @@ -10,7 +10,8 @@ pkgdracut_SCRIPTS = \ zfs-generator.sh \ zfs-load-key.sh \ zfs-needshutdown.sh \ - zfs-lib.sh + zfs-lib.sh \ + import-opts-generator.sh pkgdracut_DATA = \ zfs-env-bootfs.service \ diff --git a/contrib/dracut/90zfs/import-opts-generator.sh.in b/contrib/dracut/90zfs/import-opts-generator.sh.in new file mode 100755 index 000000000000..8bc8c9b35b73 --- /dev/null +++ b/contrib/dracut/90zfs/import-opts-generator.sh.in @@ -0,0 +1,5 @@ +#!/bin/sh + +. /lib/dracut-zfs-lib.sh + +echo ZPOOL_IMPORT_OPTS="$ZPOOL_IMPORT_OPTS" diff --git a/contrib/dracut/90zfs/module-setup.sh.in b/contrib/dracut/90zfs/module-setup.sh.in index 817da5b2b4a9..a4b62da1f742 100755 --- a/contrib/dracut/90zfs/module-setup.sh.in +++ b/contrib/dracut/90zfs/module-setup.sh.in @@ -104,29 +104,40 @@ install() { if dracut_module_included "systemd"; then mkdir -p "${initdir}/$systemdsystemunitdir/zfs-import.target.wants" - for _item in scan cache ; do - dracut_install @systemdunitdir@/zfs-import-$_item.service - if ! [ -L "${initdir}/$systemdsystemunitdir/zfs-import.target.wants"/zfs-import-$_item.service ]; then - ln -s ../zfs-import-$_item.service "${initdir}/$systemdsystemunitdir/zfs-import.target.wants"/zfs-import-$_item.service - type mark_hostonly >/dev/null 2>&1 && mark_hostonly @systemdunitdir@/zfs-import-$_item.service + for _service in "zfs-import-scan.service" "zfs-import-cache.service" ; do + dracut_install "@systemdunitdir@/$_service" + if ! [ -L "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service" ]; then + ln -sf ../$_service "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service" + type mark_hostonly >/dev/null 2>&1 && mark_hostonly "@systemdunitdir@/$_service" fi done + inst "${moddir}"/zfs-env-bootfs.service "${systemdsystemunitdir}"/zfs-env-bootfs.service ln -s ../zfs-env-bootfs.service "${initdir}/${systemdsystemunitdir}/zfs-import.target.wants"/zfs-env-bootfs.service type mark_hostonly >/dev/null 2>&1 && mark_hostonly @systemdunitdir@/zfs-env-bootfs.service + dracut_install systemd-ask-password dracut_install systemd-tty-ask-password-agent + mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants" dracut_install @systemdunitdir@/zfs-import.target if ! [ -L "${initdir}/$systemdsystemunitdir/initrd.target.wants"/zfs-import.target ]; then ln -s ../zfs-import.target "${initdir}/$systemdsystemunitdir/initrd.target.wants"/zfs-import.target type mark_hostonly >/dev/null 2>&1 && mark_hostonly @systemdunitdir@/zfs-import.target fi + for _service in zfs-snapshot-bootfs.service zfs-rollback-bootfs.service ; do - inst "${moddir}"/$_service "${systemdsystemunitdir}"/$_service - if ! [ -L "${initdir}/$systemdsystemunitdir/initrd.target.wants"/$_service ]; then - ln -s ../$_service "${initdir}/$systemdsystemunitdir/initrd.target.wants"/$_service + inst "${moddir}/$_service" "${systemdsystemunitdir}/$_service" + if ! [ -L "${initdir}/$systemdsystemunitdir/initrd.target.wants/$_service" ]; then + ln -s "../$_service" "${initdir}/$systemdsystemunitdir/initrd.target.wants/$_service" fi done + + # There isn't a pkg-config variable for this, + # and dracut doesn't automatically resolve anything this'd be next to + local systemdsystemenvironmentgeneratordir + systemdsystemenvironmentgeneratordir="$(pkg-config --variable=prefix systemd || echo "/usr")/lib/systemd/system-environment-generators" + mkdir -p "${initdir}/${systemdsystemenvironmentgeneratordir}" + inst "${moddir}"/import-opts-generator.sh "${systemdsystemenvironmentgeneratordir}"/zfs-import-opts.sh fi } diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in index 0d236fe9e468..b09961a8bb84 100644 --- a/etc/systemd/system/zfs-import-cache.service.in +++ b/etc/systemd/system/zfs-import-cache.service.in @@ -14,7 +14,7 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes -ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN +ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN ${ZPOOL_IMPORT_OPTS} [Install] WantedBy=zfs-import.target diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in index f0317e23e508..c1111c73a607 100644 --- a/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in @@ -13,7 +13,7 @@ ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes -ExecStart=@sbindir@/zpool import -aN -o cachefile=none +ExecStart=@sbindir@/zpool import -aN -o cachefile=none ${ZPOOL_IMPORT_OPTS} [Install] WantedBy=zfs-import.target From ffdf019cb317b16109ec74ae199d4253a6662f5a Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Thu, 10 Jun 2021 12:42:31 -0400 Subject: [PATCH 15/24] Re-embed multilist_t storage This commit partially reverts changes to multilists in PR 7968 (multi-threaded spa-sync()) and adds some cache line alignments to separate read-only multilists and heavily modified refcount's to different cache lines. Reviewed-by: Matthew Ahrens Reviewed-by: Brian Behlendorf Signed-off-by: Alexander Motin Sponsored-by: iXsystems, Inc. Closes #12158 --- include/sys/arc_impl.h | 12 +++--- include/sys/dmu_objset.h | 4 +- include/sys/metaslab_impl.h | 2 +- include/sys/multilist.h | 3 +- module/zfs/arc.c | 86 ++++++++++++++++++------------------- module/zfs/dbuf.c | 20 ++++----- module/zfs/dmu_objset.c | 30 ++++++------- module/zfs/dnode.c | 2 +- module/zfs/dsl_dataset.c | 3 +- module/zfs/dsl_pool.c | 3 +- module/zfs/metaslab.c | 24 +++++------ module/zfs/multilist.c | 14 +++--- 12 files changed, 99 insertions(+), 104 deletions(-) diff --git a/include/sys/arc_impl.h b/include/sys/arc_impl.h index 94123fc10e67..c01da46e01e3 100644 --- a/include/sys/arc_impl.h +++ b/include/sys/arc_impl.h @@ -74,20 +74,20 @@ typedef struct arc_state { /* * list of evictable buffers */ - multilist_t *arcs_list[ARC_BUFC_NUMTYPES]; + multilist_t arcs_list[ARC_BUFC_NUMTYPES]; + /* + * supports the "dbufs" kstat + */ + arc_state_type_t arcs_state; /* * total amount of evictable data in this state */ - zfs_refcount_t arcs_esize[ARC_BUFC_NUMTYPES]; + zfs_refcount_t arcs_esize[ARC_BUFC_NUMTYPES] ____cacheline_aligned; /* * total amount of data in this state; this includes: evictable, * non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA. */ zfs_refcount_t arcs_size; - /* - * supports the "dbufs" kstat - */ - arc_state_type_t arcs_state; } arc_state_t; typedef struct arc_callback arc_callback_t; diff --git a/include/sys/dmu_objset.h b/include/sys/dmu_objset.h index a8cb812714ec..e89ee64ea686 100644 --- a/include/sys/dmu_objset.h +++ b/include/sys/dmu_objset.h @@ -153,7 +153,7 @@ struct objset { /* no lock needed: */ struct dmu_tx *os_synctx; /* XXX sketchy */ zil_header_t os_zil_header; - multilist_t *os_synced_dnodes; + multilist_t os_synced_dnodes; uint64_t os_flags; uint64_t os_freed_dnodes; boolean_t os_rescan_dnodes; @@ -172,7 +172,7 @@ struct objset { /* Protected by os_lock */ kmutex_t os_lock; - multilist_t *os_dirty_dnodes[TXG_SIZE]; + multilist_t os_dirty_dnodes[TXG_SIZE]; list_t os_dnodes; list_t os_downgraded_dbufs; diff --git a/include/sys/metaslab_impl.h b/include/sys/metaslab_impl.h index 3be0c466c403..9924c3ba0eaa 100644 --- a/include/sys/metaslab_impl.h +++ b/include/sys/metaslab_impl.h @@ -206,7 +206,7 @@ struct metaslab_class { * List of all loaded metaslabs in the class, sorted in order of most * recent use. */ - multilist_t *mc_metaslab_txg_list; + multilist_t mc_metaslab_txg_list; metaslab_class_allocator_t mc_allocator[]; }; diff --git a/include/sys/multilist.h b/include/sys/multilist.h index 0c7b4075d9a3..26f37c37ab38 100644 --- a/include/sys/multilist.h +++ b/include/sys/multilist.h @@ -71,8 +71,9 @@ struct multilist { multilist_sublist_index_func_t *ml_index_func; }; +void multilist_create(multilist_t *, size_t, size_t, + multilist_sublist_index_func_t *); void multilist_destroy(multilist_t *); -multilist_t *multilist_create(size_t, size_t, multilist_sublist_index_func_t *); void multilist_insert(multilist_t *, void *); void multilist_remove(multilist_t *, void *); diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 5526cae378fb..737904f34855 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -2327,7 +2327,7 @@ add_reference(arc_buf_hdr_t *hdr, void *tag) (state != arc_anon)) { /* We don't use the L2-only state list. */ if (state != arc_l2c_only) { - multilist_remove(state->arcs_list[arc_buf_type(hdr)], + multilist_remove(&state->arcs_list[arc_buf_type(hdr)], hdr); arc_evictable_space_decrement(hdr, state); } @@ -2361,7 +2361,7 @@ remove_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lock, void *tag) */ if (((cnt = zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && (state != arc_anon)) { - multilist_insert(state->arcs_list[arc_buf_type(hdr)], hdr); + multilist_insert(&state->arcs_list[arc_buf_type(hdr)], hdr); ASSERT3U(hdr->b_l1hdr.b_bufcnt, >, 0); arc_evictable_space_increment(hdr, state); } @@ -2464,7 +2464,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *hdr, if (refcnt == 0) { if (old_state != arc_anon && old_state != arc_l2c_only) { ASSERT(HDR_HAS_L1HDR(hdr)); - multilist_remove(old_state->arcs_list[buftype], hdr); + multilist_remove(&old_state->arcs_list[buftype], hdr); if (GHOST_STATE(old_state)) { ASSERT0(bufcnt); @@ -2481,7 +2481,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *hdr, * beforehand. */ ASSERT(HDR_HAS_L1HDR(hdr)); - multilist_insert(new_state->arcs_list[buftype], hdr); + multilist_insert(&new_state->arcs_list[buftype], hdr); if (GHOST_STATE(new_state)) { ASSERT0(bufcnt); @@ -2633,8 +2633,8 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t *hdr, * L2 headers should never be on the L2 state list since they don't * have L1 headers allocated. */ - ASSERT(multilist_is_empty(arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && - multilist_is_empty(arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); + ASSERT(multilist_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]) && + multilist_is_empty(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA])); } void @@ -4200,7 +4200,7 @@ arc_evict_state(arc_state_t *state, uint64_t spa, int64_t bytes, arc_buf_contents_t type) { uint64_t total_evicted = 0; - multilist_t *ml = state->arcs_list[type]; + multilist_t *ml = &state->arcs_list[type]; int num_sublists; arc_buf_hdr_t **markers; @@ -4534,8 +4534,8 @@ arc_evict_meta(uint64_t meta_used) static arc_buf_contents_t arc_evict_type(arc_state_t *state) { - multilist_t *data_ml = state->arcs_list[ARC_BUFC_DATA]; - multilist_t *meta_ml = state->arcs_list[ARC_BUFC_METADATA]; + multilist_t *data_ml = &state->arcs_list[ARC_BUFC_DATA]; + multilist_t *meta_ml = &state->arcs_list[ARC_BUFC_METADATA]; int data_idx = multilist_get_random_index(data_ml); int meta_idx = multilist_get_random_index(meta_ml); multilist_sublist_t *data_mls; @@ -7455,44 +7455,44 @@ arc_state_init(void) arc_mfu_ghost = &ARC_mfu_ghost; arc_l2c_only = &ARC_l2c_only; - arc_mru->arcs_list[ARC_BUFC_METADATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_mru->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_mru->arcs_list[ARC_BUFC_DATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_mru->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_mru_ghost->arcs_list[ARC_BUFC_METADATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_mru_ghost->arcs_list[ARC_BUFC_DATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_mfu->arcs_list[ARC_BUFC_METADATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_mfu->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_mfu->arcs_list[ARC_BUFC_DATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_mfu->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_mfu_ghost->arcs_list[ARC_BUFC_DATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_l2c_only->arcs_list[ARC_BUFC_METADATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - arc_l2c_only->arcs_list[ARC_BUFC_DATA] = - multilist_create(sizeof (arc_buf_hdr_t), + multilist_create(&arc_l2c_only->arcs_list[ARC_BUFC_DATA], + sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); @@ -7558,16 +7558,16 @@ arc_state_fini(void) zfs_refcount_destroy(&arc_mfu_ghost->arcs_size); zfs_refcount_destroy(&arc_l2c_only->arcs_size); - multilist_destroy(arc_mru->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(arc_mru->arcs_list[ARC_BUFC_DATA]); - multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_DATA]); - multilist_destroy(arc_mfu->arcs_list[ARC_BUFC_DATA]); - multilist_destroy(arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]); - multilist_destroy(arc_l2c_only->arcs_list[ARC_BUFC_METADATA]); - multilist_destroy(arc_l2c_only->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(&arc_mru->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(&arc_mfu->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(&arc_mru->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(&arc_mru_ghost->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(&arc_mfu->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(&arc_mfu_ghost->arcs_list[ARC_BUFC_DATA]); + multilist_destroy(&arc_l2c_only->arcs_list[ARC_BUFC_METADATA]); + multilist_destroy(&arc_l2c_only->arcs_list[ARC_BUFC_DATA]); aggsum_fini(&arc_meta_used); aggsum_fini(&arc_size); @@ -8624,16 +8624,16 @@ l2arc_sublist_lock(int list_num) switch (list_num) { case 0: - ml = arc_mfu->arcs_list[ARC_BUFC_METADATA]; + ml = &arc_mfu->arcs_list[ARC_BUFC_METADATA]; break; case 1: - ml = arc_mru->arcs_list[ARC_BUFC_METADATA]; + ml = &arc_mru->arcs_list[ARC_BUFC_METADATA]; break; case 2: - ml = arc_mfu->arcs_list[ARC_BUFC_DATA]; + ml = &arc_mfu->arcs_list[ARC_BUFC_DATA]; break; case 3: - ml = arc_mru->arcs_list[ARC_BUFC_DATA]; + ml = &arc_mru->arcs_list[ARC_BUFC_DATA]; break; default: return (NULL); diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 764383b2d039..9d741545fae3 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -203,8 +203,8 @@ static boolean_t dbuf_evict_thread_exit; * by those caches' matching enum values (from dbuf_cached_state_t). */ typedef struct dbuf_cache { - multilist_t *cache; - zfs_refcount_t size; + multilist_t cache; + zfs_refcount_t size ____cacheline_aligned; } dbuf_cache_t; dbuf_cache_t dbuf_caches[DB_CACHE_MAX]; @@ -667,9 +667,9 @@ dbuf_cache_above_lowater(void) static void dbuf_evict_one(void) { - int idx = multilist_get_random_index(dbuf_caches[DB_DBUF_CACHE].cache); + int idx = multilist_get_random_index(&dbuf_caches[DB_DBUF_CACHE].cache); multilist_sublist_t *mls = multilist_sublist_lock( - dbuf_caches[DB_DBUF_CACHE].cache, idx); + &dbuf_caches[DB_DBUF_CACHE].cache, idx); ASSERT(!MUTEX_HELD(&dbuf_evict_lock)); @@ -833,8 +833,8 @@ dbuf_init(void) dbu_evict_taskq = taskq_create("dbu_evict", 1, defclsyspri, 0, 0, 0); for (dbuf_cached_state_t dcs = 0; dcs < DB_CACHE_MAX; dcs++) { - dbuf_caches[dcs].cache = - multilist_create(sizeof (dmu_buf_impl_t), + multilist_create(&dbuf_caches[dcs].cache, + sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_cache_link), dbuf_cache_multilist_index_func); zfs_refcount_create(&dbuf_caches[dcs].size); @@ -901,7 +901,7 @@ dbuf_fini(void) for (dbuf_cached_state_t dcs = 0; dcs < DB_CACHE_MAX; dcs++) { zfs_refcount_destroy(&dbuf_caches[dcs].size); - multilist_destroy(dbuf_caches[dcs].cache); + multilist_destroy(&dbuf_caches[dcs].cache); } if (dbuf_ksp != NULL) { @@ -2755,7 +2755,7 @@ dbuf_destroy(dmu_buf_impl_t *db) ASSERT(db->db_caching_status == DB_DBUF_CACHE || db->db_caching_status == DB_DBUF_METADATA_CACHE); - multilist_remove(dbuf_caches[db->db_caching_status].cache, db); + multilist_remove(&dbuf_caches[db->db_caching_status].cache, db); (void) zfs_refcount_remove_many( &dbuf_caches[db->db_caching_status].size, db->db.db_size, db); @@ -3465,7 +3465,7 @@ dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid, ASSERT(db->db_caching_status == DB_DBUF_CACHE || db->db_caching_status == DB_DBUF_METADATA_CACHE); - multilist_remove(dbuf_caches[db->db_caching_status].cache, db); + multilist_remove(&dbuf_caches[db->db_caching_status].cache, db); (void) zfs_refcount_remove_many( &dbuf_caches[db->db_caching_status].size, db->db.db_size, db); @@ -3707,7 +3707,7 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag, boolean_t evicting) DB_DBUF_METADATA_CACHE : DB_DBUF_CACHE; db->db_caching_status = dcs; - multilist_insert(dbuf_caches[dcs].cache, db); + multilist_insert(&dbuf_caches[dcs].cache, db); size = zfs_refcount_add_many( &dbuf_caches[dcs].size, db->db.db_size, db); diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c index bfb4adf262d5..8c244dc4c317 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -601,7 +601,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, os->os_zil = zil_alloc(os, &os->os_zil_header); for (i = 0; i < TXG_SIZE; i++) { - os->os_dirty_dnodes[i] = multilist_create(sizeof (dnode_t), + multilist_create(&os->os_dirty_dnodes[i], sizeof (dnode_t), offsetof(dnode_t, dn_dirty_link[i]), dnode_multilist_index_func); } @@ -995,9 +995,8 @@ dmu_objset_evict_done(objset_t *os) mutex_destroy(&os->os_obj_lock); mutex_destroy(&os->os_user_ptr_lock); mutex_destroy(&os->os_upgrade_lock); - for (int i = 0; i < TXG_SIZE; i++) { - multilist_destroy(os->os_dirty_dnodes[i]); - } + for (int i = 0; i < TXG_SIZE; i++) + multilist_destroy(&os->os_dirty_dnodes[i]); spa_evicting_os_deregister(os->os_spa, os); kmem_free(os, sizeof (objset_t)); } @@ -1520,7 +1519,7 @@ dmu_objset_sync_dnodes(multilist_sublist_t *list, dmu_tx_t *tx) * of why this dnode hold is always needed (even when not * doing user accounting). */ - multilist_t *newlist = dn->dn_objset->os_synced_dnodes; + multilist_t *newlist = &dn->dn_objset->os_synced_dnodes; (void) dnode_add_ref(dn, newlist); multilist_insert(newlist, dn); @@ -1689,17 +1688,16 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx) * dn_dirty_link[] of this txg. But it may already * exist because we call dsl_dataset_sync() twice per txg. */ - if (os->os_synced_dnodes == NULL) { - os->os_synced_dnodes = - multilist_create(sizeof (dnode_t), + if (os->os_synced_dnodes.ml_sublists == NULL) { + multilist_create(&os->os_synced_dnodes, sizeof (dnode_t), offsetof(dnode_t, dn_dirty_link[txgoff]), dnode_multilist_index_func); } else { - ASSERT3U(os->os_synced_dnodes->ml_offset, ==, + ASSERT3U(os->os_synced_dnodes.ml_offset, ==, offsetof(dnode_t, dn_dirty_link[txgoff])); } - ml = os->os_dirty_dnodes[txgoff]; + ml = &os->os_dirty_dnodes[txgoff]; num_sublists = multilist_get_num_sublists(ml); for (int i = 0; i < num_sublists; i++) { if (multilist_sublist_is_empty_idx(ml, i)) @@ -1738,7 +1736,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx) boolean_t dmu_objset_is_dirty(objset_t *os, uint64_t txg) { - return (!multilist_is_empty(os->os_dirty_dnodes[txg & TXG_MASK])); + return (!multilist_is_empty(&os->os_dirty_dnodes[txg & TXG_MASK])); } static file_info_cb_t *file_cbs[DMU_OST_NUMTYPES]; @@ -1949,7 +1947,7 @@ userquota_updates_task(void *arg) userquota_cache_t cache = { { 0 } }; multilist_sublist_t *list = - multilist_sublist_lock(os->os_synced_dnodes, uua->uua_sublist_idx); + multilist_sublist_lock(&os->os_synced_dnodes, uua->uua_sublist_idx); ASSERT(multilist_sublist_head(list) == NULL || dmu_objset_userused_enabled(os)); @@ -2006,7 +2004,7 @@ userquota_updates_task(void *arg) mutex_exit(&dn->dn_mtx); multilist_sublist_remove(list, dn); - dnode_rele(dn, os->os_synced_dnodes); + dnode_rele(dn, &os->os_synced_dnodes); } do_userquota_cacheflush(os, &cache, tx); multilist_sublist_unlock(list); @@ -2032,12 +2030,12 @@ dnode_rele_task(void *arg) objset_t *os = uua->uua_os; multilist_sublist_t *list = - multilist_sublist_lock(os->os_synced_dnodes, uua->uua_sublist_idx); + multilist_sublist_lock(&os->os_synced_dnodes, uua->uua_sublist_idx); dnode_t *dn; while ((dn = multilist_sublist_head(list)) != NULL) { multilist_sublist_remove(list, dn); - dnode_rele(dn, os->os_synced_dnodes); + dnode_rele(dn, &os->os_synced_dnodes); } multilist_sublist_unlock(list); kmem_free(uua, sizeof (*uua)); @@ -2093,7 +2091,7 @@ dmu_objset_sync_done(objset_t *os, dmu_tx_t *tx) { boolean_t need_userquota = dmu_objset_do_userquota_updates_prep(os, tx); - int num_sublists = multilist_get_num_sublists(os->os_synced_dnodes); + int num_sublists = multilist_get_num_sublists(&os->os_synced_dnodes); for (int i = 0; i < num_sublists; i++) { userquota_updates_arg_t *uua = kmem_alloc(sizeof (*uua), KM_SLEEP); diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 0fc788e28fe4..8434e72aa4f8 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -1671,7 +1671,7 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) */ dmu_objset_userquota_get_ids(dn, B_TRUE, tx); - multilist_t *dirtylist = os->os_dirty_dnodes[txg & TXG_MASK]; + multilist_t *dirtylist = &os->os_dirty_dnodes[txg & TXG_MASK]; multilist_sublist_t *mls = multilist_sublist_lock_obj(dirtylist, dn); /* diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index 6da5faf01edf..9b9bb42287d5 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -2267,8 +2267,7 @@ dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx) dsl_bookmark_sync_done(ds, tx); - multilist_destroy(os->os_synced_dnodes); - os->os_synced_dnodes = NULL; + multilist_destroy(&os->os_synced_dnodes); if (os->os_encrypted) os->os_next_write_raw[tx->tx_txg & TXG_MASK] = B_FALSE; diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c index c770eafa75d8..e66c136a9e02 100644 --- a/module/zfs/dsl_pool.c +++ b/module/zfs/dsl_pool.c @@ -568,8 +568,7 @@ dsl_pool_sync_mos(dsl_pool_t *dp, dmu_tx_t *tx) VERIFY0(zio_wait(zio)); dmu_objset_sync_done(dp->dp_meta_objset, tx); taskq_wait(dp->dp_sync_taskq); - multilist_destroy(dp->dp_meta_objset->os_synced_dnodes); - dp->dp_meta_objset->os_synced_dnodes = NULL; + multilist_destroy(&dp->dp_meta_objset->os_synced_dnodes); dprintf_bp(&dp->dp_meta_rootbp, "meta objset rootbp is %s", ""); spa_set_rootblkptr(dp->dp_spa, &dp->dp_meta_rootbp); diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index 3b2b79b2f42f..e588765b3382 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -416,7 +416,7 @@ metaslab_class_create(spa_t *spa, metaslab_ops_t *ops) mc->mc_spa = spa; mc->mc_ops = ops; mutex_init(&mc->mc_lock, NULL, MUTEX_DEFAULT, NULL); - mc->mc_metaslab_txg_list = multilist_create(sizeof (metaslab_t), + multilist_create(&mc->mc_metaslab_txg_list, sizeof (metaslab_t), offsetof(metaslab_t, ms_class_txg_node), metaslab_idx_func); for (int i = 0; i < spa->spa_alloc_count; i++) { metaslab_class_allocator_t *mca = &mc->mc_allocator[i]; @@ -443,7 +443,7 @@ metaslab_class_destroy(metaslab_class_t *mc) zfs_refcount_destroy(&mca->mca_alloc_slots); } mutex_destroy(&mc->mc_lock); - multilist_destroy(mc->mc_metaslab_txg_list); + multilist_destroy(&mc->mc_metaslab_txg_list); kmem_free(mc, offsetof(metaslab_class_t, mc_allocator[spa->spa_alloc_count])); } @@ -639,7 +639,7 @@ metaslab_class_expandable_space(metaslab_class_t *mc) void metaslab_class_evict_old(metaslab_class_t *mc, uint64_t txg) { - multilist_t *ml = mc->mc_metaslab_txg_list; + multilist_t *ml = &mc->mc_metaslab_txg_list; for (int i = 0; i < multilist_get_num_sublists(ml); i++) { multilist_sublist_t *mls = multilist_sublist_lock(ml, i); metaslab_t *msp = multilist_sublist_head(mls); @@ -1139,7 +1139,7 @@ metaslab_group_remove(metaslab_group_t *mg, metaslab_t *msp) metaslab_class_t *mc = msp->ms_group->mg_class; multilist_sublist_t *mls = - multilist_sublist_lock_obj(mc->mc_metaslab_txg_list, msp); + multilist_sublist_lock_obj(&mc->mc_metaslab_txg_list, msp); if (multilist_link_active(&msp->ms_class_txg_node)) multilist_sublist_remove(mls, msp); multilist_sublist_unlock(mls); @@ -2175,20 +2175,20 @@ metaslab_potentially_evict(metaslab_class_t *mc) uint64_t size = spl_kmem_cache_entry_size(zfs_btree_leaf_cache); int tries = 0; for (; allmem * zfs_metaslab_mem_limit / 100 < inuse * size && - tries < multilist_get_num_sublists(mc->mc_metaslab_txg_list) * 2; + tries < multilist_get_num_sublists(&mc->mc_metaslab_txg_list) * 2; tries++) { unsigned int idx = multilist_get_random_index( - mc->mc_metaslab_txg_list); + &mc->mc_metaslab_txg_list); multilist_sublist_t *mls = - multilist_sublist_lock(mc->mc_metaslab_txg_list, idx); + multilist_sublist_lock(&mc->mc_metaslab_txg_list, idx); metaslab_t *msp = multilist_sublist_head(mls); multilist_sublist_unlock(mls); while (msp != NULL && allmem * zfs_metaslab_mem_limit / 100 < inuse * size) { VERIFY3P(mls, ==, multilist_sublist_lock( - mc->mc_metaslab_txg_list, idx)); + &mc->mc_metaslab_txg_list, idx)); ASSERT3U(idx, ==, - metaslab_idx_func(mc->mc_metaslab_txg_list, msp)); + metaslab_idx_func(&mc->mc_metaslab_txg_list, msp)); if (!multilist_link_active(&msp->ms_class_txg_node)) { multilist_sublist_unlock(mls); @@ -2535,7 +2535,7 @@ metaslab_unload(metaslab_t *msp) if (msp->ms_group != NULL) { metaslab_class_t *mc = msp->ms_group->mg_class; multilist_sublist_t *mls = - multilist_sublist_lock_obj(mc->mc_metaslab_txg_list, msp); + multilist_sublist_lock_obj(&mc->mc_metaslab_txg_list, msp); if (multilist_link_active(&msp->ms_class_txg_node)) multilist_sublist_remove(mls, msp); multilist_sublist_unlock(mls); @@ -2600,7 +2600,7 @@ metaslab_set_selected_txg(metaslab_t *msp, uint64_t txg) ASSERT(MUTEX_HELD(&msp->ms_lock)); metaslab_class_t *mc = msp->ms_group->mg_class; multilist_sublist_t *mls = - multilist_sublist_lock_obj(mc->mc_metaslab_txg_list, msp); + multilist_sublist_lock_obj(&mc->mc_metaslab_txg_list, msp); if (multilist_link_active(&msp->ms_class_txg_node)) multilist_sublist_remove(mls, msp); msp->ms_selected_txg = txg; @@ -5682,7 +5682,7 @@ metaslab_claim_concrete(vdev_t *vd, uint64_t offset, uint64_t size, if (spa_writeable(spa)) { /* don't dirty if we're zdb(8) */ metaslab_class_t *mc = msp->ms_group->mg_class; multilist_sublist_t *mls = - multilist_sublist_lock_obj(mc->mc_metaslab_txg_list, msp); + multilist_sublist_lock_obj(&mc->mc_metaslab_txg_list, msp); if (!multilist_link_active(&msp->ms_class_txg_node)) { msp->ms_selected_txg = txg; multilist_sublist_insert_head(mls, msp); diff --git a/module/zfs/multilist.c b/module/zfs/multilist.c index 36c0d33bf1f6..eeac73bd7adf 100644 --- a/module/zfs/multilist.c +++ b/module/zfs/multilist.c @@ -68,8 +68,8 @@ multilist_d2l(multilist_t *ml, void *obj) * requirement, but a general rule of thumb in order to garner the * best multi-threaded performance out of the data structure. */ -static multilist_t * -multilist_create_impl(size_t size, size_t offset, +static void +multilist_create_impl(multilist_t *ml, size_t size, size_t offset, unsigned int num, multilist_sublist_index_func_t *index_func) { ASSERT3U(size, >, 0); @@ -77,7 +77,6 @@ multilist_create_impl(size_t size, size_t offset, ASSERT3U(num, >, 0); ASSERT3P(index_func, !=, NULL); - multilist_t *ml = kmem_alloc(sizeof (*ml), KM_SLEEP); ml->ml_offset = offset; ml->ml_num_sublists = num; ml->ml_index_func = index_func; @@ -92,7 +91,6 @@ multilist_create_impl(size_t size, size_t offset, mutex_init(&mls->mls_lock, NULL, MUTEX_NOLOCKDEP, NULL); list_create(&mls->mls_list, size, offset); } - return (ml); } /* @@ -103,8 +101,8 @@ multilist_create_impl(size_t size, size_t offset, * reserve the RAM necessary to create the extra slots for additional CPUs up * front, and dynamically adding them is a complex task. */ -multilist_t * -multilist_create(size_t size, size_t offset, +void +multilist_create(multilist_t *ml, size_t size, size_t offset, multilist_sublist_index_func_t *index_func) { int num_sublists; @@ -115,7 +113,7 @@ multilist_create(size_t size, size_t offset, num_sublists = MAX(boot_ncpus, 4); } - return (multilist_create_impl(size, offset, num_sublists, index_func)); + multilist_create_impl(ml, size, offset, num_sublists, index_func); } /* @@ -141,7 +139,7 @@ multilist_destroy(multilist_t *ml) ml->ml_num_sublists = 0; ml->ml_offset = 0; - kmem_free(ml, sizeof (multilist_t)); + ml->ml_sublists = NULL; } /* From 9d639d879954e694dea7d2fa5d9c4e9ff1ef0e69 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 11 Jun 2021 08:21:36 -0700 Subject: [PATCH 16/24] ZTS: Add zfs_clone_livelist_dedup.ksh to Makefile.am Commit 86b5f4c12 added a new zfs_clone_livelist_dedup.ksh test case but didn't include it in the Makefile.am. This results in the test not being included in the dist tarball so it's never run by the CI. Reviewed-by: John Kennedy Reviewed-by: Serapheim Dimitropoulos Signed-off-by: Brian Behlendorf Closes: #12224 --- .../zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am | 1 + 1 file changed, 1 insertion(+) 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 index c012b35d05b4..664f3d81aea6 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am @@ -4,6 +4,7 @@ dist_pkgdata_SCRIPTS = \ 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 \ From 1a345d645a5389ac4f9922bc7ecf5cc519e15d32 Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Fri, 11 Jun 2021 11:38:23 -0400 Subject: [PATCH 17/24] Added uncompress requirement Having an old enough version of "file" and no "uncompress" program installed can cause rpmbuild as root to crash and mangle rpmdb. So let's add a build dependency for RPM-based systems. Reviewed-by: Brian Behlendorf Reviewed-by: Tony Hutter Signed-off-by: Rich Ercolani Closes: #12071 Closes: #12168 --- rpm/generic/zfs-dkms.spec.in | 7 +++++++ rpm/generic/zfs-kmod.spec.in | 7 +++++++ rpm/generic/zfs.spec.in | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/rpm/generic/zfs-dkms.spec.in b/rpm/generic/zfs-dkms.spec.in index 0a6935516c6e..e0c410c680c2 100644 --- a/rpm/generic/zfs-dkms.spec.in +++ b/rpm/generic/zfs-dkms.spec.in @@ -32,6 +32,13 @@ Obsoletes: spl-dkms Provides: %{module}-kmod = %{version} AutoReqProv: no +%if 0%{?rhel}%{?fedora}%{?suse_version} +# We don't directly use it, but if this isn't installed, rpmbuild as root can +# crash+corrupt rpmdb +# See issue #12071 +BuildRequires: ncompress +%endif + %description This package contains the dkms ZFS kernel modules. diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in index 6e4bfdcfedc0..1692be1a72e6 100644 --- a/rpm/generic/zfs-kmod.spec.in +++ b/rpm/generic/zfs-kmod.spec.in @@ -57,6 +57,13 @@ BuildRequires: gcc, make BuildRequires: elfutils-libelf-devel %endif +%if 0%{?rhel}%{?fedora}%{?suse_version} +# We don't directly use it, but if this isn't installed, rpmbuild as root can +# crash+corrupt rpmdb +# See issue #12071 +BuildRequires: ncompress +%endif + # The developments headers will conflict with the dkms packages. Conflicts: %{module}-dkms diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index 6ce64db4f17b..4a37ae8ce1d5 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -140,9 +140,14 @@ BuildRequires: libblkid-devel BuildRequires: libudev-devel BuildRequires: libattr-devel BuildRequires: openssl-devel +# 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} >= 28 || 0%{?rhel} >= 8 || 0%{?centos} >= 8 BuildRequires: libtirpc-devel %endif + Requires: openssl %if 0%{?_systemd} BuildRequires: systemd From 3aa81a6635bf025298a40bf7b62ab57c556cfbbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 22 May 2021 16:23:59 +0200 Subject: [PATCH 18/24] linux/libzutil: use ARRAY_SIZE instead of constant for search paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia Ziemiańska Closes #12105 --- lib/libzutil/os/freebsd/zutil_import_os.c | 2 +- lib/libzutil/os/linux/zutil_import_os.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/libzutil/os/freebsd/zutil_import_os.c b/lib/libzutil/os/freebsd/zutil_import_os.c index 36c4d90aa4b9..2d8900ce2483 100644 --- a/lib/libzutil/os/freebsd/zutil_import_os.c +++ b/lib/libzutil/os/freebsd/zutil_import_os.c @@ -168,7 +168,7 @@ zpool_open_func(void *arg) (void) close(fd); } -static const char * +static const char * const zpool_default_import_path[] = { "/dev" }; diff --git a/lib/libzutil/os/linux/zutil_import_os.c b/lib/libzutil/os/linux/zutil_import_os.c index 84c3cb44fec7..0a647375b51e 100644 --- a/lib/libzutil/os/linux/zutil_import_os.c +++ b/lib/libzutil/os/linux/zutil_import_os.c @@ -74,7 +74,6 @@ #endif #include -#define DEFAULT_IMPORT_PATH_SIZE 9 #define DEV_BYID_PATH "/dev/disk/by-id/" static boolean_t @@ -255,8 +254,8 @@ zpool_open_func(void *arg) } } -static char * -zpool_default_import_path[DEFAULT_IMPORT_PATH_SIZE] = { +static const char * const +zpool_default_import_path[] = { "/dev/disk/by-vdev", /* Custom rules, use first if they exist */ "/dev/mapper", /* Use multipath devices before components */ "/dev/disk/by-partlabel", /* Single unique entry set by user */ @@ -271,8 +270,8 @@ zpool_default_import_path[DEFAULT_IMPORT_PATH_SIZE] = { const char * const * zpool_default_search_paths(size_t *count) { - *count = DEFAULT_IMPORT_PATH_SIZE; - return ((const char * const *)zpool_default_import_path); + *count = ARRAY_SIZE(zpool_default_import_path); + return (zpool_default_import_path); } /* @@ -300,7 +299,7 @@ zfs_path_order(char *name, int *order) } free(envdup); } else { - for (i = 0; i < DEFAULT_IMPORT_PATH_SIZE; i++) { + for (i = 0; i < ARRAY_SIZE(zpool_default_import_path); i++) { if (strncmp(name, zpool_default_import_path[i], strlen(zpool_default_import_path[i])) == 0) { *order = i; From 0854d4c186f52066ba0bd2da4282c5fde4bd9326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 3 Jun 2021 17:17:09 +0200 Subject: [PATCH 19/24] libzutil: add zfs_{base,dir}name() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia Ziemiańska Closes #12105 --- include/libzutil.h | 3 + lib/libzfs_core/libzfs_core.abi | 1366 +++++++++++++++--------------- lib/libzutil/zutil_device_path.c | 16 + 3 files changed, 707 insertions(+), 678 deletions(-) diff --git a/include/libzutil.h b/include/libzutil.h index 5b0927961800..ef17bd5426df 100644 --- a/include/libzutil.h +++ b/include/libzutil.h @@ -160,6 +160,9 @@ _LIBZUTIL_H void color_start(char *color); _LIBZUTIL_H void color_end(void); _LIBZUTIL_H int printf_color(char *color, char *format, ...); +_LIBZUTIL_H const char *zfs_basename(const char *path); +_LIBZUTIL_H ssize_t zfs_dirnamelen(const char *path); + #ifdef __cplusplus } #endif diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index f397929e1afe..c54a994f79bc 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -253,11 +253,13 @@ + + @@ -1747,22 +1749,32 @@ - + + + + + + + + + + + - + - + - + @@ -1770,11 +1782,11 @@ - - + + - + @@ -1795,11 +1807,11 @@ - + - + @@ -1811,14 +1823,14 @@ - + - + - + @@ -1829,16 +1841,16 @@ - + - + - + - + @@ -1850,20 +1862,20 @@ - + - + - + - - - + + + - + @@ -1872,10 +1884,10 @@ - + - + @@ -1883,74 +1895,73 @@ - - + + - + - + - + - + - - + + - + - + - - + + - + - - + + - - - - - + + + + - - + + - - - + + + - - + + - - + + - + - + @@ -1960,24 +1971,24 @@ - - + + - + - + - + - + @@ -2001,27 +2012,27 @@ - - - + + + - + - + - - - - - - - + + + + + + + - - + + @@ -2030,27 +2041,27 @@ - + - + - + - - + + - + - + @@ -2061,66 +2072,66 @@ - + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - - - - - + + + + + - + - + - - + + @@ -2166,8 +2177,8 @@ - - + + @@ -2181,8 +2192,8 @@ - - + + @@ -2194,42 +2205,42 @@ - - + + - - + + - + - + - - + + - + - + - + - + @@ -2244,12 +2255,12 @@ - + - - + + @@ -2272,21 +2283,21 @@ - - + + - + - + - + - + - + @@ -2295,31 +2306,31 @@ - - - + + + - - + + - + - + - + - + @@ -2328,28 +2339,28 @@ - + - + - + - - + + - + @@ -2359,7 +2370,7 @@ - + @@ -2370,37 +2381,37 @@ - - + + - + - + - + - + - + @@ -2426,25 +2437,25 @@ - - - - + + + + - + - - + + - - - + + + - - + + @@ -2459,21 +2470,21 @@ - - + + - - + + - + @@ -2488,15 +2499,15 @@ - + - + - + - + @@ -2505,10 +2516,10 @@ - + - - + + @@ -2524,7 +2535,7 @@ - + @@ -2538,16 +2549,16 @@ - + - + - + - + @@ -2556,27 +2567,27 @@ - + - + - + - - - - + + + + - + - + @@ -2588,65 +2599,65 @@ - - + + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - - + + - + - + @@ -2657,27 +2668,27 @@ - - + + - + - - + + - + - + - + - - + + @@ -2686,21 +2697,21 @@ - + - + - + - - + + @@ -2709,113 +2720,113 @@ - + - + - + - + - - - + + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - + - - + + - - + + - + - + - - + + - - + + - + - + - + - + - + - + - + - + @@ -2832,145 +2843,145 @@ - - + + - + - - + + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - - + + - - - - + + + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + @@ -2994,39 +3005,39 @@ - - - - + + + + - + - + - + - + - + - + - + - + - + - + @@ -3035,19 +3046,19 @@ - + - + - + - + - - + + @@ -3056,212 +3067,212 @@ - + - - + + - - + + - + - + - - - - + + + + - + - + - - + + - - + + - - + + - - + + - + - - - - - - + - + + + + + + - + - + - + - + - + - + - - + + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - - + + - - + + - - + + - + - - + + - + - + - + - - + + - + - + - + - + - - + + - - + + - + - - + + - + - + @@ -3269,56 +3280,56 @@ - + - + - + - + - + - + - + - - + + - + - + - + - + - + @@ -3327,603 +3338,602 @@ - - + + - + - - - + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - - - + + + - - + + - - + + - + - + - + - + - + - - + + - - - - - - - + + + + + + - - + + - - + + - + - + - + - + - + - - - - - - + + + + + + - + - - + + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - + - + - - + + - + - - + + - - - + + + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - + + + - + - + - + - + - + - + - + - + - - + + - - + + - + - - - + + + - - - + + + - - - + + + - + - + - - - + + + - + - + - - - + + + - - - + + + - - - + + + - + - + - - - + + + - + - + - - - - + + + + - - - - + + + + - - - - + + + + - + - + - - - - + + + + - + - + - + - - - + + + - - - + + + - - - + + + - + - + - - - + + + - + - + - + - + @@ -4006,16 +4016,16 @@ - + - + - + @@ -4030,7 +4040,7 @@ - + @@ -4045,7 +4055,7 @@ - + @@ -4149,7 +4159,7 @@ - + @@ -4179,13 +4189,13 @@ - + - + - + @@ -4199,7 +4209,7 @@ - + @@ -4214,10 +4224,10 @@ - + - + @@ -4236,8 +4246,8 @@ - - + + @@ -4330,7 +4340,7 @@ - + @@ -4351,23 +4361,23 @@ - + - - + + - - + + @@ -4447,7 +4457,7 @@ - + @@ -4456,7 +4466,7 @@ - + @@ -4469,7 +4479,7 @@ - + @@ -4505,7 +4515,7 @@ - + diff --git a/lib/libzutil/zutil_device_path.c b/lib/libzutil/zutil_device_path.c index bcdc72baa682..435c444b2460 100644 --- a/lib/libzutil/zutil_device_path.c +++ b/lib/libzutil/zutil_device_path.c @@ -31,6 +31,22 @@ #include +/* Substring from after the last slash, or the string itself if none */ +const char * +zfs_basename(const char *path) +{ + const char *bn = strrchr(path, '/'); + return (bn ? bn + 1 : path); +} + +/* Return index of last slash or -1 if none */ +ssize_t +zfs_dirnamelen(const char *path) +{ + const char *end = strrchr(path, '/'); + return (end ? end - path : -1); +} + /* * Given a shorthand device name check if a file by that name exists in any * of the 'zpool_default_import_path' or ZPOOL_IMPORT_PATH directories. If From bf80fb53f59c1d98c03758dec6322cfacec4ccf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 22 May 2021 16:26:40 +0200 Subject: [PATCH 20/24] linux/libzutil: zpool_open_func: don't dup name, extract untouchables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia Ziemiańska Closes #12105 --- lib/libzutil/os/linux/zutil_import_os.c | 35 +++++++++---------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/lib/libzutil/os/linux/zutil_import_os.c b/lib/libzutil/os/linux/zutil_import_os.c index 0a647375b51e..433a72282bb7 100644 --- a/lib/libzutil/os/linux/zutil_import_os.c +++ b/lib/libzutil/os/linux/zutil_import_os.c @@ -76,18 +76,19 @@ #define DEV_BYID_PATH "/dev/disk/by-id/" +/* + * Skip devices with well known prefixes: + * there can be side effects when opening devices which need to be avoided. + * + * hpet - High Precision Event Timer + * watchdog[N] - Watchdog must be closed in a special way. + */ static boolean_t -is_watchdog_dev(char *dev) +should_skip_dev(const char *dev) { - /* For 'watchdog' dev */ - if (strcmp(dev, "watchdog") == 0) - return (B_TRUE); - - /* For 'watchdog */ - if (strstr(dev, "watchdog") == dev && isdigit(dev[8])) - return (B_TRUE); - - return (B_FALSE); + return ((strcmp(dev, "watchdog") == 0) || + (strncmp(dev, "watchdog", 8) == 0 && isdigit(dev[8])) || + (strcmp(dev, "hpet") == 0)); } int @@ -103,24 +104,12 @@ zpool_open_func(void *arg) libpc_handle_t *hdl = rn->rn_hdl; struct stat64 statbuf; nvlist_t *config; - char *bname, *dupname; uint64_t vdev_guid = 0; int error; int num_labels = 0; int fd; - /* - * Skip devices with well known prefixes there can be side effects - * when opening devices which need to be avoided. - * - * hpet - High Precision Event Timer - * watchdog - Watchdog must be closed in a special way. - */ - dupname = zutil_strdup(hdl, rn->rn_name); - bname = basename(dupname); - error = ((strcmp(bname, "hpet") == 0) || is_watchdog_dev(bname)); - free(dupname); - if (error) + if (should_skip_dev(zfs_basename(rn->rn_name))) return; /* From 64dfdaba372f07f91a6eab598b3480693b1d14c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 22 May 2021 16:29:53 +0200 Subject: [PATCH 21/24] libzutil: import: filter out unsuitable files earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only accept the right type of file, if available, and reject too-small files before opening them on Linux Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia Ziemiańska Closes #12105 --- lib/libzutil/os/linux/zutil_import_os.c | 12 +++--------- lib/libzutil/zutil_import.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/libzutil/os/linux/zutil_import_os.c b/lib/libzutil/os/linux/zutil_import_os.c index 433a72282bb7..5defb526f210 100644 --- a/lib/libzutil/os/linux/zutil_import_os.c +++ b/lib/libzutil/os/linux/zutil_import_os.c @@ -114,9 +114,11 @@ zpool_open_func(void *arg) /* * Ignore failed stats. We only want regular files and block devices. + * Ignore files that are too small to hold a zpool. */ if (stat64(rn->rn_name, &statbuf) != 0 || - (!S_ISREG(statbuf.st_mode) && !S_ISBLK(statbuf.st_mode))) + (!S_ISREG(statbuf.st_mode) && !S_ISBLK(statbuf.st_mode)) || + (S_ISREG(statbuf.st_mode) && statbuf.st_size < SPA_MINDEVSIZE)) return; /* @@ -132,14 +134,6 @@ zpool_open_func(void *arg) if (fd < 0) return; - /* - * This file is too small to hold a zpool - */ - if (S_ISREG(statbuf.st_mode) && statbuf.st_size < SPA_MINDEVSIZE) { - (void) close(fd); - return; - } - error = zpool_read_label(fd, &config, &num_labels); if (error != 0) { (void) close(fd); diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c index 9d7fcb8d9685..871a75ab2326 100644 --- a/lib/libzutil/zutil_import.c +++ b/lib/libzutil/zutil_import.c @@ -1243,10 +1243,21 @@ zpool_find_import_scan_dir(libpc_handle_t *hdl, pthread_mutex_t *lock, while ((dp = readdir64(dirp)) != NULL) { const char *name = dp->d_name; - if (name[0] == '.' && - (name[1] == 0 || (name[1] == '.' && name[2] == 0))) + if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue; + switch (dp->d_type) { + case DT_UNKNOWN: + case DT_BLK: +#ifdef __FreeBSD__ + case DT_CHR: +#endif + case DT_REG: + break; + default: + continue; + } + zpool_find_import_scan_add_slice(hdl, lock, cache, path, name, order); } From feb04e66802ef96aa77951c43d4b632b376041ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 22 May 2021 17:19:14 +0200 Subject: [PATCH 22/24] Forbid basename(3) and dirname(3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are at least two interpretations of basename(3), in addition to both functions being allowed to /both/ return a static buffer (unsuitable in multi-threaded environments) /and/ raze the input (which encourages overallocations, at best) Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia Ziemiańska Closes #12105 --- cmd/zed/agents/zfs_retire.c | 3 +- config/Rules.am | 3 ++ lib/libzfs/libzfs_pool.c | 2 +- lib/libzpool/kernel.c | 18 +++------ lib/libzutil/zutil_import.c | 37 ++++++++++++++----- .../tests/functional/ctime/Makefile.am | 2 + .../zfs-tests/tests/functional/ctime/ctime.c | 13 +++---- 7 files changed, 45 insertions(+), 33 deletions(-) diff --git a/cmd/zed/agents/zfs_retire.c b/cmd/zed/agents/zfs_retire.c index 1c4cc885b5e5..1563f5d2792c 100644 --- a/cmd/zed/agents/zfs_retire.c +++ b/cmd/zed/agents/zfs_retire.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -240,7 +241,7 @@ replace_with_spare(fmd_hdl_t *hdl, zpool_handle_t *zhp, nvlist_t *vdev) ZPOOL_CONFIG_CHILDREN, &spares[s], 1); fmd_hdl_debug(hdl, "zpool_vdev_replace '%s' with spare '%s'", - dev_name, basename(spare_name)); + dev_name, zfs_basename(spare_name)); if (zpool_vdev_attach(zhp, dev_name, spare_name, replacement, B_TRUE, rebuild) == 0) { diff --git a/config/Rules.am b/config/Rules.am index ef10d493896d..8fe2fa9ca8d9 100644 --- a/config/Rules.am +++ b/config/Rules.am @@ -54,6 +54,9 @@ 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_LDFLAGS = $(DEBUG_LDFLAGS) AM_LDFLAGS += $(ASAN_LDFLAGS) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index adc36c47f290..c0bf9d067d42 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -4309,7 +4309,7 @@ zfs_save_arguments(int argc, char **argv, char *string, int len) { int i; - (void) strlcpy(string, basename(argv[0]), len); + (void) strlcpy(string, zfs_basename(argv[0]), len); for (i = 1; i < argc; i++) { (void) strlcat(string, " ", len); (void) strlcat(string, argv[i], len); diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index cc8e534e7eb5..836eb176e13d 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -541,19 +542,10 @@ void __dprintf(boolean_t dprint, const char *file, const char *func, int line, const char *fmt, ...) { - const char *newfile; + /* Get rid of annoying "../common/" prefix to filename. */ + const char *newfile = zfs_basename(file); + va_list adx; - - /* - * Get rid of annoying "../common/" prefix to filename. - */ - newfile = strrchr(file, '/'); - if (newfile != NULL) { - newfile = newfile + 1; /* Get rid of leading / */ - } else { - newfile = file; - } - if (dprint) { /* dprintf messages are printed immediately */ @@ -1040,7 +1032,7 @@ zfs_file_open(const char *path, int flags, int mode, zfs_file_t **fpp) if (vn_dumpdir != NULL) { char *dumppath = umem_zalloc(MAXPATHLEN, UMEM_NOFAIL); - char *inpath = basename((char *)(uintptr_t)path); + const char *inpath = zfs_basename(path); (void) snprintf(dumppath, MAXPATHLEN, "%s/%s", vn_dumpdir, inpath); diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c index 871a75ab2326..9bd12973fc51 100644 --- a/lib/libzutil/zutil_import.c +++ b/lib/libzutil/zutil_import.c @@ -154,6 +154,17 @@ zutil_strdup(libpc_handle_t *hdl, const char *str) return (ret); } +static char * +zutil_strndup(libpc_handle_t *hdl, const char *str, size_t n) +{ + char *ret; + + if ((ret = strndup(str, n)) == NULL) + (void) zutil_no_memory(hdl); + + return (ret); +} + /* * Intermediate structures used to gather configuration information. */ @@ -1272,20 +1283,22 @@ zpool_find_import_scan_path(libpc_handle_t *hdl, pthread_mutex_t *lock, { int error = 0; char path[MAXPATHLEN]; - char *d, *b; - char *dpath, *name; + char *d = NULL; + ssize_t dl; + const char *dpath, *name; /* - * Separate the directory part and last part of the - * path. We do this so that we can get the realpath of + * Separate the directory and the basename. + * We do this so that we can get the realpath of * the directory. We don't get the realpath on the * whole path because if it's a symlink, we want the * path of the symlink not where it points to. */ - d = zutil_strdup(hdl, dir); - b = zutil_strdup(hdl, dir); - dpath = dirname(d); - name = basename(b); + name = zfs_basename(dir); + if ((dl = zfs_dirnamelen(dir)) == -1) + dpath = "."; + else + dpath = d = zutil_strndup(hdl, dir, dl); if (realpath(dpath, path) == NULL) { error = errno; @@ -1303,7 +1316,6 @@ zpool_find_import_scan_path(libpc_handle_t *hdl, pthread_mutex_t *lock, zpool_find_import_scan_add_slice(hdl, lock, cache, path, name, order); out: - free(b); free(d); return (error); } @@ -1506,6 +1518,7 @@ discover_cached_paths(libpc_handle_t *hdl, nvlist_t *nv, avl_tree_t *cache, pthread_mutex_t *lock) { char *path = NULL; + ssize_t dl; uint_t children; nvlist_t **child; @@ -1521,8 +1534,12 @@ discover_cached_paths(libpc_handle_t *hdl, nvlist_t *nv, * our directory cache. */ if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) { + if ((dl = zfs_dirnamelen(path)) == -1) + path = "."; + else + path[dl] = '\0'; return (zpool_find_import_scan_dir(hdl, lock, cache, - dirname(path), 0)); + path, 0)); } return (0); } diff --git a/tests/zfs-tests/tests/functional/ctime/Makefile.am b/tests/zfs-tests/tests/functional/ctime/Makefile.am index e7479ae81056..3174f78c6249 100644 --- a/tests/zfs-tests/tests/functional/ctime/Makefile.am +++ b/tests/zfs-tests/tests/functional/ctime/Makefile.am @@ -11,3 +11,5 @@ pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/ctime pkgexec_PROGRAMS = ctime ctime_SOURCES = ctime.c + +ctime_LDADD = $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la diff --git a/tests/zfs-tests/tests/functional/ctime/ctime.c b/tests/zfs-tests/tests/functional/ctime/ctime.c index d01fa0d4ed3e..2d515d957a90 100644 --- a/tests/zfs-tests/tests/functional/ctime/ctime.c +++ b/tests/zfs-tests/tests/functional/ctime/ctime.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -149,22 +150,18 @@ static int do_link(const char *pfile) { int ret = 0; - char link_file[BUFSIZ] = { 0 }; - char pfile_copy[BUFSIZ] = { 0 }; - char *dname; + char link_file[BUFSIZ + 16] = { 0 }; if (pfile == NULL) { return (-1); } - strncpy(pfile_copy, pfile, sizeof (pfile_copy)-1); - pfile_copy[sizeof (pfile_copy) - 1] = '\0'; /* * Figure out source file directory name, and create * the link file in the same directory. */ - dname = dirname((char *)pfile_copy); - (void) snprintf(link_file, BUFSIZ, "%s/%s", dname, "link_file"); + (void) snprintf(link_file, sizeof (link_file), + "%.*s/%s", (int)zfs_dirnamelen(pfile), pfile, "link_file"); if (link(pfile, link_file) == -1) { (void) fprintf(stderr, "link(%s, %s) failed with errno %d\n", @@ -321,7 +318,7 @@ main(int argc, char *argv[]) (void) snprintf(tfile, sizeof (tfile), "%s/%s", penv[0], penv[1]); /* - * If the test file is exists, remove it first. + * If the test file exists, remove it first. */ if (access(tfile, F_OK) == 0) { (void) unlink(tfile); From 10bcc4da6ceced9746fe498f12d0603951258367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 3 Jun 2021 19:40:09 +0200 Subject: [PATCH 23/24] scripts/commitcheck.sh: fix false positive for signed commits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia Ziemiańska Closes #12105 --- scripts/commitcheck.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/commitcheck.sh b/scripts/commitcheck.sh index 0077eb6b0406..cb9fd66c6f46 100755 --- a/scripts/commitcheck.sh +++ b/scripts/commitcheck.sh @@ -7,7 +7,7 @@ REF="HEAD" test_commit_bodylength() { length="72" - body=$(git log -n 1 --pretty=%b "$REF" | grep -Ev "http(s)*://" | grep -E -m 1 ".{$((length + 1))}") + body=$(git log --no-show-signature -n 1 --pretty=%b "$REF" | grep -Ev "http(s)*://" | grep -E -m 1 ".{$((length + 1))}") if [ -n "$body" ]; then echo "error: commit message body contains line over ${length} characters" return 1 @@ -20,7 +20,7 @@ test_commit_bodylength() check_tagged_line() { regex='^[[:space:]]*'"$1"':[[:space:]][[:print:]]+[[:space:]]<[[:graph:]]+>$' - foundline=$(git log -n 1 "$REF" | grep -E -m 1 "$regex") + foundline=$(git log --no-show-signature -n 1 "$REF" | grep -E -m 1 "$regex") if [ -z "$foundline" ]; then echo "error: missing \"$1\"" return 1 @@ -35,7 +35,7 @@ new_change_commit() error=0 # subject is not longer than 72 characters - long_subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '.{73}') + long_subject=$(git log --no-show-signature -n 1 --pretty=%s "$REF" | grep -E -m 1 '.{73}') if [ -n "$long_subject" ]; then echo "error: commit subject over 72 characters" error=1 @@ -57,7 +57,7 @@ new_change_commit() is_coverity_fix() { # subject starts with Fix coverity defects means it's a coverity fix - subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '^Fix coverity defects') + subject=$(git log --no-show-signature -n 1 --pretty=%s "$REF" | grep -E -m 1 '^Fix coverity defects') if [ -n "$subject" ]; then return 0 fi @@ -70,7 +70,7 @@ coverity_fix_commit() error=0 # subject starts with Fix coverity defects: CID dddd, dddd... - subject=$(git log -n 1 --pretty=%s "$REF" | + subject=$(git log --no-show-signature -n 1 --pretty=%s "$REF" | grep -E -m 1 'Fix coverity defects: CID [[:digit:]]+(, [[:digit:]]+)*') if [ -z "$subject" ]; then echo "error: Coverity defect fixes must have a subject line that starts with \"Fix coverity defects: CID dddd\"" @@ -86,7 +86,7 @@ coverity_fix_commit() OLDIFS=$IFS IFS=' ' - for line in $(git log -n 1 --pretty=%b "$REF" | grep -E '^CID'); do + for line in $(git log --no-show-signature -n 1 --pretty=%b "$REF" | grep -E '^CID'); do if ! echo "$line" | grep -qE '^CID [[:digit:]]+: ([[:graph:]]+|[[:space:]])+ \(([[:upper:]]|\_)+\)'; then echo "error: commit message has an improperly formatted CID defect line" error=1 From afa7b3484556d3ae610a34582ce5ebd2c3e27bba Mon Sep 17 00:00:00 2001 From: Paul Zuchowski <31706010+PaulZ-98@users.noreply.github.com> Date: Fri, 11 Jun 2021 20:00:33 -0400 Subject: [PATCH 24/24] Do not hash unlinked inodes In zfs_znode_alloc we always hash inodes. If the znode is unlinked, we do not need to hash it. This fixes the problem where zfs_suspend_fs is doing zrele (iput) in an async fashion, and zfs_resume_fs unlinked drain processing will try to hash an inode that could still be hashed, resulting in a panic. Reviewed-by: Brian Behlendorf Reviewed-by: Alan Somers Signed-off-by: Paul Zuchowski Closes #9741 Closes #11223 Closes #11648 Closes #12210 --- module/os/linux/zfs/zfs_znode.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/module/os/linux/zfs/zfs_znode.c b/module/os/linux/zfs/zfs_znode.c index 6015aea62dca..577927747aef 100644 --- a/module/os/linux/zfs/zfs_znode.c +++ b/module/os/linux/zfs/zfs_znode.c @@ -606,17 +606,24 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, * number is already hashed for this super block. This can never * happen because the inode numbers map 1:1 with the object numbers. * - * The one exception is rolling back a mounted file system, but in - * this case all the active inode are unhashed during the rollback. + * Exceptions include rolling back a mounted file system, either + * from the zfs rollback or zfs recv command. + * + * Active inodes are unhashed during the rollback, but since zrele + * can happen asynchronously, we can't guarantee they've been + * unhashed. This can cause hash collisions in unlinked drain + * processing so do not hash unlinked znodes. */ - VERIFY3S(insert_inode_locked(ip), ==, 0); + if (links > 0) + VERIFY3S(insert_inode_locked(ip), ==, 0); mutex_enter(&zfsvfs->z_znodes_lock); list_insert_tail(&zfsvfs->z_all_znodes, zp); zfsvfs->z_nr_znodes++; mutex_exit(&zfsvfs->z_znodes_lock); - unlock_new_inode(ip); + if (links > 0) + unlock_new_inode(ip); return (zp); error: