git: 7b5b0f43eb06 - releng/15.0 - zfs: merge openzfs/zfs@099f69ff5 (zfs-2.4-release) into stable/15

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Wed, 19 Nov 2025 21:44:30 UTC
The branch releng/15.0 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b5b0f43eb061f3af5c862ce8dc38d1be44fc287

commit 7b5b0f43eb061f3af5c862ce8dc38d1be44fc287
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2025-11-18 11:44:03 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-19 21:36:55 +0000

    zfs: merge openzfs/zfs@099f69ff5 (zfs-2.4-release) into stable/15
    
    OpenZFS 2.4.0 rc4
    
    Notable upstream pull request merges:
     #17477 1e8c96d7d Add knob to disable slow io notifications
     #17792 5582e8b08 Update dnode_next_offset_level to accept blkid
                      instead of offset
     #17872 584762617 Pass flags to more DMU write/hold functions
     #17875 178a8be21 BRT: Round bv_entcount up to BRT_BLOCKSIZE
     #17875 e3acd0a72 Fix caching of DDT log and BRT
     #17877 67fc49433 Cleanup ZIO_FLAG_IO_RETRY vs TRYHARD usage
     #17824 dda711dbb Fix gang write late_arrival bug
     #17890 41878d57e Add BRT support to zpool prefetch command
     #17903 aaf374bd4 ZIO: Set minimum number of free issue threads to 32
     #17906 ac0bc4cc0 spa_misc: add an API for spa_namespace_lock
     #17908 583db4003 FreeBSD: Add support for _PC_CASE_INSENSITIVE
     #17911 -multiple Update library ABI versions for v2.4.0
     #17915 e305c7d59 BRT: Fix ranges to blocks conversion math
     #17916 002bc3da6 BRT: Increase block size from 4KB to 8KB
     #17921 e895c7619 ZAP: Remove dmu_object_info_from_dnode() call
    
    Approved by:    re (cperciva)
    Obtained from:  OpenZFS
    OpenZFS commit: 099f69ff5d3df7988632039db7ad6d183eb34042
    OpenZFS tag:    zfs-2.4.0-rc4
    
    (cherry picked from commit 155d5b8a19baa864ebe9d8346d932bd04ea23aca)
---
 .../.github/workflows/scripts/generate-ci-type.py  |  10 +-
 .../.github/workflows/scripts/qemu-2-start.sh      |  20 +-
 .../.github/workflows/zfs-qemu-packages.yml        |   2 +-
 sys/contrib/openzfs/.github/workflows/zfs-qemu.yml |  38 ++-
 sys/contrib/openzfs/.mailmap                       |   8 +
 sys/contrib/openzfs/AUTHORS                        |  14 +
 sys/contrib/openzfs/META                           |   2 +-
 sys/contrib/openzfs/README.md                      |   2 +-
 sys/contrib/openzfs/autogen.sh                     |  61 +----
 sys/contrib/openzfs/cmd/zdb/zdb.c                  |   8 +-
 sys/contrib/openzfs/cmd/zfs/zfs_project.c          |  36 ++-
 sys/contrib/openzfs/cmd/zpool/zpool_main.c         |  34 ++-
 sys/contrib/openzfs/cmd/ztest.c                    |  39 +--
 sys/contrib/openzfs/config/deb.am                  |   8 +-
 sys/contrib/openzfs/contrib/debian/Makefile.am     |   8 +-
 sys/contrib/openzfs/contrib/debian/clean           |   4 +-
 sys/contrib/openzfs/contrib/debian/control         |  26 +-
 .../{openzfs-libzfs6.docs => openzfs-libzfs7.docs} |   0
 ...bzfs6.install.in => openzfs-libzfs7.install.in} |   0
 ...enzfs-libzpool6.docs => openzfs-libzpool7.docs} |   0
 ...ol6.install.in => openzfs-libzpool7.install.in} |   0
 .../openzfs/include/os/freebsd/spl/sys/mod.h       |   3 +
 sys/contrib/openzfs/include/sys/brt.h              |   1 +
 sys/contrib/openzfs/include/sys/brt_impl.h         |   2 +-
 sys/contrib/openzfs/include/sys/dmu.h              |   8 +-
 sys/contrib/openzfs/include/sys/fs/zfs.h           |   4 +-
 sys/contrib/openzfs/include/sys/spa.h              |  14 +-
 sys/contrib/openzfs/include/sys/vdev_impl.h        |   1 +
 sys/contrib/openzfs/include/sys/zfs_project.h      |  10 +-
 sys/contrib/openzfs/lib/libnvpair/Makefile.am      |   2 +-
 sys/contrib/openzfs/lib/libspl/include/Makefile.am |   1 +
 .../openzfs/lib/libspl/include/os/linux/sys/vfs.h  |  33 +++
 .../openzfs/lib/libspl/include/sys/tunables.h      |  12 +-
 sys/contrib/openzfs/lib/libuutil/libuutil.abi      |  69 -----
 sys/contrib/openzfs/lib/libzfs/Makefile.am         |   2 +-
 sys/contrib/openzfs/lib/libzfs/libzfs.abi          |  83 +-----
 sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c     |   2 +
 sys/contrib/openzfs/lib/libzfs/libzfs_pool.c       |   8 +-
 sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c   |   5 +-
 .../openzfs/lib/libzfs/os/linux/libzfs_util_os.c   |  37 +++
 .../openzfs/lib/libzfs_core/libzfs_core.abi        |  70 +----
 .../openzfs/lib/libzfsbootenv/libzfsbootenv.abi    |   2 +-
 sys/contrib/openzfs/lib/libzpool/Makefile.am       |   2 +-
 sys/contrib/openzfs/lib/libzpool/kernel.c          |   4 +-
 sys/contrib/openzfs/man/man4/zfs.4                 |  42 ++-
 sys/contrib/openzfs/man/man7/vdevprops.7           |   8 +-
 sys/contrib/openzfs/man/man7/zpoolconcepts.7       |   5 +
 sys/contrib/openzfs/man/man8/zfs-jail.8            |  79 +++---
 sys/contrib/openzfs/man/man8/zfs-rewrite.8         |  22 +-
 sys/contrib/openzfs/man/man8/zpool-events.8        |  73 ++++--
 sys/contrib/openzfs/man/man8/zpool-prefetch.8      |  27 +-
 sys/contrib/openzfs/module/Kbuild.in               |   3 +-
 sys/contrib/openzfs/module/Makefile.bsd            |  24 --
 sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c |   5 +-
 sys/contrib/openzfs/module/os/freebsd/zfs/spa_os.c |  10 +-
 .../openzfs/module/os/freebsd/zfs/vdev_label_os.c  |   8 +-
 .../openzfs/module/os/freebsd/zfs/zfs_acl.c        |   3 +-
 .../openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c   |   4 +-
 .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c   |  20 +-
 .../openzfs/module/os/freebsd/zfs/zio_crypt.c      |   2 +
 .../openzfs/module/os/freebsd/zfs/zvol_os.c        |  12 +-
 sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c  |   3 +-
 .../openzfs/module/os/linux/zfs/zfs_vnops_os.c     |   3 +-
 sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c |  93 +++++--
 sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c  |   6 +-
 sys/contrib/openzfs/module/zcommon/zpool_prop.c    |   3 +
 sys/contrib/openzfs/module/zfs/arc.c               |   8 +-
 sys/contrib/openzfs/module/zfs/bpobj.c             |   7 +-
 sys/contrib/openzfs/module/zfs/bptree.c            |   9 +-
 sys/contrib/openzfs/module/zfs/brt.c               |  48 +++-
 sys/contrib/openzfs/module/zfs/dbuf.c              |   5 +-
 sys/contrib/openzfs/module/zfs/ddt_log.c           |   7 +-
 sys/contrib/openzfs/module/zfs/dmu.c               |  27 +-
 sys/contrib/openzfs/module/zfs/dmu_redact.c        |   6 +-
 sys/contrib/openzfs/module/zfs/dnode.c             | 156 +++++-------
 sys/contrib/openzfs/module/zfs/metaslab.c          |   8 +-
 sys/contrib/openzfs/module/zfs/mmp.c               |   4 +-
 sys/contrib/openzfs/module/zfs/spa.c               | 281 +++++++++++++--------
 sys/contrib/openzfs/module/zfs/spa_checkpoint.c    |   2 +-
 sys/contrib/openzfs/module/zfs/spa_config.c        |   8 +-
 sys/contrib/openzfs/module/zfs/spa_history.c       |   5 +-
 sys/contrib/openzfs/module/zfs/spa_misc.c          | 110 +++++---
 sys/contrib/openzfs/module/zfs/space_map.c         |   2 +-
 sys/contrib/openzfs/module/zfs/vdev.c              |  86 +++++--
 .../openzfs/module/zfs/vdev_indirect_births.c      |   2 +-
 .../openzfs/module/zfs/vdev_indirect_mapping.c     |   5 +-
 sys/contrib/openzfs/module/zfs/vdev_initialize.c   |   8 +-
 sys/contrib/openzfs/module/zfs/vdev_label.c        |  33 +--
 sys/contrib/openzfs/module/zfs/vdev_raidz.c        |   2 +-
 sys/contrib/openzfs/module/zfs/vdev_rebuild.c      |   4 +-
 sys/contrib/openzfs/module/zfs/vdev_removal.c      |  20 +-
 sys/contrib/openzfs/module/zfs/vdev_trim.c         |  12 +-
 sys/contrib/openzfs/module/zfs/zap_micro.c         |   4 +-
 sys/contrib/openzfs/module/zfs/zfs_fm.c            |   9 +-
 sys/contrib/openzfs/module/zfs/zfs_fuid.c          |   2 +-
 sys/contrib/openzfs/module/zfs/zfs_ioctl.c         |  41 +--
 sys/contrib/openzfs/module/zfs/zio.c               |  13 +-
 sys/contrib/openzfs/module/zfs/zio_inject.c        |   8 +-
 sys/contrib/openzfs/module/zfs/zvol.c              |   9 +-
 .../openzfs/module/zstd/include/aarch64_compat.h   |  38 ---
 .../openzfs/module/zstd/lib/common/compiler.h      |   3 -
 .../openzfs/module/zstd/lib/common/zstd_internal.h |   9 +
 sys/contrib/openzfs/rpm/generic/zfs.spec.in        |  44 ++--
 sys/contrib/openzfs/scripts/Makefile.am            |   4 +-
 sys/contrib/openzfs/scripts/zfs-tests.sh           |   4 +
 sys/contrib/openzfs/scripts/zfs2zol-patch.sed      |  32 ---
 sys/contrib/openzfs/scripts/zol2zfs-patch.sed      |  20 --
 sys/contrib/openzfs/tests/runfiles/common.run      |   2 +-
 .../tests/test-runner/bin/test-runner.py.in        |  33 ++-
 .../openzfs/tests/zfs-tests/tests/Makefile.am      |   1 +
 .../functional/cli_root/zpool_get/vdev_get.cfg     |   1 +
 .../zpool_prefetch/zpool_prefetch_001_pos.ksh      |  12 +-
 .../zpool_prefetch/zpool_prefetch_002_pos.ksh      |  95 +++++++
 .../tests/functional/events/zed_slow_io.ksh        |  44 +++-
 .../tests/functional/trim/autotrim_config.ksh      |   2 +-
 115 files changed, 1386 insertions(+), 1059 deletions(-)

