Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Apr 2021 15:03:47 GMT
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 049d49e40a9d - stable/13 - zfs: merge openzfs/zfs@3522f57b6 (master)
Message-ID:  <202104221503.13MF3lWa007716@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mm:

URL: https://cgit.FreeBSD.org/src/commit/?id=049d49e40a9d80facd7481785dca30d49e9110ff

commit 049d49e40a9d80facd7481785dca30d49e9110ff
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2021-04-14 10:49:10 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2021-04-22 15:03:06 +0000

    zfs: merge openzfs/zfs@3522f57b6 (master)
    
    Notable upstream pull request merges:
      #11742 When specifying raidz vdev name, parity count should match
      #11744 Use a helper function to clarify gang block size
      #11771 Support running FreeBSD buildworld on Arm-based macOS hosts
    
    This is the last update that will be MFCed into stable/13.
    
    From now on, the tracking of OpenZFS branches will be different:
    - main continues tracking openzfs/zfs/master
    - stable/13 is going to track openzfs/zfs/zfs-2.1-release
    
    Obtained from:  OpenZFS
    
    (cherry picked from commit 6db169e920810bf1d7e9bd2fad5da92bfb696677)
---
 sys/contrib/openzfs/.editorconfig                  | 10 ++++
 sys/contrib/openzfs/.gitignore                     | 70 ++++++++++++++++++++++
 sys/contrib/openzfs/.gitmodules                    |  3 +
 sys/contrib/openzfs/META                           |  2 +-
 sys/contrib/openzfs/cmd/raidz_test/raidz_bench.c   |  2 -
 sys/contrib/openzfs/cmd/zed/zed_exec.c             |  1 +
 sys/contrib/openzfs/cmd/zfs/zfs_main.c             |  2 -
 .../openzfs/cmd/zpool/os/linux/zpool_vdev_os.c     |  3 -
 .../pyzfs/libzfs_core/test/test_libzfs_core.py     |  2 +-
 sys/contrib/openzfs/include/sys/dmu_recv.h         |  1 -
 sys/contrib/openzfs/include/sys/dmu_send.h         |  1 -
 sys/contrib/openzfs/include/sys/spa.h              |  6 ++
 sys/contrib/openzfs/include/sys/vdev.h             |  9 +++
 .../openzfs/lib/libspl/include/sys/dklabel.h       |  1 -
 sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c    |  2 -
 sys/contrib/openzfs/lib/libzfs/libzfs_pool.c       | 31 +++++++++-
 sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c   |  1 -
 .../lib/libzutil/os/linux/zutil_import_os.c        |  1 -
 sys/contrib/openzfs/lib/libzutil/zutil_import.c    |  1 -
 sys/contrib/openzfs/man/man8/zed.8.in              |  4 +-
 sys/contrib/openzfs/module/os/linux/zfs/arc_os.c   |  1 -
 sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c |  2 +-
 sys/contrib/openzfs/module/zfs/arc.c               |  1 -
 sys/contrib/openzfs/module/zfs/dmu_recv.c          |  1 -
 sys/contrib/openzfs/module/zfs/fm.c                |  1 -
 sys/contrib/openzfs/module/zfs/metaslab.c          |  8 +--
 sys/contrib/openzfs/module/zfs/zio.c               | 18 +++---
 sys/modules/zfs/zfs_config.h                       |  6 +-
 28 files changed, 152 insertions(+), 39 deletions(-)

