Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Apr 2021 13:19:23 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: 93d1c189bc36 - stable/13 - zfs: merge OpenZFS master-891568c99
Message-ID:  <202104041319.134DJN9t037065@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=93d1c189bc368bf1e9a661673cbc44142780be75

commit 93d1c189bc368bf1e9a661673cbc44142780be75
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2021-03-21 00:46:08 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2021-04-04 13:19:09 +0000

    zfs: merge OpenZFS master-891568c99
    
    Notable upstream pull request merges:
      #11652 Split dmu_zfetch() speculation and execution parts
      #11682 Fix zfs_get_data access to files with wrong generation
      #11735 Clean up RAIDZ/DRAID ereport code
      #11737 Initialize metaslab range trees in metaslab_init
      #11739 FreeBSD: make seqc asserts conditional on replay
      #11763 Allow setting bootfs property on pools with indirect vdevs
      #11767 FreeBSD: Fix memory leaks in kstats
    
    Obtained from:  OpenZFS
    
    (cherry picked from commit f9693bef8dc83284e7ac905adc346f7d866b5245)
---
 sys/contrib/openzfs/README.md                      |   2 +-
 sys/contrib/openzfs/cmd/raidz_test/raidz_test.c    |   2 -
 sys/contrib/openzfs/cmd/ztest/ztest.c              |   4 +-
 sys/contrib/openzfs/config/kernel-bio_max_segs.m4  |  23 ++
 .../openzfs/config/kernel-generic_fillattr.m4      |  28 +++
 sys/contrib/openzfs/config/kernel-inode-create.m4  |  43 +++-
 sys/contrib/openzfs/config/kernel-inode-getattr.m4 |  63 ++++-
 .../openzfs/config/kernel-is_owner_or_cap.m4       |  23 +-
 sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 |  32 ---
 sys/contrib/openzfs/config/kernel-mkdir.m4         |  65 +++++
 sys/contrib/openzfs/config/kernel-mknod.m4         |  30 +++
 sys/contrib/openzfs/config/kernel-rename.m4        |  50 +++-
 .../openzfs/config/kernel-setattr-prepare.m4       |  45 +++-
 sys/contrib/openzfs/config/kernel-symlink.m4       |  30 +++
 sys/contrib/openzfs/config/kernel-xattr-handler.m4 |  78 ++++--
 sys/contrib/openzfs/config/kernel.m4               |  20 +-
 sys/contrib/openzfs/configure.ac                   |   1 +
 .../include/os/linux/kernel/linux/kmap_compat.h    |   4 +-
 .../include/os/linux/kernel/linux/vfs_compat.h     |  24 +-
 .../include/os/linux/kernel/linux/xattr_compat.h   |  17 +-
 .../include/os/linux/zfs/sys/zfs_vnops_os.h        |   3 +-
 .../include/os/linux/zfs/sys/zfs_znode_impl.h      |   8 +-
 sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h |  18 ++
 sys/contrib/openzfs/include/sys/dmu_zfetch.h       |  23 +-
 sys/contrib/openzfs/include/sys/vdev_raidz.h       |   2 +
 sys/contrib/openzfs/include/sys/vdev_raidz_impl.h  |   7 +-
 sys/contrib/openzfs/include/sys/zil.h              |   3 +-
 sys/contrib/openzfs/include/sys/zio.h              |  10 +-
 sys/contrib/openzfs/include/sys/zvol_impl.h        |   4 +-
 .../openzfs/man/man5/zfs-module-parameters.5       |  25 +-
 sys/contrib/openzfs/man/man8/zfs-allow.8           |   3 +
 sys/contrib/openzfs/man/man8/zgenhostid.8          |   4 +-
 sys/contrib/openzfs/man/man8/zpoolconcepts.8       |  17 ++
 .../openzfs/module/os/freebsd/spl/spl_kstat.c      |  11 +-
 .../openzfs/module/os/freebsd/zfs/sysctl_os.c      |   6 -
 sys/contrib/openzfs/module/os/linux/zfs/abd_os.c   |  10 +-
 sys/contrib/openzfs/module/os/linux/zfs/policy.c   |   2 +-
 .../openzfs/module/os/linux/zfs/vdev_disk.c        |   5 +
 .../openzfs/module/os/linux/zfs/zfs_ctldir.c       |   3 +-
 sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c  |   4 +-
 .../openzfs/module/os/linux/zfs/zfs_vfsops.c       |   6 +-
 .../openzfs/module/os/linux/zfs/zfs_vnops_os.c     |   5 +-
 .../openzfs/module/os/linux/zfs/zpl_ctldir.c       |  51 +++-
 sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c |   2 +-
 .../openzfs/module/os/linux/zfs/zpl_inode.c        |  52 +++-
 .../openzfs/module/os/linux/zfs/zpl_xattr.c        |   4 +-
 sys/contrib/openzfs/module/zfs/dbuf.c              |   5 +-
 sys/contrib/openzfs/module/zfs/dmu.c               |  35 ++-
 sys/contrib/openzfs/module/zfs/dmu_zfetch.c        | 250 +++++++++++--------
 sys/contrib/openzfs/module/zfs/metaslab.c          | 149 +++++-------
 sys/contrib/openzfs/module/zfs/refcount.c          |  10 +-
 sys/contrib/openzfs/module/zfs/vdev.c              |   4 +-
 sys/contrib/openzfs/module/zfs/vdev_draid.c        | 240 +------------------
 sys/contrib/openzfs/module/zfs/vdev_indirect.c     |   1 -
 sys/contrib/openzfs/module/zfs/vdev_mirror.c       |   5 +-
 sys/contrib/openzfs/module/zfs/vdev_raidz.c        | 266 +++------------------
 sys/contrib/openzfs/module/zfs/zfs_fm.c            |   8 +-
 sys/contrib/openzfs/module/zfs/zfs_fuid.c          |   4 -
 sys/contrib/openzfs/module/zfs/zfs_log.c           |   5 +
 sys/contrib/openzfs/module/zfs/zfs_vnops.c         |  14 +-
 sys/contrib/openzfs/module/zfs/zil.c               |   3 +-
 sys/contrib/openzfs/module/zfs/zio.c               |   4 +-
 sys/contrib/openzfs/module/zfs/zvol.c              |   3 +-
 sys/contrib/openzfs/tests/runfiles/common.run      |   8 +-
 sys/contrib/openzfs/tests/runfiles/freebsd.run     |   4 +
 sys/contrib/openzfs/tests/runfiles/sanity.run      |   4 +
 .../zfs-tests/tests/functional/acl/Makefile.am     |   2 +-
 .../zfs-tests/tests/functional/acl/off/.gitignore  |   1 +
 .../zfs-tests/tests/functional/acl/off/Makefile.am |  16 ++
 .../zfs-tests/tests/functional/acl/off/cleanup.ksh |  33 +++
 .../zfs-tests/tests/functional/acl/off/dosmode.ksh | 199 +++++++++++++++
 .../functional/acl/off/dosmode_readonly_write.c    |  61 +++++
 .../tests/functional/acl/off/posixmode.ksh         | 145 +++++++++++
 .../zfs-tests/tests/functional/acl/off/setup.ksh   |  44 ++++
 .../tests/functional/redacted_send/Makefile.am     |   1 +
 .../functional/redacted_send/redacted_panic.ksh    |  44 ++++
 sys/modules/zfs/zfs_config.h                       |   4 +-
 77 files changed, 1561 insertions(+), 883 deletions(-)