diff --git a/sys/contrib/openzfs/.github/workflows/scripts/generate-ci-type.py b/sys/contrib/openzfs/.github/workflows/scripts/generate-ci-type.py
index 08021aabcb61..059d6ad3872b 100755
--- a/sys/contrib/openzfs/.github/workflows/scripts/generate-ci-type.py
+++ b/sys/contrib/openzfs/.github/workflows/scripts/generate-ci-type.py
@@ -7,7 +7,7 @@ Prints "quick" if (explicity required by user):
 - the *last* commit message contains 'ZFS-CI-Type: quick'
 or if (heuristics):
 - the files changed are not in the list of specified directories, and
-- all commit messages do not contain 'ZFS-CI-Type: full'
+- all commit messages do not contain 'ZFS-CI-Type: (full|linux|freebsd)'
 
 Otherwise prints "full".
 """
@@ -70,7 +70,7 @@ if __name__ == '__main__':
 
     for line in last_commit_message_raw.stdout.decode().splitlines():
         if line.strip().lower() == 'zfs-ci-type: quick':
-            output_type('quick', f'explicitly requested by HEAD commit {head}')
+            output_type('quick', f'requested by HEAD commit {head}')
 
     # check all commit messages
     all_commit_message_raw = subprocess.run([
@@ -83,8 +83,12 @@ if __name__ == '__main__':
     for line in all_commit_message:
         if line.startswith('ZFS-CI-Commit:'):
             commit_ref = line.lstrip('ZFS-CI-Commit:').rstrip()
+        if line.strip().lower() == 'zfs-ci-type: freebsd':
+            output_type('freebsd', f'requested by commit {commit_ref}')
+        if line.strip().lower() == 'zfs-ci-type: linux':
+            output_type('linux', f'requested by commit {commit_ref}')
         if line.strip().lower() == 'zfs-ci-type: full':
-            output_type('full', f'explicitly requested by commit {commit_ref}')
+            output_type('full', f'requested by commit {commit_ref}')
 
     # check changed files
     changed_files_raw = subprocess.run([
diff --git a/sys/contrib/openzfs/.github/workflows/scripts/qemu-2-start.sh b/sys/contrib/openzfs/.github/workflows/scripts/qemu-2-start.sh
index 422b3e9df388..5bdd84ca2435 100755
--- a/sys/contrib/openzfs/.github/workflows/scripts/qemu-2-start.sh
+++ b/sys/contrib/openzfs/.github/workflows/scripts/qemu-2-start.sh
@@ -47,16 +47,15 @@ case "$OS" in
     OSNAME="Archlinux"
     URL="https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2"
     ;;
+  centos-stream9)
+    OSNAME="CentOS Stream 9"
+    URL="https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-latest.x86_64.qcow2"
+    ;;
   centos-stream10)
     OSNAME="CentOS Stream 10"
-    # TODO: #16903 Overwrite OSv to stream9 for virt-install until it's added to osinfo
     OSv="centos-stream9"
     URL="https://cloud.centos.org/centos/10-stream/x86_64/images/CentOS-Stream-GenericCloud-10-latest.x86_64.qcow2"
     ;;
-  centos-stream9)
-    OSNAME="CentOS Stream 9"
-    URL="https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-latest.x86_64.qcow2"
-    ;;
   debian11)
     OSNAME="Debian 11"
     URL="https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-amd64.qcow2"
@@ -83,6 +82,11 @@ case "$OS" in
     OSv="fedora-unknown"
     URL="https://download.fedoraproject.org/pub/fedora/linux/releases/42/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2"
     ;;
+  fedora43)
+    OSNAME="Fedora 43"
+    OSv="fedora-unknown"
+    URL="https://download.fedoraproject.org/pub/fedora/linux/releases/43/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-43-1.6.x86_64.qcow2"
+    ;;
   freebsd13-5r)
     FreeBSD="13.5-RELEASE"
     OSNAME="FreeBSD $FreeBSD"
@@ -95,8 +99,8 @@ case "$OS" in
     FreeBSD="14.2-RELEASE"
     OSNAME="FreeBSD $FreeBSD"
     OSv="freebsd14.0"
-    KSRC="$FREEBSD_REL/../amd64/$FreeBSD/src.txz"
     URLxz="$FREEBSD_REL/$FreeBSD/amd64/Latest/FreeBSD-$FreeBSD-amd64-BASIC-CI.raw.xz"
+    KSRC="$FREEBSD_REL/../amd64/$FreeBSD/src.txz"
     ;;
   freebsd14-3r)
     FreeBSD="14.3-RELEASE"
@@ -120,8 +124,8 @@ case "$OS" in
     URLxz="$FREEBSD_SNAP/$FreeBSD/amd64/Latest/FreeBSD-$FreeBSD-amd64-BASIC-CI-ufs.raw.xz"
     KSRC="$FREEBSD_SNAP/../amd64/$FreeBSD/src.txz"
     ;;
-  freebsd15-0c)
-    FreeBSD="15.0-ALPHA4"
+  freebsd15-0s)
+    FreeBSD="15.0-STABLE"
     OSNAME="FreeBSD $FreeBSD"
     OSv="freebsd14.0"
     URLxz="$FREEBSD_SNAP/$FreeBSD/amd64/Latest/FreeBSD-$FreeBSD-amd64-BASIC-CI-ufs.raw.xz"
diff --git a/sys/contrib/openzfs/.github/workflows/zfs-qemu-packages.yml b/sys/contrib/openzfs/.github/workflows/zfs-qemu-packages.yml
index d8a95954fe1a..6367fb3a6ce2 100644
--- a/sys/contrib/openzfs/.github/workflows/zfs-qemu-packages.yml
+++ b/sys/contrib/openzfs/.github/workflows/zfs-qemu-packages.yml
@@ -52,7 +52,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: ['almalinux8', 'almalinux9', 'almalinux10', 'fedora41', 'fedora42']
+        os: ['almalinux8', 'almalinux9', 'almalinux10', 'fedora41', 'fedora42', 'fedora43']
     runs-on: ubuntu-24.04
     steps:
     - uses: actions/checkout@v4
diff --git a/sys/contrib/openzfs/.github/workflows/zfs-qemu.yml b/sys/contrib/openzfs/.github/workflows/zfs-qemu.yml
index f1b189062bb7..2436b3d73e56 100644
--- a/sys/contrib/openzfs/.github/workflows/zfs-qemu.yml
+++ b/sys/contrib/openzfs/.github/workflows/zfs-qemu.yml
@@ -29,24 +29,34 @@ jobs:
       - name: Generate OS config and CI type
         id: os
         run: |
-          FULL_OS='["almalinux8", "almalinux9", "almalinux10", "centos-stream9", "centos-stream10", "debian12", "debian13", "fedora41", "fedora42", "freebsd13-5r", "freebsd14-3s", "freebsd15-0c", "ubuntu22", "ubuntu24"]'
-          QUICK_OS='["almalinux8", "almalinux9", "almalinux10", "debian12", "fedora42", "freebsd14-3s", "ubuntu24"]'
+          ci_type="default"
+
           # determine CI type when running on PR
-          ci_type="full"
           if ${{ github.event_name == 'pull_request' }}; then
             head=${{ github.event.pull_request.head.sha }}
             base=${{ github.event.pull_request.base.sha }}
             ci_type=$(python3 .github/workflows/scripts/generate-ci-type.py $head $base)
           fi
-          if [ "$ci_type" == "quick" ]; then
-            os_selection="$QUICK_OS"
-          else
-            os_selection="$FULL_OS"
-          fi
+
+          case "$ci_type" in
+          quick)
+            os_selection='["almalinux8", "almalinux9", "almalinux10", "debian12", "fedora42", "freebsd15-0s", "ubuntu24"]'
+            ;;
+          linux)
+            os_selection='["almalinux8", "almalinux9", "almalinux10", "centos-stream9", "centos-stream10", "debian11", "debian12", "debian13", "fedora41", "fedora42", "fedora43", "ubuntu22", "ubuntu24"]'
+            ;;
+          freebsd)
+            os_selection='["freebsd13-5r", "freebsd14-2r", "freebsd14-3r", "freebsd13-5s", "freebsd14-3s", "freebsd15-0s", "freebsd16-0c"]'
+            ;;
+          *)
+            # default list
+            os_selection='["almalinux8", "almalinux9", "almalinux10", "centos-stream9", "centos-stream10", "debian12", "debian13", "fedora42", "fedora43", "freebsd14-3r", "freebsd15-0s", "freebsd16-0c", "ubuntu22", "ubuntu24"]'
+            ;;
+          esac
 
           if ${{ github.event.inputs.fedora_kernel_ver != '' }}; then
-              # They specified a custom kernel version for Fedora.  Use only
-              # Fedora runners.
+              # They specified a custom kernel version for Fedora.
+              # Use only Fedora runners.
               os_json=$(echo ${os_selection} | jq -c '[.[] | select(startswith("fedora"))]')
           else
               # Normal case
@@ -62,13 +72,13 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        # rhl:     almalinux8, almalinux9, centos-stream9, fedora4x
+        # rhl:     almalinux8, almalinux9, centos-streamX, fedora4x
         # debian:  debian12, debian13, ubuntu22, ubuntu24
         # misc:    archlinux, tumbleweed
-        # FreeBSD variants of 2025-06:
+        # FreeBSD variants of november 2025:
         # FreeBSD Release: freebsd13-5r, freebsd14-2r, freebsd14-3r
-        # FreeBSD Stable:  freebsd13-5s, freebsd14-3s
-        # FreeBSD Current: freebsd15-0c, freebsd16-0c
+        # FreeBSD Stable:  freebsd13-5s, freebsd14-3s, freebsd15-0s
+        # FreeBSD Current: freebsd16-0c
         os: ${{ fromJson(needs.test-config.outputs.test_os) }}
     runs-on: ubuntu-24.04
     steps:
diff --git a/sys/contrib/openzfs/.mailmap b/sys/contrib/openzfs/.mailmap
index e6f09c6c9d43..3397fbc3745d 100644
--- a/sys/contrib/openzfs/.mailmap
+++ b/sys/contrib/openzfs/.mailmap
@@ -53,6 +53,7 @@ Jason Harmening <jason.harmening@gmail.com>
 Jeremy Faulkner <gldisater@gmail.com>
 Jinshan Xiong <jinshan.xiong@gmail.com>
 John Poduska <jpoduska@datto.com>
+Jo Zzsi <jozzsicsataban@gmail.com>
 Justin Scholz <git@justinscholz.de>
 Ka Ho Ng <khng300@gmail.com>
 Kash Pande <github@tripleback.net>
@@ -67,6 +68,7 @@ Michael Gmelin <grembo@FreeBSD.org>
 Olivier Mazouffre <olivier.mazouffre@ims-bordeaux.fr>
 Piotr Kubaj <pkubaj@anongoth.pl>
 Quentin Zdanis <zdanisq@gmail.com>
+Roberto Ricci <io@r-ricci.it>
 Roberto Ricci <ricci@disroot.org>
 Rob Norris <robn@despairlabs.com>
 Rob Norris <rob.norris@klarasystems.com>
@@ -83,7 +85,10 @@ Youzhong Yang <youzhong@gmail.com>
 # Signed-off-by: overriding Author:
 Alexander Ziaee <ziaee@FreeBSD.org> <concussious@runbox.com>
 Felix Schmidt <felixschmidt20@aol.com> <f.sch.prototype@gmail.com>
+Jean-Sébastien Pédron <dumbbell@FreeBSD.org> <jean-sebastien.pedron@dumbbell.fr>
+Konstantin Belousov <kib@FreeBSD.org> <kib@kib.kiev.ua>
 Olivier Certner <olce@FreeBSD.org> <olce.freebsd@certner.fr>
+Patrick Xia <patrickx@google.com> <octalc0de@aim.com>
 Phil Sutter <phil@nwl.cc> <p.github@nwl.cc>
 poscat <poscat@poscat.moe> <poscat0x04@outlook.com>
 Qiuhao Chen <chenqiuhao1997@gmail.com> <haohao0924@126.com>
@@ -125,6 +130,7 @@ buzzingwires <buzzingwires@outlook.com> <131118055+buzzingwires@users.noreply.gi
 Cedric Maunoury <cedric.maunoury@gmail.com> <38213715+cedricmaunoury@users.noreply.github.com>
 Charles Suh <charles.suh@gmail.com> <charlessuh@users.noreply.github.com>
 Chris Peredun <chris.peredun@ixsystems.com> <126915832+chrisperedun@users.noreply.github.com>
+classabbyamp <dev@placeviolette.net> <5366828+classabbyamp@users.noreply.github.com>
 Dacian Reece-Stremtan <dacianstremtan@gmail.com> <35844628+dacianstremtan@users.noreply.github.com>
 Damian Szuberski <szuberskidamian@gmail.com> <30863496+szubersk@users.noreply.github.com>
 Daniel Hiepler <d-git@coderdu.de> <32984777+heeplr@users.noreply.github.com>
@@ -185,6 +191,7 @@ Michael Niewöhner <foss@mniewoehner.de> <c0d3z3r0@users.noreply.github.com>
 Michael Zhivich <mzhivich@akamai.com> <33133421+mzhivich@users.noreply.github.com>
 MigeljanImeri <ImeriMigel@gmail.com> <78048439+MigeljanImeri@users.noreply.github.com>
 Mo Zhou <cdluminate@gmail.com> <5723047+cdluminate@users.noreply.github.com>
+nav1s <nav1s@proton.me> <42621369+nav1s@users.noreply.github.com>
 Nick Mattis <nickm970@gmail.com> <nmattis@users.noreply.github.com>
 omni <omni+vagant@hack.org> <79493359+omnivagant@users.noreply.github.com>
 Pablo Correa Gómez <ablocorrea@hotmail.com> <32678034+pablofsf@users.noreply.github.com>
@@ -206,6 +213,7 @@ Samuel Wycliffe <samuelwycliffe@gmail.com> <50765275+npc203@users.noreply.github
 Savyasachee Jha <hi@savyasacheejha.com> <savyajha@users.noreply.github.com>
 Scott Colby <scott@scolby.com> <scolby33@users.noreply.github.com>
 Sean Eric Fagan <kithrup@mac.com> <kithrup@users.noreply.github.com>
+Shreshth Srivastava <shreshthsrivastava2@gmail.com> <66148173+Shreshth3@users.noreply.github.com>
 Spencer Kinny <spencerkinny1995@gmail.com> <30333052+Spencer-Kinny@users.noreply.github.com>
 Srikanth N S <srikanth.nagasubbaraoseetharaman@hpe.com> <75025422+nssrikanth@users.noreply.github.com>
 Stefan Lendl <s.lendl@proxmox.com> <1321542+stfl@users.noreply.github.com>
diff --git a/sys/contrib/openzfs/AUTHORS b/sys/contrib/openzfs/AUTHORS
index 6c34c07f39ef..e496c0e8a807 100644
--- a/sys/contrib/openzfs/AUTHORS
+++ b/sys/contrib/openzfs/AUTHORS
@@ -154,6 +154,7 @@ CONTRIBUTORS:
     Chris Zubrzycki <github@mid-earth.net>
     Chuck Tuffli <ctuffli@gmail.com>
     Chunwei Chen <david.chen@nutanix.com>
+    classabbyamp <dev@placeviolette.net>
     Clemens Fruhwirth <clemens@endorphin.org>
     Clemens Lang <cl@clang.name>
     Clint Armstrong <clint@clintarmstrong.net>
@@ -161,6 +162,7 @@ CONTRIBUTORS:
     Colin Ian King <colin.king@canonical.com>
     Colin Percival <cperciva@tarsnap.com>
     Colm Buckley <colm@tuatha.org>
+    Cong Zhang <congzhangzh@users.noreply.github.com>
     Crag Wang <crag0715@gmail.com>
     Craig Loomis <cloomis@astro.princeton.edu>
     Craig Sanders <github@taz.net.au>
@@ -217,6 +219,7 @@ CONTRIBUTORS:
     Eitan Adler <lists@eitanadler.com>
     Eli Rosenthal <eli.rosenthal@delphix.com>
     Eli Schwartz <eschwartz93@gmail.com>
+    Eric A. Borisch <eborisch@gmail.com>
     Eric Desrochers <eric.desrochers@canonical.com>
     Eric Dillmann <eric@jave.fr>
     Eric Schrock <Eric.Schrock@delphix.com>
@@ -288,6 +291,7 @@ CONTRIBUTORS:
     Henrik Riomar <henrik.riomar@gmail.com>
     Herb Wartens <wartens2@llnl.gov>
     Hiếu Lê <leorize+oss@disroot.org>
+    hoshinomori <hoshinomorimorimo@gmail.com>
     Huang Liu <liu.huang@zte.com.cn>
     Håkan Johansson <f96hajo@chalmers.se>
     Igor K <igor@dilos.org>
@@ -300,6 +304,7 @@ CONTRIBUTORS:
     ilovezfs <ilovezfs@icloud.com>
     InsanePrawn <Insane.Prawny@gmail.com>
     Isaac Huang <he.huang@intel.com>
+    Ivan Shapovalov <intelfx@intelfx.name>
     Ivan Volosyuk <Ivan.Volosyuk@gmail.com>
     Jacek Fefliński <feflik@gmail.com>
     Jacob Adams <tookmund@gmail.com>
@@ -322,6 +327,7 @@ CONTRIBUTORS:
     Javen Wu <wu.javen@gmail.com>
     Jaydeep Kshirsagar <jkshirsagar@maxlinear.com>
     Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
+    Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
     Jeff Dike <jdike@akamai.com>
     Jeremy Faulkner <gldisater@gmail.com>
     Jeremy Gill <jgill@parallax-innovations.com>
@@ -355,7 +361,9 @@ CONTRIBUTORS:
     Josh Soref <jsoref@users.noreply.github.com>
     Joshua M. Clulow <josh@sysmgr.org>
     José Luis Salvador Rufo <salvador.joseluis@gmail.com>
+    Jo Zzsi <jozzsicsataban@gmail.com>
     João Carlos Mendes Luís <jonny@jonny.eng.br>
+    JT Pennington <jt.pennington@klarasystems.com>
     Julian Brunner <julian.brunner@gmail.com>
     Julian Heuking <JulianH@beckhoff.com>
     jumbi77 <jumbi77@users.noreply.github.com>
@@ -388,6 +396,7 @@ CONTRIBUTORS:
     Kleber Tarcísio <klebertarcisio@yahoo.com.br>
     Kody A Kantor <kody.kantor@gmail.com>
     Kohsuke Kawaguchi <kk@kohsuke.org>
+    Konstantin Belousov <kib@FreeBSD.org>
     Konstantin Khorenko <khorenko@virtuozzo.com>
     KORN Andras <korn@elan.rulez.org>
     kotauskas <v.toncharov@gmail.com>
@@ -416,6 +425,7 @@ CONTRIBUTORS:
     luozhengzheng <luo.zhengzheng@zte.com.cn>
     Luís Henriques <henrix@camandro.org>
     Madhav Suresh <madhav.suresh@delphix.com>
+    Maksym Shkolnyi <maksym.shkolnyi@workato.com>
     manfromafar <jonsonb10@gmail.com>
     Manoj Joseph <manoj.joseph@delphix.com>
     Manuel Amador (Rudd-O) <rudd-o@rudd-o.com>
@@ -482,6 +492,7 @@ CONTRIBUTORS:
     Nathaniel Clark <Nathaniel.Clark@misrule.us>
     Nathaniel Wesley Filardo <nwf@cs.jhu.edu>
     Nathan Lewis <linux.robotdude@gmail.com>
+    nav1s <nav1s@proton.me>
     Nav Ravindranath <nav@delphix.com>
     Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
     Ned Bass <bass6@llnl.gov>
@@ -506,6 +517,7 @@ CONTRIBUTORS:
     Palash Gandhi <pbg4930@rit.edu>
     Patrick Fasano <patrick@patrickfasano.com>
     Patrick Mooney <pmooney@pfmooney.com>
+    Patrick Xia <patrickx@google.com>
     Patrik Greco <sikevux@sikevux.se>
     Paul B. Henson <henson@acm.org>
     Paul Dagnelie <pcd@delphix.com>
@@ -605,6 +617,7 @@ CONTRIBUTORS:
     Shengqi Chen <harry-chen@outlook.com>
     SHENGYI HONG <aokblast@FreeBSD.org>
     Shen Yan <shenyanxxxy@qq.com>
+    Shreshth Srivastava <shreshthsrivastava2@gmail.com>
     Sietse <sietse@wizdom.nu>
     Simon Guest <simon.guest@tesujimath.org>
     Simon Howard <fraggle@soulsphere.org>
@@ -665,6 +678,7 @@ CONTRIBUTORS:
     Toyam Cox <aviator45003@gmail.com>
     Trevor Bautista <trevrb@trevrb.net>
     Trey Dockendorf <treydock@gmail.com>
+    trick2011 <trick2011@users.noreply.github.com>
     Troels Nørgaard <tnn@tradeshift.com>
     tstabrawa <tstabrawa@users.noreply.github.com>
     Tulsi Jain <tulsi.jain@delphix.com>
diff --git a/sys/contrib/openzfs/META b/sys/contrib/openzfs/META
index 2bfa51841cc4..da43a41ab824 100644
--- a/sys/contrib/openzfs/META
+++ b/sys/contrib/openzfs/META
@@ -2,7 +2,7 @@ Meta:          1
 Name:          zfs
 Branch:        1.0
 Version:       2.4.0
-Release:       rc3
+Release:       rc4
 Release-Tags:  relext
 License:       CDDL
 Author:        OpenZFS
diff --git a/sys/contrib/openzfs/README.md b/sys/contrib/openzfs/README.md
index a90736bb56b7..a39b88fedd12 100644
--- a/sys/contrib/openzfs/README.md
+++ b/sys/contrib/openzfs/README.md
@@ -10,7 +10,7 @@ This repository contains the code for running OpenZFS on Linux and FreeBSD.
 # Official Resources
 
   * [Documentation](https://openzfs.github.io/openzfs-docs/) - for using and developing this repo
-  * [ZoL Site](https://zfsonlinux.org) - Linux release info & links
+  * [ZoL site](https://zfsonlinux.org) - Linux release info & links
   * [Mailing lists](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/Mailing%20Lists.html)
   * [OpenZFS site](https://openzfs.org/) - for conference videos and info on other platforms (illumos, OSX, Windows, etc)
 
diff --git a/sys/contrib/openzfs/autogen.sh b/sys/contrib/openzfs/autogen.sh
index 39eb82203d69..5cb152474698 100755
--- a/sys/contrib/openzfs/autogen.sh
+++ b/sys/contrib/openzfs/autogen.sh
@@ -1,62 +1,3 @@
 #!/bin/sh
-[ "${0%/*}" = "$0" ] || cd "${0%/*}" || exit
 
-# %reldir%/%canon_reldir% (%D%/%C%) only appeared in automake 1.14, but RHEL/CentOS 7 has 1.13.4
-# This is an (overly) simplistic preprocessor that papers around this for the duration of the generation step,
-# and can be removed once support for CentOS 7 is dropped
-automake --version | awk '{print $NF; exit}' | (
-	IFS=. read -r AM_MAJ AM_MIN _
-	[ "$AM_MAJ" -gt 1 ] || [ "$AM_MIN" -ge 14 ]
-) || {
-	process_root() {
-		root="$1"; shift
-
-		grep -q '%[CD]%' "$root/Makefile.am" || return
-		find "$root" -name Makefile.am "$@" | while read -r dir; do
-			dir="${dir%/Makefile.am}"
-			grep -q '%[CD]%' "$dir/Makefile.am" || continue
-
-			reldir="${dir#"$root"}"
-			reldir="${reldir#/}"
-
-			canon_reldir="$(printf '%s' "$reldir" | tr -C 'a-zA-Z0-9@_' '_')"
-
-			reldir_slash="$reldir/"
-			canon_reldir_slash="${canon_reldir}_"
-			[ -z "$reldir" ] && reldir_slash=
-			[ -z "$reldir" ] && canon_reldir_slash=
-
-			echo "$dir/Makefile.am" >&3
-			sed -i~ -e "s:%D%/:$reldir_slash:g"       -e "s:%D%:$reldir:g" \
-			        -e "s:%C%_:$canon_reldir_slash:g" -e "s:%C%:$canon_reldir:g" "$dir/Makefile.am"
-		done 3>>"$substituted_files"
-	}
-
-	rollback() {
-		while read -r f; do
-			mv "$f~" "$f"
-		done < "$substituted_files"
-		rm -f "$substituted_files"
-	}
-
-
-	echo "Automake <1.14; papering over missing %reldir%/%canon_reldir% support" >&2
-
-	substituted_files="$(mktemp)"
-	trap rollback EXIT
-
-	roots="$(sed '/Makefile$/!d;/module/d;s:^\s*:./:;s:/Makefile::;/^\.$/d' configure.ac)"
-
-	IFS="
-"
-	for root in $roots; do
-		root="${root#./}"
-		process_root "$root"
-	done
-
-	set -f
-	# shellcheck disable=SC2086,SC2046
-	process_root . $(printf '!\n-path\n%s/*\n' $roots)
-}
-
-autoreconf -fiv && rm -rf autom4te.cache
+autoreconf -fiv "$(dirname "$0")" && rm -rf "$(dirname "$0")"/autom4te.cache
diff --git a/sys/contrib/openzfs/cmd/zdb/zdb.c b/sys/contrib/openzfs/cmd/zdb/zdb.c
index 2560ad045db3..fa8e7fa691db 100644
--- a/sys/contrib/openzfs/cmd/zdb/zdb.c
+++ b/sys/contrib/openzfs/cmd/zdb/zdb.c
@@ -7899,11 +7899,11 @@ zdb_set_skip_mmp(char *target)
 	 * Disable the activity check to allow examination of
 	 * active pools.
 	 */
-	mutex_enter(&spa_namespace_lock);
+	spa_namespace_enter(FTAG);
 	if ((spa = spa_lookup(target)) != NULL) {
 		spa->spa_import_flags |= ZFS_IMPORT_SKIP_MMP;
 	}
-	mutex_exit(&spa_namespace_lock);
+	spa_namespace_exit(FTAG);
 }
 
 #define	BOGUS_SUFFIX "_CHECKPOINTED_UNIVERSE"
@@ -10022,13 +10022,13 @@ main(int argc, char **argv)
 				 * try opening the pool after clearing the
 				 * log state.
 				 */
-				mutex_enter(&spa_namespace_lock);
+				spa_namespace_enter(FTAG);
 				if ((spa = spa_lookup(target)) != NULL &&
 				    spa->spa_log_state == SPA_LOG_MISSING) {
 					spa->spa_log_state = SPA_LOG_CLEAR;
 					error = 0;
 				}
-				mutex_exit(&spa_namespace_lock);
+				spa_namespace_exit(FTAG);
 
 				if (!error) {
 					error = spa_open_rewind(target, &spa,
diff --git a/sys/contrib/openzfs/cmd/zfs/zfs_project.c b/sys/contrib/openzfs/cmd/zfs/zfs_project.c
index fbf5e6cbdc68..8925e6672bef 100644
--- a/sys/contrib/openzfs/cmd/zfs/zfs_project.c
+++ b/sys/contrib/openzfs/cmd/zfs/zfs_project.c
@@ -145,11 +145,11 @@ zfs_project_handle_one(const char *name, zfs_project_control_t *zpc)
 	switch (zpc->zpc_op) {
 	case ZFS_PROJECT_OP_LIST:
 		(void) printf("%5u %c %s\n", fsx.fsx_projid,
-		    (fsx.fsx_xflags & ZFS_PROJINHERIT_FL) ? 'P' : '-', name);
+		    (fsx.fsx_xflags & FS_XFLAG_PROJINHERIT) ? 'P' : '-', name);
 		goto out;
 	case ZFS_PROJECT_OP_CHECK:
 		if (fsx.fsx_projid == zpc->zpc_expected_projid &&
-		    fsx.fsx_xflags & ZFS_PROJINHERIT_FL)
+		    fsx.fsx_xflags & FS_XFLAG_PROJINHERIT)
 			goto out;
 
 		if (!zpc->zpc_newline) {
@@ -164,29 +164,30 @@ zfs_project_handle_one(const char *name, zfs_project_control_t *zpc)
 			    "(%u/%u)\n", name, fsx.fsx_projid,
 			    (uint32_t)zpc->zpc_expected_projid);
 
-		if (!(fsx.fsx_xflags & ZFS_PROJINHERIT_FL))
+		if (!(fsx.fsx_xflags & FS_XFLAG_PROJINHERIT))
 			(void) printf("%s - project inherit flag is not set\n",
 			    name);
 
 		goto out;
 	case ZFS_PROJECT_OP_CLEAR:
-		if (!(fsx.fsx_xflags & ZFS_PROJINHERIT_FL) &&
+		if (!(fsx.fsx_xflags & FS_XFLAG_PROJINHERIT) &&
 		    (zpc->zpc_keep_projid ||
 		    fsx.fsx_projid == ZFS_DEFAULT_PROJID))
 			goto out;
 
-		fsx.fsx_xflags &= ~ZFS_PROJINHERIT_FL;
+		fsx.fsx_xflags &= ~FS_XFLAG_PROJINHERIT;
 		if (!zpc->zpc_keep_projid)
 			fsx.fsx_projid = ZFS_DEFAULT_PROJID;
 		break;
 	case ZFS_PROJECT_OP_SET:
 		if (fsx.fsx_projid == zpc->zpc_expected_projid &&
-		    (!zpc->zpc_set_flag || fsx.fsx_xflags & ZFS_PROJINHERIT_FL))
+		    (!zpc->zpc_set_flag ||
+		    fsx.fsx_xflags & FS_XFLAG_PROJINHERIT))
 			goto out;
 
 		fsx.fsx_projid = zpc->zpc_expected_projid;
 		if (zpc->zpc_set_flag)
-			fsx.fsx_xflags |= ZFS_PROJINHERIT_FL;
+			fsx.fsx_xflags |= FS_XFLAG_PROJINHERIT;
 		break;
 	default:
 		ASSERT(0);
@@ -194,11 +195,30 @@ zfs_project_handle_one(const char *name, zfs_project_control_t *zpc)
 	}
 
 	ret = ioctl(fd, ZFS_IOC_FSSETXATTR, &fsx);
-	if (ret)
+	if (ret) {
 		(void) fprintf(stderr,
 		    gettext("failed to set xattr for %s: %s\n"),
 		    name, strerror(errno));
 
+		if (errno == ENOTSUP) {
+			char *kver = zfs_version_kernel();
+			/*
+			 * Special case: a module/userspace version mismatch can
+			 * return ENOTSUP due to us fixing the XFLAGs bits in
+			 * #17884.  In that case give a hint to the user that
+			 * they should take action to make the versions match.
+			 */
+			if (strcmp(kver, ZFS_META_ALIAS) != 0) {
+				fprintf(stderr,
+				    gettext("Warning: The zfs module version "
+				    "(%s) and userspace\nversion (%s) do not "
+				    "match up.  This may be the\ncause of the "
+				    "\"Operation not supported\" error.\n"),
+				    kver, ZFS_META_ALIAS);
+			}
+		}
+	}
+
 out:
 	close(fd);
 	return (ret);
diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_main.c b/sys/contrib/openzfs/cmd/zpool/zpool_main.c
index 1feec55c0e8b..18952775bcfe 100644
--- a/sys/contrib/openzfs/cmd/zpool/zpool_main.c
+++ b/sys/contrib/openzfs/cmd/zpool/zpool_main.c
@@ -494,8 +494,7 @@ get_usage(zpool_help_t idx)
 		    "[--json-int, --json-pool-key-guid]] ...\n"
 		    "\t    [-T d|u] [pool] [interval [count]]\n"));
 	case HELP_PREFETCH:
-		return (gettext("\tprefetch -t <type> [<type opts>] <pool>\n"
-		    "\t    -t ddt <pool>\n"));
+		return (gettext("\tprefetch [-t <type>] <pool>\n"));
 	case HELP_OFFLINE:
 		return (gettext("\toffline [--power]|[[-f][-t]] <pool> "
 		    "<device> ...\n"));
@@ -4200,7 +4199,7 @@ zpool_do_checkpoint(int argc, char **argv)
 #define	CHECKPOINT_OPT	1024
 
 /*
- * zpool prefetch <type> [<type opts>] <pool>
+ * zpool prefetch [-t <type>] <pool>
  *
  * Prefetchs a particular type of data in the specified pool.
  */
@@ -4245,20 +4244,27 @@ zpool_do_prefetch(int argc, char **argv)
 
 	poolname = argv[0];
 
-	argc--;
-	argv++;
-
-	if (strcmp(typestr, "ddt") == 0) {
-		type = ZPOOL_PREFETCH_DDT;
-	} else {
-		(void) fprintf(stderr, gettext("unsupported prefetch type\n"));
-		usage(B_FALSE);
-	}
-
 	if ((zhp = zpool_open(g_zfs, poolname)) == NULL)
 		return (1);
 
-	err = zpool_prefetch(zhp, type);
+	if (typestr == NULL) {
+		/* Prefetch all types */
+		err = zpool_prefetch(zhp, ZPOOL_PREFETCH_DDT);
+		if (err == 0)
+			err = zpool_prefetch(zhp, ZPOOL_PREFETCH_BRT);
+	} else {
+		if (strcmp(typestr, "ddt") == 0) {
+			type = ZPOOL_PREFETCH_DDT;
+		} else if (strcmp(typestr, "brt") == 0) {
+			type = ZPOOL_PREFETCH_BRT;
+		} else {
+			(void) fprintf(stderr,
+			    gettext("unsupported prefetch type\n"));
+			zpool_close(zhp);
+			usage(B_FALSE);
+		}
+		err = zpool_prefetch(zhp, type);
+	}
 
 	zpool_close(zhp);
 
diff --git a/sys/contrib/openzfs/cmd/ztest.c b/sys/contrib/openzfs/cmd/ztest.c
index 89752dcb0f0f..89b1f68606ea 100644
--- a/sys/contrib/openzfs/cmd/ztest.c
+++ b/sys/contrib/openzfs/cmd/ztest.c
@@ -1228,10 +1228,10 @@ ztest_kill(ztest_shared_t *zs)
 	 * See comment above spa_write_cachefile().
 	 */
 	if (raidz_expand_pause_point != RAIDZ_EXPAND_PAUSE_NONE) {
-		if (mutex_tryenter(&spa_namespace_lock)) {
+		if (spa_namespace_tryenter(FTAG)) {
 			spa_write_cachefile(ztest_spa, B_FALSE, B_FALSE,
 			    B_FALSE);
-			mutex_exit(&spa_namespace_lock);
+			spa_namespace_exit(FTAG);
 
 			ztest_scratch_state->zs_raidz_scratch_verify_pause =
 			    raidz_expand_pause_point;
@@ -1246,9 +1246,9 @@ ztest_kill(ztest_shared_t *zs)
 			return;
 		}
 	} else {
-		mutex_enter(&spa_namespace_lock);
+		spa_namespace_enter(FTAG);
 		spa_write_cachefile(ztest_spa, B_FALSE, B_FALSE, B_FALSE);
-		mutex_exit(&spa_namespace_lock);
+		spa_namespace_exit(FTAG);
 	}
 
 	(void) raise(SIGKILL);
@@ -2306,7 +2306,8 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
 	}
 
 	if (abuf == NULL) {
-		dmu_write(os, lr->lr_foid, offset, length, data, tx);
+		dmu_write(os, lr->lr_foid, offset, length, data, tx,
+		    DMU_READ_PREFETCH);
 	} else {
 		memcpy(abuf->b_data, data, length);
 		VERIFY0(dmu_assign_arcbuf_by_dbuf(db, offset, abuf, tx, 0));
@@ -3688,10 +3689,10 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id)
 
 	if (error == 0) {
 		(void) printf("successful split - results:\n");
-		mutex_enter(&spa_namespace_lock);
+		spa_namespace_enter(FTAG);
 		show_pool_stats(spa);
 		show_pool_stats(spa_lookup("splitp"));
-		mutex_exit(&spa_namespace_lock);
+		spa_namespace_exit(FTAG);
 		++zs->zs_splits;
 		--zs->zs_mirrors;
 	}
@@ -3975,11 +3976,11 @@ raidz_scratch_verify(void)
 
 	kernel_init(SPA_MODE_READ);
 
-	mutex_enter(&spa_namespace_lock);
+	spa_namespace_enter(FTAG);
 	spa = spa_lookup(ztest_opts.zo_pool);
 	ASSERT(spa);
 	spa->spa_import_flags |= ZFS_IMPORT_SKIP_MMP;
-	mutex_exit(&spa_namespace_lock);
+	spa_namespace_exit(FTAG);
 
 	VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
 
@@ -5243,7 +5244,8 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
 	 * We've verified all the old bufwads, and made new ones.
 	 * Now write them out.
 	 */
-	dmu_write(os, packobj, packoff, packsize, packbuf, tx);
+	dmu_write(os, packobj, packoff, packsize, packbuf, tx,
+	    DMU_READ_PREFETCH);
 
 	if (freeit) {
 		if (ztest_opts.zo_verbose >= 7) {
@@ -5258,7 +5260,8 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
 			    " txg %"PRIx64"\n",
 			    bigoff, bigsize, txg);
 		}
-		dmu_write(os, bigobj, bigoff, bigsize, bigbuf, tx);
+		dmu_write(os, bigobj, bigoff, bigsize, bigbuf, tx,
+		    DMU_READ_PREFETCH);
 	}
 
 	dmu_tx_commit(tx);
@@ -5513,7 +5516,8 @@ ztest_dmu_read_write_zcopy(ztest_ds_t *zd, uint64_t id)
 		 * We've verified all the old bufwads, and made new ones.
 		 * Now write them out.
 		 */
-		dmu_write(os, packobj, packoff, packsize, packbuf, tx);
+		dmu_write(os, packobj, packoff, packsize, packbuf, tx,
+		    DMU_READ_PREFETCH);
 		if (ztest_opts.zo_verbose >= 7) {
 			(void) printf("writing offset %"PRIx64" size %"PRIx64""
 			    " txg %"PRIx64"\n",
@@ -6119,7 +6123,8 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
 		    "future leak: got %"PRIu64", open txg is %"PRIu64"",
 		    old_txg, txg);
 
-	dmu_write(os, od->od_object, 0, sizeof (uint64_t), &txg, tx);
+	dmu_write(os, od->od_object, 0, sizeof (uint64_t), &txg, tx,
+	    DMU_READ_PREFETCH);
 
 	(void) mutex_enter(&zcl.zcl_callbacks_lock);
 
@@ -7422,11 +7427,11 @@ ztest_walk_pool_directory(const char *header)
 	if (ztest_opts.zo_verbose >= 6)
 		(void) puts(header);
 
-	mutex_enter(&spa_namespace_lock);
+	spa_namespace_enter(FTAG);
 	while ((spa = spa_next(spa)) != NULL)
 		if (ztest_opts.zo_verbose >= 6)
 			(void) printf("\t%s\n", spa_name(spa));
-	mutex_exit(&spa_namespace_lock);
+	spa_namespace_exit(FTAG);
 }
 
 static void
@@ -8541,11 +8546,11 @@ ztest_run(ztest_shared_t *zs)
 	/*
 	 * Verify that we can loop over all pools.
 	 */
-	mutex_enter(&spa_namespace_lock);
+	spa_namespace_enter(FTAG);
 	for (spa = spa_next(NULL); spa != NULL; spa = spa_next(spa))
 		if (ztest_opts.zo_verbose > 3)
 			(void) printf("spa_next: found %s\n", spa_name(spa));
-	mutex_exit(&spa_namespace_lock);
+	spa_namespace_exit(FTAG);
 
 	/*
 	 * Verify that we can export the pool and reimport it under a
diff --git a/sys/contrib/openzfs/config/deb.am b/sys/contrib/openzfs/config/deb.am
index 9e58e1905b73..3e9a9379712e 100644
--- a/sys/contrib/openzfs/config/deb.am
+++ b/sys/contrib/openzfs/config/deb.am
@@ -58,9 +58,9 @@ deb-utils: deb-local rpm-utils-initramfs
 	pkg1=$${name}-$${version}.$${arch}.rpm; \
 	pkg2=libnvpair3-$${version}.$${arch}.rpm; \
 	pkg3=libuutil3-$${version}.$${arch}.rpm; \
-	pkg4=libzfs6-$${version}.$${arch}.rpm; \
-	pkg5=libzpool6-$${version}.$${arch}.rpm; \
-	pkg6=libzfs6-devel-$${version}.$${arch}.rpm; \
+	pkg4=libzfs7-$${version}.$${arch}.rpm; \
+	pkg5=libzpool7-$${version}.$${arch}.rpm; \
+	pkg6=libzfs7-devel-$${version}.$${arch}.rpm; \
 	pkg7=$${name}-test-$${version}.$${arch}.rpm; \
 	pkg8=$${name}-dracut-$${version}.noarch.rpm; \
 	pkg9=$${name}-initramfs-$${version}.$${arch}.rpm; \
@@ -72,7 +72,7 @@ deb-utils: deb-local rpm-utils-initramfs
 	path_prepend=`mktemp -d /tmp/intercept.XXXXXX`; \
 	echo "#!$(SHELL)" > $${path_prepend}/dh_shlibdeps; \
 	echo "`which dh_shlibdeps` -- \
-	 -xlibuutil3linux -xlibnvpair3linux -xlibzfs6linux -xlibzpool6linux" \
+	 -xlibuutil3linux -xlibnvpair3linux -xlibzfs7linux -xlibzpool7linux" \
 	 >> $${path_prepend}/dh_shlibdeps; \
 ## These -x arguments are passed to dpkg-shlibdeps, which exclude the
 ## Debianized packages from the auto-generated dependencies of the new debs,
diff --git a/sys/contrib/openzfs/contrib/debian/Makefile.am b/sys/contrib/openzfs/contrib/debian/Makefile.am
index 99d512312df6..3c219856005e 100644
--- a/sys/contrib/openzfs/contrib/debian/Makefile.am
+++ b/sys/contrib/openzfs/contrib/debian/Makefile.am
@@ -12,14 +12,14 @@ dist_noinst_DATA += %D%/openzfs-libpam-zfs.postinst
 dist_noinst_DATA += %D%/openzfs-libpam-zfs.prerm
 dist_noinst_DATA += %D%/openzfs-libuutil3.docs
 dist_noinst_DATA += %D%/openzfs-libuutil3.install.in
-dist_noinst_DATA += %D%/openzfs-libzfs6.docs
-dist_noinst_DATA += %D%/openzfs-libzfs6.install.in
+dist_noinst_DATA += %D%/openzfs-libzfs7.docs
+dist_noinst_DATA += %D%/openzfs-libzfs7.install.in
 dist_noinst_DATA += %D%/openzfs-libzfsbootenv1.docs
 dist_noinst_DATA += %D%/openzfs-libzfsbootenv1.install.in
 dist_noinst_DATA += %D%/openzfs-libzfs-dev.docs
 dist_noinst_DATA += %D%/openzfs-libzfs-dev.install.in
-dist_noinst_DATA += %D%/openzfs-libzpool6.docs
-dist_noinst_DATA += %D%/openzfs-libzpool6.install.in
+dist_noinst_DATA += %D%/openzfs-libzpool7.docs
+dist_noinst_DATA += %D%/openzfs-libzpool7.install.in
 dist_noinst_DATA += %D%/openzfs-python3-pyzfs.install
 dist_noinst_DATA += %D%/openzfs-zfs-dkms.config
 dist_noinst_DATA += %D%/openzfs-zfs-dkms.dkms
diff --git a/sys/contrib/openzfs/contrib/debian/clean b/sys/contrib/openzfs/contrib/debian/clean
index 4f52d01b8108..caabcd30c62a 100644
--- a/sys/contrib/openzfs/contrib/debian/clean
+++ b/sys/contrib/openzfs/contrib/debian/clean
@@ -6,6 +6,6 @@ contrib/pyzfs/libzfs_core/bindings/__pycache__/
 contrib/pyzfs/pyzfs.egg-info/
 debian/openzfs-libnvpair3.install
 debian/openzfs-libuutil3.install
-debian/openzfs-libzfs6.install
+debian/openzfs-libzfs7.install
 debian/openzfs-libzfs-dev.install
-debian/openzfs-libzpool6.install
+debian/openzfs-libzpool7.install
diff --git a/sys/contrib/openzfs/contrib/debian/control b/sys/contrib/openzfs/contrib/debian/control
index c5358dedc0fd..a886c2e86cc5 100644
--- a/sys/contrib/openzfs/contrib/debian/control
+++ b/sys/contrib/openzfs/contrib/debian/control
@@ -79,9 +79,9 @@ Architecture: linux-any
 Depends: libssl-dev | libssl1.0-dev,
          openzfs-libnvpair3 (= ${binary:Version}),
          openzfs-libuutil3 (= ${binary:Version}),
-         openzfs-libzfs6 (= ${binary:Version}),
+         openzfs-libzfs7 (= ${binary:Version}),
          openzfs-libzfsbootenv1 (= ${binary:Version}),
-         openzfs-libzpool6 (= ${binary:Version}),
+         openzfs-libzpool7 (= ${binary:Version}),
          ${misc:Depends}
 Replaces: libzfslinux-dev
 Conflicts: libzfslinux-dev
@@ -91,18 +91,18 @@ Description: OpenZFS filesystem development files for Linux
  libraries of OpenZFS filesystem.
  .
*** 5226 LINES SKIPPED ***