diff --git a/sys/contrib/openzfs/.editorconfig b/sys/contrib/openzfs/.editorconfig
new file mode 100644
index 000000000000..0f4b96a83070
--- /dev/null
+++ b/sys/contrib/openzfs/.editorconfig
@@ -0,0 +1,10 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{c,h}]
+tab_width = 8
+indent_style = tab
diff --git a/sys/contrib/openzfs/.gitignore b/sys/contrib/openzfs/.gitignore
new file mode 100644
index 000000000000..056bbb8f08c9
--- /dev/null
+++ b/sys/contrib/openzfs/.gitignore
@@ -0,0 +1,70 @@
+#
+# N.B.
+# This is the toplevel .gitignore file.
+# This is not the place for entries that are specific to
+# a subdirectory.  Instead add those files to the
+# .gitignore file in that subdirectory.
+#
+# N.B.
+# Please use 'git ls-files -i --exclude-standard'
+# command after changing this file, to see if there are
+# any tracked files which get ignored after the change.
+
+#
+# Normal rules
+#
+*.[oa]
+*.o.ur-safe
+*.lo
+*.la
+*.mod.c
+*~
+*.swp
+*.gcno
+*.gcda
+*.pyc
+*.pyo
+.deps
+.libs
+.dirstamp
+.DS_Store
+modules.order
+Makefile
+Makefile.in
+
+#
+# Top level generated files specific to this top level dir
+#
+/bin
+/build
+/configure
+/config.log
+/config.status
+/libtool
+/zfs_config.h
+/zfs_config.h.in
+/zfs.release
+/stamp-h1
+/aclocal.m4
+/autom4te.cache
+
+#
+# Top level generic files
+#
+!.gitignore
+tags
+TAGS
+current
+cscope.*
+*.rpm
+*.deb
+*.tar.gz
+*.patch
+*.orig
+*.log
+*.tmp
+venv
+
+*.so
+*.so.debug
+*.so.full
diff --git a/sys/contrib/openzfs/.gitmodules b/sys/contrib/openzfs/.gitmodules
new file mode 100644
index 000000000000..d400f10a7e63
--- /dev/null
+++ b/sys/contrib/openzfs/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "scripts/zfs-images"]
+	path = scripts/zfs-images
+	url = https://github.com/zfsonlinux/zfs-images
diff --git a/sys/contrib/openzfs/META b/sys/contrib/openzfs/META
index abced52178a7..480849288719 100644
--- a/sys/contrib/openzfs/META
+++ b/sys/contrib/openzfs/META
@@ -1,7 +1,7 @@
 Meta:          1
 Name:          zfs
 Branch:        1.0
-Version:       2.0.0
+Version:       2.1.0
 Release:       rc1
 Release-Tags:  relext
 License:       CDDL
diff --git a/sys/contrib/openzfs/cmd/raidz_test/raidz_bench.c b/sys/contrib/openzfs/cmd/raidz_test/raidz_bench.c
index a3446c52c416..f44d6fbde707 100644
--- a/sys/contrib/openzfs/cmd/raidz_test/raidz_bench.c
+++ b/sys/contrib/openzfs/cmd/raidz_test/raidz_bench.c
@@ -31,8 +31,6 @@
 #include <sys/vdev_raidz_impl.h>
 #include <stdio.h>
 
-#include <sys/time.h>
-
 #include "raidz_test.h"
 
 #define	GEN_BENCH_MEMORY	(((uint64_t)1ULL)<<32)
diff --git a/sys/contrib/openzfs/cmd/zed/zed_exec.c b/sys/contrib/openzfs/cmd/zed/zed_exec.c
index aae607a9b7de..e8f510213868 100644
--- a/sys/contrib/openzfs/cmd/zed/zed_exec.c
+++ b/sys/contrib/openzfs/cmd/zed/zed_exec.c
@@ -173,6 +173,7 @@ _zed_exec_fork_child(uint64_t eid, const char *dir, const char *prog,
 		zed_log_msg(LOG_WARNING, "Killing hung \"%s\" pid=%d",
 		    prog, pid);
 		(void) kill(pid, SIGKILL);
+		(void) waitpid(pid, &status, 0);
 	}
 }
 