diff --git a/sys/contrib/openzfs/README.md b/sys/contrib/openzfs/README.md
index 31d99386e90e..d666df7af309 100644
--- a/sys/contrib/openzfs/README.md
+++ b/sys/contrib/openzfs/README.md
@@ -32,4 +32,4 @@ For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197`
 
 # Supported Kernels
   * The `META` file contains the officially recognized supported Linux kernel versions.
-  * Supported FreeBSD versions are 12-STABLE and 13-CURRENT.
+  * Supported FreeBSD versions are any supported branches and releases starting from 12.2-RELEASE.
diff --git a/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c b/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c
index e3eb4f4ce44a..9a8be549c5cb 100644
--- a/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c
+++ b/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c
@@ -448,7 +448,6 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset,
 		rr->rr_missingdata = 0;
 		rr->rr_missingparity = 0;
 		rr->rr_firstdatacol = nparity;
-		rr->rr_abd_copy = NULL;
 		rr->rr_abd_empty = NULL;
 		rr->rr_nempty = 0;
 
@@ -459,7 +458,6 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset,
 			}
 			rr->rr_col[c].rc_devidx = child_id;
 			rr->rr_col[c].rc_offset = child_offset;
-			rr->rr_col[c].rc_gdata = NULL;
 			rr->rr_col[c].rc_orig_data = NULL;
 			rr->rr_col[c].rc_error = 0;
 			rr->rr_col[c].rc_tried = 0;
diff --git a/sys/contrib/openzfs/cmd/ztest/ztest.c b/sys/contrib/openzfs/cmd/ztest/ztest.c
index 1a030280704a..7193eafe3d21 100644
--- a/sys/contrib/openzfs/cmd/ztest/ztest.c
+++ b/sys/contrib/openzfs/cmd/ztest/ztest.c
@@ -2287,8 +2287,8 @@ ztest_get_done(zgd_t *zgd, int error)
 }
 
 static int
-ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
-    zio_t *zio)
+ztest_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf,
+    struct lwb *lwb, zio_t *zio)
 {
 	ztest_ds_t *zd = arg;
 	objset_t *os = zd->zd_os;
diff --git a/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 b/sys/contrib/openzfs/config/kernel-bio_max_segs.m4
new file mode 100644
index 000000000000..a90d75455c13
--- /dev/null
+++ b/sys/contrib/openzfs/config/kernel-bio_max_segs.m4
@@ -0,0 +1,23 @@
+dnl #
+dnl # 5.12 API change removes BIO_MAX_PAGES in favor of bio_max_segs()
+dnl # which will handle the logic of setting the upper-bound to a
+dnl # BIO_MAX_PAGES, internally.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS], [
+	ZFS_LINUX_TEST_SRC([bio_max_segs], [
+		#include <linux/bio.h>
+	],[
+		bio_max_segs(1);
+	])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_BIO_MAX_SEGS], [
+	AC_MSG_CHECKING([whether bio_max_segs() exists])
+	ZFS_LINUX_TEST_RESULT([bio_max_segs], [
+		AC_MSG_RESULT(yes)
+
+		AC_DEFINE([HAVE_BIO_MAX_SEGS], 1, [bio_max_segs() is implemented])
+	],[
+		AC_MSG_RESULT(no)
+	])
+])
diff --git a/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 b/sys/contrib/openzfs/config/kernel-generic_fillattr.m4
new file mode 100644
index 000000000000..50c8031305b3
--- /dev/null
+++ b/sys/contrib/openzfs/config/kernel-generic_fillattr.m4
@@ -0,0 +1,28 @@
+dnl #
+dnl # 5.12 API
+dnl #
+dnl # generic_fillattr in linux/fs.h now requires a struct user_namespace*
+dnl # as the first arg, to support idmapped mounts.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS], [
+	ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [
+		#include <linux/fs.h>
+	],[
+		struct user_namespace *userns = NULL;
+		struct inode *in = NULL;
+		struct kstat *k = NULL;
+		generic_fillattr(userns, in, k);
+	])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS], [
+	AC_MSG_CHECKING([whether generic_fillattr requres struct user_namespace*])
+	ZFS_LINUX_TEST_RESULT([generic_fillattr_userns], [
+		AC_MSG_RESULT([yes])
+		AC_DEFINE(HAVE_GENERIC_FILLATTR_USERNS, 1,
+		    [generic_fillattr requires struct user_namespace*])
+	],[
+		AC_MSG_RESULT([no])
+	])
+])
+
diff --git a/sys/contrib/openzfs/config/kernel-inode-create.m4 b/sys/contrib/openzfs/config/kernel-inode-create.m4
index 9f28bcbd4f7f..a6ea11fb61b2 100644
--- a/sys/contrib/openzfs/config/kernel-inode-create.m4
+++ b/sys/contrib/openzfs/config/kernel-inode-create.m4
@@ -1,7 +1,25 @@
-dnl #
-dnl # 3.6 API change
-dnl #
-AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [
+AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
+	dnl #
+	dnl # 5.12 API change that added the struct user_namespace* arg
+	dnl # to the front of this function type's arg list.
+	dnl #
+	ZFS_LINUX_TEST_SRC([create_userns], [
+		#include <linux/fs.h>
+		#include <linux/sched.h>
+
+		int inode_create(struct user_namespace *userns,
+		    struct inode *inode ,struct dentry *dentry,
+		    umode_t umode, bool flag) { return 0; }
+
+		static const struct inode_operations
+			iops __attribute__ ((unused)) = {
+			.create		= inode_create,
+		};
+	],[])
+
+	dnl #
+	dnl # 3.6 API change
+	dnl #
 	ZFS_LINUX_TEST_SRC([create_flags], [
 		#include <linux/fs.h>
 		#include <linux/sched.h>
@@ -16,11 +34,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [
 	],[])
 ])
 
-AC_DEFUN([ZFS_AC_KERNEL_CREATE_FLAGS], [
-	AC_MSG_CHECKING([whether iops->create() passes flags])
-	ZFS_LINUX_TEST_RESULT([create_flags], [
+AC_DEFUN([ZFS_AC_KERNEL_CREATE], [
+	AC_MSG_CHECKING([whether iops->create() takes struct user_namespace*])
+	ZFS_LINUX_TEST_RESULT([create_userns], [
 		AC_MSG_RESULT(yes)
+		AC_DEFINE(HAVE_IOPS_CREATE_USERNS, 1,
+		   [iops->create() takes struct user_namespace*])
 	],[
-		ZFS_LINUX_TEST_ERROR([iops->create()])
+		AC_MSG_RESULT(no)
+
+		AC_MSG_CHECKING([whether iops->create() passes flags])
+		ZFS_LINUX_TEST_RESULT([create_flags], [
+			AC_MSG_RESULT(yes)
+		],[
+			ZFS_LINUX_TEST_ERROR([iops->create()])
+		])
 	])
 ])
diff --git a/sys/contrib/openzfs/config/kernel-inode-getattr.m4 b/sys/contrib/openzfs/config/kernel-inode-getattr.m4
index 48391d66f8bd..f62e82f5230a 100644
--- a/sys/contrib/openzfs/config/kernel-inode-getattr.m4
+++ b/sys/contrib/openzfs/config/kernel-inode-getattr.m4
@@ -1,8 +1,29 @@
-dnl #
-dnl # Linux 4.11 API
-dnl # See torvalds/linux@a528d35
-dnl #
 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
+	dnl #
+	dnl # Linux 5.12 API
+	dnl # The getattr I/O operations handler type was extended to require
+	dnl # a struct user_namespace* as its first arg, to support idmapped
+	dnl # mounts.
+	dnl #
+	ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [
+		#include <linux/fs.h>
+
+		int test_getattr(
+			struct user_namespace *userns,
+		    const struct path *p, struct kstat *k,
+		    u32 request_mask, unsigned int query_flags)
+		    { return 0; }
+
+		static const struct inode_operations
+		    iops __attribute__ ((unused)) = {
+			.getattr = test_getattr,
+		};
+	],[])
+
+	dnl #
+	dnl # Linux 4.11 API
+	dnl # See torvalds/linux@a528d35
+	dnl #
 	ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [
 		#include <linux/fs.h>
 
@@ -33,21 +54,39 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
 ])
 
 AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [
-	AC_MSG_CHECKING([whether iops->getattr() takes a path])
-	ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
+	dnl #
+	dnl # Kernel 5.12 test
+	dnl #
+	AC_MSG_CHECKING([whether iops->getattr() takes user_namespace])
+	ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [
 		AC_MSG_RESULT(yes)
-		AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
-		    [iops->getattr() takes a path])
+		AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1,
+		    [iops->getattr() takes struct user_namespace*])
 	],[
 		AC_MSG_RESULT(no)
 
-		AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
-		ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [
+		dnl #
+		dnl # Kernel 4.11 test
+		dnl #
+		AC_MSG_CHECKING([whether iops->getattr() takes a path])
+		ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
 			AC_MSG_RESULT(yes)
-			AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
-			    [iops->getattr() takes a vfsmount])
+			AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
+				[iops->getattr() takes a path])
 		],[
 			AC_MSG_RESULT(no)
+
+			dnl #
+			dnl # Kernel < 4.11 test
+			dnl #
+			AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
+			ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [
+				AC_MSG_RESULT(yes)
+				AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
+					[iops->getattr() takes a vfsmount])
+			],[
+				AC_MSG_RESULT(no)
+			])
 		])
 	])
 ])
diff --git a/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 b/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4
index 3df6163da270..3c3c6ad2240f 100644
--- a/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4
+++ b/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4
@@ -11,13 +11,32 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [
 		struct inode *ip = NULL;
 		(void) inode_owner_or_capable(ip);
 	])
+
+	ZFS_LINUX_TEST_SRC([inode_owner_or_capable_idmapped], [
+		#include <linux/fs.h>
+	],[
+		struct inode *ip = NULL;
+		(void) inode_owner_or_capable(&init_user_ns, ip);
+	])
 ])
 
 AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
 	AC_MSG_CHECKING([whether inode_owner_or_capable() exists])
 	ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [
 		AC_MSG_RESULT(yes)
-	],[
-		ZFS_LINUX_TEST_ERROR([capability])
+		AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
+		    [inode_owner_or_capable() exists])
+	], [
+		AC_MSG_RESULT(no)
+
+		AC_MSG_CHECKING(
+		    [whether inode_owner_or_capable() takes user_ns])
+		ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_idmapped], [
+			AC_MSG_RESULT(yes)
+			AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED, 1,
+			    [inode_owner_or_capable() takes user_ns])
+		],[
+			ZFS_LINUX_TEST_ERROR([capability])
+		])
 	])
 ])
diff --git a/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 b/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4
deleted file mode 100644
index 19599670df3b..000000000000
--- a/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-dnl #
-dnl # 3.3 API change
-dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a
-dnl # umode_t type rather than an int.  The expectation is that any backport
-dnl # would also change all three prototypes.  However, if it turns out that
-dnl # some distribution doesn't backport the whole thing this could be
-dnl # broken apart into three separate checks.
-dnl #
-AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T], [
-	ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [
-		#include <linux/fs.h>
-
-		int mkdir(struct inode *inode, struct dentry *dentry,
-		    umode_t umode) { return 0; }
-
-		static const struct inode_operations
-		    iops __attribute__ ((unused)) = {
-			.mkdir = mkdir,
-		};
-	],[])
-])
-
-AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [
-	AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t])
-	ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [
-		AC_MSG_RESULT(yes)
-		AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
-		    [iops->create()/mkdir()/mknod() take umode_t])
-	],[
-		ZFS_LINUX_TEST_ERROR([mkdir()])
-	])
-])
diff --git a/sys/contrib/openzfs/config/kernel-mkdir.m4 b/sys/contrib/openzfs/config/kernel-mkdir.m4
new file mode 100644
index 000000000000..a162bcd880ff
--- /dev/null
+++ b/sys/contrib/openzfs/config/kernel-mkdir.m4
@@ -0,0 +1,65 @@
+dnl #
+dnl # Supported mkdir() interfaces checked newest to oldest.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [
+	dnl #
+	dnl # 5.12 API change
+	dnl # The struct user_namespace arg was added as the first argument to
+	dnl # mkdir()
+	dnl #
+	ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [
+		#include <linux/fs.h>
+
+		int mkdir(struct user_namespace *userns,
+			struct inode *inode, struct dentry *dentry,
+		    umode_t umode) { return 0; }
+
+		static const struct inode_operations
+		    iops __attribute__ ((unused)) = {
+			.mkdir = mkdir,
+		};
+	],[])
+
+	dnl #
+	dnl # 3.3 API change
+	dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a
+	dnl # umode_t type rather than an int.  The expectation is that any backport
+	dnl # would also change all three prototypes.  However, if it turns out that
+	dnl # some distribution doesn't backport the whole thing this could be
+	dnl # broken apart into three separate checks.
+	dnl #
+	ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [
+		#include <linux/fs.h>
+
+		int mkdir(struct inode *inode, struct dentry *dentry,
+		    umode_t umode) { return 0; }
+
+		static const struct inode_operations
+		    iops __attribute__ ((unused)) = {
+			.mkdir = mkdir,
+		};
+	],[])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [
+	dnl #
+	dnl # 5.12 API change
+	dnl # The struct user_namespace arg was added as the first argument to
+	dnl # mkdir() of the iops structure.
+	dnl #
+	AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*])
+	ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [
+		AC_MSG_RESULT(yes)
+		AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1,
+		    [iops->mkdir() takes struct user_namespace*])
+	],[
+		AC_MSG_CHECKING([whether iops->mkdir() takes umode_t])
+		ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [
+			AC_MSG_RESULT(yes)
+			AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
+			    [iops->mkdir() takes umode_t])
+		],[
+			ZFS_LINUX_TEST_ERROR([mkdir()])
+		])
+	])
+])
diff --git a/sys/contrib/openzfs/config/kernel-mknod.m4 b/sys/contrib/openzfs/config/kernel-mknod.m4
new file mode 100644
index 000000000000..ffe45106003a
--- /dev/null
+++ b/sys/contrib/openzfs/config/kernel-mknod.m4
@@ -0,0 +1,30 @@
+AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [
+	dnl #
+	dnl # 5.12 API change that added the struct user_namespace* arg
+	dnl # to the front of this function type's arg list.
+	dnl #
+	ZFS_LINUX_TEST_SRC([mknod_userns], [
+		#include <linux/fs.h>
+		#include <linux/sched.h>
+
+		int tmp_mknod(struct user_namespace *userns,
+		    struct inode *inode ,struct dentry *dentry,
+		    umode_t u, dev_t d) { return 0; }
+
+		static const struct inode_operations
+			iops __attribute__ ((unused)) = {
+			.mknod		= tmp_mknod,
+		};
+	],[])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_MKNOD], [
+	AC_MSG_CHECKING([whether iops->mknod() takes struct user_namespace*])
+	ZFS_LINUX_TEST_RESULT([mknod_userns], [
+		AC_MSG_RESULT(yes)
+		AC_DEFINE(HAVE_IOPS_MKNOD_USERNS, 1,
+		    [iops->mknod() takes struct user_namespace*])
+	],[
+		AC_MSG_RESULT(no)
+	])
+])
diff --git a/sys/contrib/openzfs/config/kernel-rename.m4 b/sys/contrib/openzfs/config/kernel-rename.m4
index f707391539d8..31d199f33bba 100644
--- a/sys/contrib/openzfs/config/kernel-rename.m4
+++ b/sys/contrib/openzfs/config/kernel-rename.m4
@@ -1,10 +1,10 @@
-dnl #
-dnl # 4.9 API change,
-dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants
-dnl # flags.
-dnl #
-AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [
-	ZFS_LINUX_TEST_SRC([inode_operations_rename], [
+AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
+	dnl #
+	dnl # 4.9 API change,
+	dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants
+	dnl # flags.
+	dnl #
+	ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [
 		#include <linux/fs.h>
 		int rename_fn(struct inode *sip, struct dentry *sdp,
 			struct inode *tip, struct dentry *tdp,
@@ -15,15 +15,41 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [
 			.rename = rename_fn,
 		};
 	],[])
+
+	dnl #
+	dnl # 5.12 API change,
+	dnl #
+	dnl # Linux 5.12 introduced passing struct user_namespace* as the first argument
+	dnl # of the rename() and other inode_operations members.
+	dnl #
+	ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [
+		#include <linux/fs.h>
+		int rename_fn(struct user_namespace *user_ns, struct inode *sip,
+			struct dentry *sdp, struct inode *tip, struct dentry *tdp,
+			unsigned int flags) { return 0; }
+
+		static const struct inode_operations
+		    iops __attribute__ ((unused)) = {
+			.rename = rename_fn,
+		};
+	],[])
 ])
 
-AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [
-	AC_MSG_CHECKING([whether iops->rename() wants flags])
-	ZFS_LINUX_TEST_RESULT([inode_operations_rename], [
+AC_DEFUN([ZFS_AC_KERNEL_RENAME], [
+	AC_MSG_CHECKING([whether iops->rename() takes struct user_namespace*])
+	ZFS_LINUX_TEST_RESULT([inode_operations_rename_userns], [
 		AC_MSG_RESULT(yes)
-		AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
-		    [iops->rename() wants flags])
+		AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1,
+		    [iops->rename() takes struct user_namespace*])
 	],[
 		AC_MSG_RESULT(no)
+
+		ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [
+			AC_MSG_RESULT(yes)
+			AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
+				[iops->rename() wants flags])
+		],[
+			AC_MSG_RESULT(no)
+		])
 	])
 ])
diff --git a/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 b/sys/contrib/openzfs/config/kernel-setattr-prepare.m4
index 45408c45c69b..24245aa53448 100644
--- a/sys/contrib/openzfs/config/kernel-setattr-prepare.m4
+++ b/sys/contrib/openzfs/config/kernel-setattr-prepare.m4
@@ -1,27 +1,52 @@
-dnl #
-dnl # 4.9 API change
-dnl # The inode_change_ok() function has been renamed setattr_prepare()
-dnl # and updated to take a dentry rather than an inode.
-dnl #
 AC_DEFUN([ZFS_AC_KERNEL_SRC_SETATTR_PREPARE], [
+	dnl #
+	dnl # 4.9 API change
+	dnl # The inode_change_ok() function has been renamed setattr_prepare()
+	dnl # and updated to take a dentry rather than an inode.
+	dnl #
 	ZFS_LINUX_TEST_SRC([setattr_prepare], [
 		#include <linux/fs.h>
 	], [
 		struct dentry *dentry = NULL;
 		struct iattr *attr = NULL;
 		int error __attribute__ ((unused)) =
-		    setattr_prepare(dentry, attr);
+			setattr_prepare(dentry, attr);
+	])
+
+	dnl #
+	dnl # 5.12 API change
+	dnl # The setattr_prepare() function has been changed to accept a new argument
+	dnl # for struct user_namespace*
+	dnl #
+	ZFS_LINUX_TEST_SRC([setattr_prepare_userns], [
+		#include <linux/fs.h>
+	], [
+		struct dentry *dentry = NULL;
+		struct iattr *attr = NULL;
+		struct user_namespace *userns = NULL;
+		int error __attribute__ ((unused)) =
+			setattr_prepare(userns, dentry, attr);
 	])
 ])
 
 AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [
-	AC_MSG_CHECKING([whether setattr_prepare() is available])
-	ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare],
+	AC_MSG_CHECKING([whether setattr_prepare() is available and accepts struct user_namespace*])
+	ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare_userns],
 	    [setattr_prepare], [fs/attr.c], [
 		AC_MSG_RESULT(yes)
-		AC_DEFINE(HAVE_SETATTR_PREPARE, 1,
-		    [setattr_prepare() is available])
+		AC_DEFINE(HAVE_SETATTR_PREPARE_USERNS, 1,
+		    [setattr_prepare() accepts user_namespace])
 	], [
 		AC_MSG_RESULT(no)
+
+		AC_MSG_CHECKING([whether setattr_prepare() is available, doesn't accept user_namespace])
+		ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare],
+			[setattr_prepare], [fs/attr.c], [
+			AC_MSG_RESULT(yes)
+			AC_DEFINE(HAVE_SETATTR_PREPARE_NO_USERNS, 1,
+				[setattr_prepare() is available, doesn't accept user_namespace])
+		], [
+			AC_MSG_RESULT(no)
+		])
 	])
 ])
diff --git a/sys/contrib/openzfs/config/kernel-symlink.m4 b/sys/contrib/openzfs/config/kernel-symlink.m4
new file mode 100644
index 000000000000..d90366d04b72
--- /dev/null
+++ b/sys/contrib/openzfs/config/kernel-symlink.m4
@@ -0,0 +1,30 @@
+AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [
+	dnl #
+	dnl # 5.12 API change that added the struct user_namespace* arg
+	dnl # to the front of this function type's arg list.
+	dnl #
+	ZFS_LINUX_TEST_SRC([symlink_userns], [
+		#include <linux/fs.h>
+		#include <linux/sched.h>
+
+		int tmp_symlink(struct user_namespace *userns,
+		    struct inode *inode ,struct dentry *dentry,
+		    const char *path) { return 0; }
+
+		static const struct inode_operations
+			iops __attribute__ ((unused)) = {
+			.symlink		= tmp_symlink,
+		};
+	],[])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_SYMLINK], [
+	AC_MSG_CHECKING([whether iops->symlink() takes struct user_namespace*])
+	ZFS_LINUX_TEST_RESULT([symlink_userns], [
+		AC_MSG_RESULT(yes)
+		AC_DEFINE(HAVE_IOPS_SYMLINK_USERNS, 1,
+		    [iops->symlink() takes struct user_namespace*])
+	],[
+		AC_MSG_RESULT(no)
+	])
+])
diff --git a/sys/contrib/openzfs/config/kernel-xattr-handler.m4 b/sys/contrib/openzfs/config/kernel-xattr-handler.m4
index 137bf4a8aff0..00b1e74a9ccb 100644
--- a/sys/contrib/openzfs/config/kernel-xattr-handler.m4
+++ b/sys/contrib/openzfs/config/kernel-xattr-handler.m4
@@ -152,6 +152,21 @@ dnl #
 dnl # Supported xattr handler set() interfaces checked newest to oldest.
 dnl #
 AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
+	ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [
+		#include <linux/xattr.h>
+
+		int set(const struct xattr_handler *handler,
+			struct user_namespace *mnt_userns,
+			struct dentry *dentry, struct inode *inode,
+			const char *name, const void *buffer,
+			size_t size, int flags)
+			{ return 0; }
+		static const struct xattr_handler
+			xops __attribute__ ((unused)) = {
+			.set = set,
+		};
+	],[])
+
 	ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [
 		#include <linux/xattr.h>
 
@@ -194,45 +209,58 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
 
 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
 	dnl #
-	dnl # 4.7 API change,
-	dnl # The xattr_handler->set() callback was changed to take both
-	dnl # dentry and inode.
+	dnl # 5.12 API change,
+	dnl # The xattr_handler->set() callback was changed to 8 arguments, and
+	dnl # struct user_namespace* was inserted as arg #2
 	dnl #
-	AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
-	ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
+	AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace])
+	ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [
 		AC_MSG_RESULT(yes)
-		AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
-		    [xattr_handler->set() wants both dentry and inode])
+		AC_DEFINE(HAVE_XATTR_SET_USERNS, 1,
+		    [xattr_handler->set() takes user_namespace])
 	],[
 		dnl #
-		dnl # 4.4 API change,
-		dnl # The xattr_handler->set() callback was changed to take a
-		dnl # xattr_handler, and handler_flags argument was removed and
-		dnl # should be accessed by handler->flags.
+		dnl # 4.7 API change,
+		dnl # The xattr_handler->set() callback was changed to take both
+		dnl # dentry and inode.
 		dnl #
 		AC_MSG_RESULT(no)
-		AC_MSG_CHECKING(
-		    [whether xattr_handler->set() wants xattr_handler])
-		ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
+		AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
+		ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
 			AC_MSG_RESULT(yes)
-			AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
-			    [xattr_handler->set() wants xattr_handler])
+			AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
+			    [xattr_handler->set() wants both dentry and inode])
 		],[
 			dnl #
-			dnl # 2.6.33 API change,
-			dnl # The xattr_handler->set() callback was changed
-			dnl # to take a dentry instead of an inode, and a
-			dnl # handler_flags argument was added.
+			dnl # 4.4 API change,
+			dnl # The xattr_handler->set() callback was changed to take a
+			dnl # xattr_handler, and handler_flags argument was removed and
+			dnl # should be accessed by handler->flags.
 			dnl #
 			AC_MSG_RESULT(no)
 			AC_MSG_CHECKING(
-			    [whether xattr_handler->set() wants dentry])
-			ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
+			    [whether xattr_handler->set() wants xattr_handler])
+			ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
 				AC_MSG_RESULT(yes)
-				AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
-				    [xattr_handler->set() wants dentry])
+				AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
+				    [xattr_handler->set() wants xattr_handler])
 			],[
-				ZFS_LINUX_TEST_ERROR([xattr set()])
+				dnl #
+				dnl # 2.6.33 API change,
+				dnl # The xattr_handler->set() callback was changed
+				dnl # to take a dentry instead of an inode, and a
+				dnl # handler_flags argument was added.
+				dnl #
+				AC_MSG_RESULT(no)
+				AC_MSG_CHECKING(
+				    [whether xattr_handler->set() wants dentry])
+				ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
+					AC_MSG_RESULT(yes)
+					AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
+					    [xattr_handler->set() wants dentry])
+				],[
+					ZFS_LINUX_TEST_ERROR([xattr set()])
+				])
 			])
 		])
 	])
diff --git a/sys/contrib/openzfs/config/kernel.m4 b/sys/contrib/openzfs/config/kernel.m4
index f31be845f5d9..dfb6165d879d 100644
--- a/sys/contrib/openzfs/config/kernel.m4
+++ b/sys/contrib/openzfs/config/kernel.m4
@@ -79,9 +79,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
 	ZFS_AC_KERNEL_SRC_EVICT_INODE
 	ZFS_AC_KERNEL_SRC_DIRTY_INODE
 	ZFS_AC_KERNEL_SRC_SHRINKER
-	ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T
+	ZFS_AC_KERNEL_SRC_MKDIR
 	ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS
-	ZFS_AC_KERNEL_SRC_CREATE_FLAGS
+	ZFS_AC_KERNEL_SRC_CREATE
 	ZFS_AC_KERNEL_SRC_GET_LINK
 	ZFS_AC_KERNEL_SRC_PUT_LINK
 	ZFS_AC_KERNEL_SRC_TMPFILE
@@ -115,7 +115,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
 	ZFS_AC_KERNEL_SRC_KUIDGID_T
 	ZFS_AC_KERNEL_SRC_KUID_HELPERS
 	ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST
-	ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS
+	ZFS_AC_KERNEL_SRC_RENAME
 	ZFS_AC_KERNEL_SRC_CURRENT_TIME
 	ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES
 	ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL
@@ -125,6 +125,10 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
 	ZFS_AC_KERNEL_SRC_KSTRTOUL
 	ZFS_AC_KERNEL_SRC_PERCPU
 	ZFS_AC_KERNEL_SRC_CPU_HOTPLUG
+	ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS
+	ZFS_AC_KERNEL_SRC_MKNOD
+	ZFS_AC_KERNEL_SRC_SYMLINK
+	ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS
 
 	AC_MSG_CHECKING([for available kernel interfaces])
 	ZFS_LINUX_TEST_COMPILE_ALL([kabi])
@@ -177,9 +181,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
 	ZFS_AC_KERNEL_EVICT_INODE
 	ZFS_AC_KERNEL_DIRTY_INODE
 	ZFS_AC_KERNEL_SHRINKER
-	ZFS_AC_KERNEL_MKDIR_UMODE_T
+	ZFS_AC_KERNEL_MKDIR
 	ZFS_AC_KERNEL_LOOKUP_FLAGS
-	ZFS_AC_KERNEL_CREATE_FLAGS
+	ZFS_AC_KERNEL_CREATE
 	ZFS_AC_KERNEL_GET_LINK
 	ZFS_AC_KERNEL_PUT_LINK
 	ZFS_AC_KERNEL_TMPFILE
@@ -213,7 +217,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
 	ZFS_AC_KERNEL_KUIDGID_T
 	ZFS_AC_KERNEL_KUID_HELPERS
 	ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
-	ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
+	ZFS_AC_KERNEL_RENAME
 	ZFS_AC_KERNEL_CURRENT_TIME
 	ZFS_AC_KERNEL_USERNS_CAPABILITIES
 	ZFS_AC_KERNEL_IN_COMPAT_SYSCALL
@@ -223,6 +227,10 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
 	ZFS_AC_KERNEL_KSTRTOUL
 	ZFS_AC_KERNEL_PERCPU
 	ZFS_AC_KERNEL_CPU_HOTPLUG
+	ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS
+	ZFS_AC_KERNEL_MKNOD
+	ZFS_AC_KERNEL_SYMLINK
+	ZFS_AC_KERNEL_BIO_MAX_SEGS
 ])
 
 dnl #
diff --git a/sys/contrib/openzfs/configure.ac b/sys/contrib/openzfs/configure.ac
index 07f590b390bd..e31d12271394 100644
--- a/sys/contrib/openzfs/configure.ac
+++ b/sys/contrib/openzfs/configure.ac
@@ -240,6 +240,7 @@ AC_CONFIG_FILES([
 	tests/zfs-tests/tests/Makefile
 	tests/zfs-tests/tests/functional/Makefile
 	tests/zfs-tests/tests/functional/acl/Makefile
+	tests/zfs-tests/tests/functional/acl/off/Makefile
 	tests/zfs-tests/tests/functional/acl/posix/Makefile
 	tests/zfs-tests/tests/functional/acl/posix-sa/Makefile
 	tests/zfs-tests/tests/functional/alloc_class/Makefile
diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h
index a7e63944ea16..42f463ab9ae9 100644
--- a/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h
+++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h
@@ -30,8 +30,8 @@
 #include <linux/uaccess.h>
 
 /* 2.6.37 API change */
-#define	zfs_kmap_atomic(page, km_type)		kmap_atomic(page)
-#define	zfs_kunmap_atomic(addr, km_type)	kunmap_atomic(addr)
+#define	zfs_kmap_atomic(page)	kmap_atomic(page)
+#define	zfs_kunmap_atomic(addr)	kunmap_atomic(addr)
 
 /* 5.0 API change - no more 'type' argument for access_ok() */
 #ifdef HAVE_ACCESS_OK_TYPE
diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h
index c35e80d31cd7..91e908598fbb 100644
--- a/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h
+++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h
@@ -343,7 +343,8 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid)
 /*
  * 4.9 API change
  */
-#ifndef HAVE_SETATTR_PREPARE
+#if !(defined(HAVE_SETATTR_PREPARE_NO_USERNS) || \
+    defined(HAVE_SETATTR_PREPARE_USERNS))
 static inline int
 setattr_prepare(struct dentry *dentry, struct iattr *ia)
 {
@@ -389,6 +390,15 @@ func(const struct path *path, struct kstat *stat, u32 request_mask,	\
 {									\
 	return (func##_impl(path, stat, request_mask, query_flags));	\
 }
+#elif defined(HAVE_USERNS_IOPS_GETATTR)
+#define	ZPL_GETATTR_WRAPPER(func)					\
+static int								\
+func(struct user_namespace *user_ns, const struct path *path,	\
+    struct kstat *stat, u32 request_mask, unsigned int query_flags)	\
+{									\
+	return (func##_impl(user_ns, path, stat, request_mask, \
+	    query_flags));	\
+}
 #else
 #error
 #endif
@@ -436,4 +446,16 @@ zpl_is_32bit_api(void)
 #endif
 }
 
+/*
+ * 5.12 API change
+ * To support id-mapped mounts, generic_fillattr() was modified to
+ * accept a new struct user_namespace* as its first arg.
+ */
+#ifdef HAVE_GENERIC_FILLATTR_USERNS
+#define	zpl_generic_fillattr(user_ns, ip, sp)	\
+    generic_fillattr(user_ns, ip, sp)
+#else
+#define	zpl_generic_fillattr(user_ns, ip, sp)	generic_fillattr(ip, sp)
+#endif
+
 #endif /* _ZFS_VFS_H */
diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h
index 8348e99198af..54690727eab9 100644
--- a/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h
+++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h
@@ -119,12 +119,27 @@ fn(struct dentry *dentry, const char *name, void *buffer, size_t size,	\
 #error "Unsupported kernel"
 #endif
 
+/*
+ * 5.12 API change,
+ * The xattr_handler->set() callback was changed to take the
+ * struct user_namespace* as the first arg, to support idmapped
+ * mounts.
+ */
+#if defined(HAVE_XATTR_SET_USERNS)
+#define	ZPL_XATTR_SET_WRAPPER(fn)					\
+static int								\
+fn(const struct xattr_handler *handler, struct user_namespace *user_ns, \
+    struct dentry *dentry, struct inode *inode, const char *name,	\
+    const void *buffer, size_t size, int flags)	\
+{									\
+	return (__ ## fn(inode, name, buffer, size, flags));		\
*** 3309 LINES SKIPPED ***



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