diff --git a/sys/contrib/openzfs/cmd/zfs/zfs_main.c b/sys/contrib/openzfs/cmd/zfs/zfs_main.c
index 9a59fddbf06d..1a5129f79493 100644
--- a/sys/contrib/openzfs/cmd/zfs/zfs_main.c
+++ b/sys/contrib/openzfs/cmd/zfs/zfs_main.c
@@ -53,7 +53,6 @@
 #include <grp.h>
 #include <pwd.h>
 #include <signal.h>
-#include <sys/debug.h>
 #include <sys/list.h>
 #include <sys/mkdev.h>
 #include <sys/mntent.h>
@@ -71,7 +70,6 @@
 #include <zfs_prop.h>
 #include <zfs_deleg.h>
 #include <libzutil.h>
-#include <libuutil.h>
 #ifdef HAVE_IDMAP
 #include <aclutils.h>
 #include <directory.h>
diff --git a/sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c b/sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c
index d087c4c14dac..55a9367ec180 100644
--- a/sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c
+++ b/sys/contrib/openzfs/cmd/zpool/os/linux/zpool_vdev_os.c
@@ -79,9 +79,6 @@
 
 #include <scsi/scsi.h>
 #include <scsi/sg.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
 #include <sys/efi_partition.h>
 #include <sys/stat.h>
 #include <sys/vtoc.h>
diff --git a/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/test/test_libzfs_core.py b/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/test/test_libzfs_core.py
index 08b58b5d1e0d..87138b305f73 100644
--- a/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/test/test_libzfs_core.py
+++ b/sys/contrib/openzfs/contrib/pyzfs/libzfs_core/test/test_libzfs_core.py
@@ -1062,7 +1062,7 @@ class ZFSTest(unittest.TestCase):
         lzc.lzc_bookmark({})
 
     @skipUnlessBookmarksSupported
-    def test_bookmarks_foregin_source(self):
+    def test_bookmarks_foreign_source(self):
         snaps = [ZFSTest.pool.makeName(b'fs1@snap1')]
         bmarks = [ZFSTest.pool.makeName(b'fs2#bmark1')]
         bmark_dict = {x: y for x, y in zip(bmarks, snaps)}
diff --git a/sys/contrib/openzfs/include/sys/dmu_recv.h b/sys/contrib/openzfs/include/sys/dmu_recv.h
index dacc6b7829da..7188b2a02248 100644
--- a/sys/contrib/openzfs/include/sys/dmu_recv.h
+++ b/sys/contrib/openzfs/include/sys/dmu_recv.h
@@ -34,7 +34,6 @@
 #include <sys/dsl_dataset.h>
 #include <sys/spa.h>
 #include <sys/objlist.h>
-#include <sys/dsl_bookmark.h>
 
 extern const char *recv_clone_name;
 
diff --git a/sys/contrib/openzfs/include/sys/dmu_send.h b/sys/contrib/openzfs/include/sys/dmu_send.h
index d6d050e01f97..d150f816c945 100644
--- a/sys/contrib/openzfs/include/sys/dmu_send.h
+++ b/sys/contrib/openzfs/include/sys/dmu_send.h
@@ -34,7 +34,6 @@
 #include <sys/dsl_bookmark.h>
 #include <sys/spa.h>
 #include <sys/objlist.h>
-#include <sys/dsl_bookmark.h>
 #include <sys/dmu_redact.h>
 
 #define	BEGINNV_REDACT_SNAPS		"redact_snaps"
diff --git a/sys/contrib/openzfs/include/sys/spa.h b/sys/contrib/openzfs/include/sys/spa.h
index 8391be8328b6..c960478efe50 100644
--- a/sys/contrib/openzfs/include/sys/spa.h
+++ b/sys/contrib/openzfs/include/sys/spa.h
@@ -405,6 +405,12 @@ typedef struct blkptr {
 /*
  * Macros to get and set fields in a bp or DVA.
  */
+
+/*
+ * Note, for gang blocks, DVA_GET_ASIZE() is the total space allocated for
+ * this gang DVA including its children BP's.  The space allocated at this
+ * DVA's vdev/offset is vdev_gang_header_asize(vdev).
+ */
 #define	DVA_GET_ASIZE(dva)	\
 	BF64_GET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, SPA_MINBLOCKSHIFT, 0)
 #define	DVA_SET_ASIZE(dva, x)	\
diff --git a/sys/contrib/openzfs/include/sys/vdev.h b/sys/contrib/openzfs/include/sys/vdev.h
index d1ef6b5b59b4..f235bfc8cc19 100644
--- a/sys/contrib/openzfs/include/sys/vdev.h
+++ b/sys/contrib/openzfs/include/sys/vdev.h
@@ -133,6 +133,15 @@ extern int64_t vdev_deflated_space(vdev_t *vd, int64_t space);
 
 extern uint64_t vdev_psize_to_asize(vdev_t *vd, uint64_t psize);
 
+/*
+ * Return the amount of space allocated for a gang block header.
+ */
+static inline uint64_t
+vdev_gang_header_asize(vdev_t *vd)
+{
+	return (vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE));
+}
+
 extern int vdev_fault(spa_t *spa, uint64_t guid, vdev_aux_t aux);
 extern int vdev_degrade(spa_t *spa, uint64_t guid, vdev_aux_t aux);
 extern int vdev_online(spa_t *spa, uint64_t guid, uint64_t flags,
diff --git a/sys/contrib/openzfs/lib/libspl/include/sys/dklabel.h b/sys/contrib/openzfs/lib/libspl/include/sys/dklabel.h
index 95faf2bb4ab3..8c2ca06c0cbc 100644
--- a/sys/contrib/openzfs/lib/libspl/include/sys/dklabel.h
+++ b/sys/contrib/openzfs/lib/libspl/include/sys/dklabel.h
@@ -31,7 +31,6 @@
 
 #include <sys/isa_defs.h>
 #include <sys/types32.h>
-#include <sys/isa_defs.h>
 
 #ifdef	__cplusplus
 extern "C" {
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c b/sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c
index 47418b3237bb..4598e87f2921 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c
@@ -48,7 +48,6 @@
 #include <sys/mount.h>
 #include <pwd.h>
 #include <grp.h>
-#include <stddef.h>
 #include <ucred.h>
 #ifdef HAVE_IDMAP
 #include <idmap.h>
@@ -66,7 +65,6 @@
 #include "zfs_namecheck.h"
 #include "zfs_prop.h"
 #include "libzfs_impl.h"
-#include "libzfs.h"
 #include "zfs_deleg.h"
 
 static int userquota_propname_decode(const char *propname, boolean_t zoned,
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_pool.c b/sys/contrib/openzfs/lib/libzfs/libzfs_pool.c
index 1934466536dc..9ef97cd677ff 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_pool.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_pool.c
@@ -49,7 +49,6 @@
 #include <dlfcn.h>
 #include <libzutil.h>
 #include <fcntl.h>
-#include <unistd.h>
 
 #include "zfs_namecheck.h"
 #include "zfs_prop.h"
@@ -2670,6 +2669,36 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
 			errno = 0;
 			vdev_id = strtoull(idx, &end, 10);
 
+			/*
+			 * If we are looking for a raidz and a parity is
+			 * specified, make sure it matches.
+			 */
+			int rzlen = strlen(VDEV_TYPE_RAIDZ);
+			assert(rzlen == strlen(VDEV_TYPE_DRAID));
+			int typlen = strlen(type);
+			if ((strncmp(type, VDEV_TYPE_RAIDZ, rzlen) == 0 ||
+			    strncmp(type, VDEV_TYPE_DRAID, rzlen) == 0) &&
+			    typlen != rzlen) {
+				uint64_t vdev_parity;
+				int parity = *(type + rzlen) - '0';
+
+				if (parity <= 0 || parity > 3 ||
+				    (typlen - rzlen) != 1) {
+					/*
+					 * Nonsense parity specified, can
+					 * never match
+					 */
+					free(type);
+					return (NULL);
+				}
+				verify(nvlist_lookup_uint64(nv,
+				    ZPOOL_CONFIG_NPARITY, &vdev_parity) == 0);
+				if ((int)vdev_parity != parity) {
+					free(type);
+					break;
+				}
+			}
+
 			free(type);
 			if (errno != 0)
 				return (NULL);
diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c b/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c
index 1e3a0bf5618a..bc887e72a23c 100644
--- a/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c
+++ b/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c
@@ -48,7 +48,6 @@
 #include <sys/avl.h>
 #include <sys/debug.h>
 #include <sys/stat.h>
-#include <stddef.h>
 #include <pthread.h>
 #include <umem.h>
 #include <time.h>
diff --git a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_import_os.c b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_import_os.c
index 519ab3a078e3..2e0baecb3bec 100644
--- a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_import_os.c
+++ b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_import_os.c
@@ -61,7 +61,6 @@
 #include <sys/dktp/fdisk.h>
 #include <sys/vdev_impl.h>
 #include <sys/fs/zfs.h>
-#include <sys/vdev_impl.h>
 
 #include <thread_pool.h>
 #include <libzutil.h>
diff --git a/sys/contrib/openzfs/lib/libzutil/zutil_import.c b/sys/contrib/openzfs/lib/libzutil/zutil_import.c
index e1f31b385503..93d05354f30f 100644
--- a/sys/contrib/openzfs/lib/libzutil/zutil_import.c
+++ b/sys/contrib/openzfs/lib/libzutil/zutil_import.c
@@ -62,7 +62,6 @@
 #include <sys/dktp/fdisk.h>
 #include <sys/vdev_impl.h>
 #include <sys/fs/zfs.h>
-#include <sys/vdev_impl.h>
 
 #include <thread_pool.h>
 #include <libzutil.h>
diff --git a/sys/contrib/openzfs/man/man8/zed.8.in b/sys/contrib/openzfs/man/man8/zed.8.in
index 3d36c33ac9ca..e32a89de8a0f 100644
--- a/sys/contrib/openzfs/man/man8/zed.8.in
+++ b/sys/contrib/openzfs/man/man8/zed.8.in
@@ -234,8 +234,8 @@ Terminate the daemon.
 Events are processed synchronously by a single thread.  This can delay the
 processing of simultaneous zevents.
 .PP
-There is no maximum timeout for ZEDLET execution.  Consequently, a misbehaving
-ZEDLET can delay the processing of subsequent zevents.
+ZEDLETs are killed after a maximum of ten seconds.
+This can lead to a violation of a ZEDLET's atomicity assumptions.
 .PP
 The ownership and permissions of the \fIenabled-zedlets\fR directory (along
 with all parent directories) are not checked.  If any of these directories
diff --git a/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c b/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c
index 83d4a3d8496c..465775a6748e 100644
--- a/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c
+++ b/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c
@@ -38,7 +38,6 @@
 #include <sys/vdev_trim.h>
 #include <sys/vdev_impl.h>
 #include <sys/dsl_pool.h>
-#include <sys/zio_checksum.h>
 #include <sys/multilist.h>
 #include <sys/abd.h>
 #include <sys/zil.h>
diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c b/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c
index ea6993ffa4b0..d042783da1b2 100644
--- a/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c
+++ b/sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c
@@ -867,7 +867,7 @@ __zpl_ioctl_setflags(struct inode *ip, uint32_t ioctl_flags, xvattr_t *xva)
 	if ((fchange(ioctl_flags, zfs_flags, FS_IMMUTABLE_FL, ZFS_IMMUTABLE) ||
 	    fchange(ioctl_flags, zfs_flags, FS_APPEND_FL, ZFS_APPENDONLY)) &&
 	    !capable(CAP_LINUX_IMMUTABLE))
-		return (-EACCES);
+		return (-EPERM);
 
 	if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
 		return (-EACCES);
diff --git a/sys/contrib/openzfs/module/zfs/arc.c b/sys/contrib/openzfs/module/zfs/arc.c
index 9be0a4e8a4a9..55c71a3829cd 100644
--- a/sys/contrib/openzfs/module/zfs/arc.c
+++ b/sys/contrib/openzfs/module/zfs/arc.c
@@ -294,7 +294,6 @@
 #include <sys/vdev.h>
 #include <sys/vdev_impl.h>
 #include <sys/dsl_pool.h>
-#include <sys/zio_checksum.h>
 #include <sys/multilist.h>
 #include <sys/abd.h>
 #include <sys/zil.h>
diff --git a/sys/contrib/openzfs/module/zfs/dmu_recv.c b/sys/contrib/openzfs/module/zfs/dmu_recv.c
index a0fd157ebc5f..123ea05b0436 100644
--- a/sys/contrib/openzfs/module/zfs/dmu_recv.c
+++ b/sys/contrib/openzfs/module/zfs/dmu_recv.c
@@ -53,7 +53,6 @@
 #include <sys/avl.h>
 #include <sys/ddt.h>
 #include <sys/zfs_onexit.h>
-#include <sys/dmu_send.h>
 #include <sys/dsl_destroy.h>
 #include <sys/blkptr.h>
 #include <sys/dsl_bookmark.h>
diff --git a/sys/contrib/openzfs/module/zfs/fm.c b/sys/contrib/openzfs/module/zfs/fm.c
index a5003f85d621..3070cab1e49d 100644
--- a/sys/contrib/openzfs/module/zfs/fm.c
+++ b/sys/contrib/openzfs/module/zfs/fm.c
@@ -67,7 +67,6 @@
 #include <sys/atomic.h>
 #include <sys/condvar.h>
 #include <sys/console.h>
-#include <sys/time.h>
 #include <sys/zfs_ioctl.h>
 
 int zfs_zevent_len_max = 0;
diff --git a/sys/contrib/openzfs/module/zfs/metaslab.c b/sys/contrib/openzfs/module/zfs/metaslab.c
index 463806c6078a..3b2b79b2f42f 100644
--- a/sys/contrib/openzfs/module/zfs/metaslab.c
+++ b/sys/contrib/openzfs/module/zfs/metaslab.c
@@ -5544,7 +5544,7 @@ metaslab_unalloc_dva(spa_t *spa, const dva_t *dva, uint64_t txg)
 	ASSERT3P(vd->vdev_indirect_mapping, ==, NULL);
 
 	if (DVA_GET_GANG(dva))
-		size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE);
+		size = vdev_gang_header_asize(vd);
 
 	msp = vd->vdev_ms[offset >> vd->vdev_ms_shift];
 
@@ -5579,7 +5579,7 @@ metaslab_free_dva(spa_t *spa, const dva_t *dva, boolean_t checkpoint)
 	ASSERT3U(spa_config_held(spa, SCL_ALL, RW_READER), !=, 0);
 
 	if (DVA_GET_GANG(dva)) {
-		size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE);
+		size = vdev_gang_header_asize(vd);
 	}
 
 	metaslab_free_impl(vd, offset, size, checkpoint);
@@ -5768,7 +5768,7 @@ metaslab_claim_dva(spa_t *spa, const dva_t *dva, uint64_t txg)
 	ASSERT(DVA_IS_VALID(dva));
 
 	if (DVA_GET_GANG(dva))
-		size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE);
+		size = vdev_gang_header_asize(vd);
 
 	return (metaslab_claim_impl(vd, offset, size, txg));
 }
@@ -6034,7 +6034,7 @@ metaslab_check_free(spa_t *spa, const blkptr_t *bp)
 		uint64_t size = DVA_GET_ASIZE(&bp->blk_dva[i]);
 
 		if (DVA_GET_GANG(&bp->blk_dva[i]))
-			size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE);
+			size = vdev_gang_header_asize(vd);
 
 		ASSERT3P(vd, !=, NULL);
 
diff --git a/sys/contrib/openzfs/module/zfs/zio.c b/sys/contrib/openzfs/module/zfs/zio.c
index a7820e75670b..b5ffe9c294df 100644
--- a/sys/contrib/openzfs/module/zfs/zio.c
+++ b/sys/contrib/openzfs/module/zfs/zio.c
@@ -1026,7 +1026,8 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp, boolean_t config_held,
 	 * that are in the log) to be arbitrarily large.
 	 */
 	for (int i = 0; i < BP_GET_NDVAS(bp); i++) {
-		uint64_t vdevid = DVA_GET_VDEV(&bp->blk_dva[i]);
+		const dva_t *dva = &bp->blk_dva[i];
+		uint64_t vdevid = DVA_GET_VDEV(dva);
 
 		if (vdevid >= spa->spa_root_vdev->vdev_children) {
 			errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
@@ -1055,10 +1056,10 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp, boolean_t config_held,
 			 */
 			continue;
 		}
-		uint64_t offset = DVA_GET_OFFSET(&bp->blk_dva[i]);
-		uint64_t asize = DVA_GET_ASIZE(&bp->blk_dva[i]);
-		if (BP_IS_GANG(bp))
-			asize = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE);
+		uint64_t offset = DVA_GET_OFFSET(dva);
+		uint64_t asize = DVA_GET_ASIZE(dva);
+		if (DVA_GET_GANG(dva))
+			asize = vdev_gang_header_asize(vd);
 		if (offset + asize > vd->vdev_asize) {
 			errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
 			    "blkptr at %p DVA %u has invalid OFFSET %llu",
@@ -1095,8 +1096,8 @@ zfs_dva_valid(spa_t *spa, const dva_t *dva, const blkptr_t *bp)
 	uint64_t offset = DVA_GET_OFFSET(dva);
 	uint64_t asize = DVA_GET_ASIZE(dva);
 
-	if (BP_IS_GANG(bp))
-		asize = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE);
+	if (DVA_GET_GANG(dva))
+		asize = vdev_gang_header_asize(vd);
 	if (offset + asize > vd->vdev_asize)
 		return (B_FALSE);
 
@@ -4015,6 +4016,9 @@ zio_vdev_io_assess(zio_t *zio)
 	 */
 	if (zio->io_error == ENXIO && zio->io_type == ZIO_TYPE_WRITE &&
 	    vd != NULL && !vd->vdev_ops->vdev_op_leaf) {
+		vdev_dbgmsg(vd, "zio_vdev_io_assess(zio=%px) setting "
+		    "cant_write=TRUE due to write failure with ENXIO",
+		    zio);
 		vd->vdev_cant_write = B_TRUE;
 	}
 
diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h
index c3735b2c386c..ebc9bbe9059b 100644
--- a/sys/modules/zfs/zfs_config.h
+++ b/sys/modules/zfs/zfs_config.h
@@ -734,7 +734,7 @@
 /* #undef ZFS_IS_GPL_COMPATIBLE */
 
 /* Define the project alias string. */
-#define ZFS_META_ALIAS "zfs-2.0.0-FreeBSD_g891568c99"
+#define ZFS_META_ALIAS "zfs-2.1.0-FreeBSD_g3522f57b6"
 
 /* Define the project author. */
 #define ZFS_META_AUTHOR "OpenZFS"
@@ -764,10 +764,10 @@
 #define ZFS_META_NAME "zfs"
 
 /* Define the project release. */
-#define ZFS_META_RELEASE "FreeBSD_g891568c99"
+#define ZFS_META_RELEASE "FreeBSD_g3522f57b6"
 
 /* Define the project version. */
-#define ZFS_META_VERSION "2.0.0"
+#define ZFS_META_VERSION "2.1.0"
 
 /* count is located in percpu_ref.data */
 /* #undef ZFS_PERCPU_REF_COUNT_IN_DATA */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104221503.13MF3lWa007716>