[packages/zfs] - upstream changes for kernel 7.3
baggins
baggins at pld-linux.org
Fri Nov 20 09:59:55 CET 2026
commit c47c08b02ed510aeb2bc231b42e14bc3d50f9495
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Fri Nov 20 09:59:23 2026 +0100
- upstream changes for kernel 7.3
...t-types-and-defines-for-idmap-userns-comp.patch | 174 +++
...nux-zpl-standardise-on-idmap-nomenclature.patch | 1258 ++++++++++++++++++++
...ve-remaining-idmap-compat-use-generic-che.patch | 139 +++
...3-bvec_iter.bi_bvec_done-is-now-bi_offset.patch | 84 ++
...pu_feature_enabled-instead-of-static_cpu_.patch | 101 ++
...-inode_operations.create-dropped-flag-arg.patch | 92 ++
...ake-host-filesystem-available-to-kernel-t.patch | 147 +++
kernel-7.3.patch | 9 +
zfs.spec | 16 +
9 files changed, 2020 insertions(+)
---
diff --git a/zfs.spec b/zfs.spec
index 3bf25da..9777a4d 100644
--- a/zfs.spec
+++ b/zfs.spec
@@ -38,6 +38,14 @@ Source0: https://github.com/openzfs/zfs/releases/download/zfs-%{version}/%{pname
Patch0: initdir.patch
Patch1: pld.patch
Patch2: libfetch.patch
+Patch3: 0001-idmap_compat-types-and-defines-for-idmap-userns-comp.patch
+Patch4: 0002-linux-zpl-standardise-on-idmap-nomenclature.patch
+Patch5: 0003-spl-cred-move-remaining-idmap-compat-use-generic-che.patch
+Patch6: 0004-Linux-7.3-bvec_iter.bi_bvec_done-is-now-bi_offset.patch
+Patch7: 0005-Linux-use-cpu_feature_enabled-instead-of-static_cpu_.patch
+Patch8: 0006-Linux-7.3-inode_operations.create-dropped-flag-arg.patch
+Patch9: 0007-Linux-7.3-make-host-filesystem-available-to-kernel-t.patch
+Patch10: kernel-7.3.patch
URL: https://zfsonlinux.org/
BuildRequires: autoconf >= 2.50
BuildRequires: automake
@@ -267,6 +275,14 @@ p=`pwd`\
%patch -P0 -p1
%patch -P1 -p1
%patch -P2 -p1
+%patch -P3 -p1
+#patch -P4 -p1
+%patch -P5 -p1
+%patch -P6 -p1
+%patch -P7 -p1
+%patch -P8 -p1
+%patch -P9 -p1
+%patch -P10 -p1
%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+python3(\s|$),#!%{__python3}\1,' \
cmd/zarcsummary
diff --git a/0001-idmap_compat-types-and-defines-for-idmap-userns-comp.patch b/0001-idmap_compat-types-and-defines-for-idmap-userns-comp.patch
new file mode 100644
index 0000000..5c45b56
--- /dev/null
+++ b/0001-idmap_compat-types-and-defines-for-idmap-userns-comp.patch
@@ -0,0 +1,174 @@
+From 0cfe9dcdef1c279af35ec4335ba9e348dab60fad Mon Sep 17 00:00:00 2001
+From: Rob Norris <rob.norris at truenas.com>
+Date: Fri, 3 Jul 2026 11:30:28 +1000
+Subject: [PATCH 001/616] idmap_compat: types and defines for idmap/userns
+ compat
+
+Setting up the header where we'll do all our idmap compat stuff. To
+start, lift zidmap_t and zfs_init_idmap out from sys/types.h, and switch
+zidmap_t type switch to use the generic checks.
+
+Sponsored-by: TrueNAS
+Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
+Signed-off-by: Rob Norris <rob.norris at truenas.com>
+Closes #18769
+---
+ include/os/linux/Makefile.am | 1 +
+ include/os/linux/kernel/linux/idmap_compat.h | 78 ++++++++++++++++++++
+ include/os/linux/spl/sys/cred.h | 1 +
+ include/os/linux/spl/sys/types.h | 5 --
+ include/os/linux/zfs/sys/zpl.h | 1 +
+ 5 files changed, 81 insertions(+), 5 deletions(-)
+ create mode 100644 include/os/linux/kernel/linux/idmap_compat.h
+
+diff --git a/include/os/linux/Makefile.am b/include/os/linux/Makefile.am
+index d001b3872..6e01ccb40 100644
+--- a/include/os/linux/Makefile.am
++++ b/include/os/linux/Makefile.am
+@@ -5,6 +5,7 @@ kernel_linux_HEADERS = \
+ %D%/kernel/linux/blkdev_compat.h \
+ %D%/kernel/linux/compiler_compat.h \
+ %D%/kernel/linux/dcache_compat.h \
++ %D%/kernel/linux/idmap_compat.h \
+ %D%/kernel/linux/kmap_compat.h \
+ %D%/kernel/linux/mm_compat.h \
+ %D%/kernel/linux/mod_compat.h \
+diff --git a/include/os/linux/kernel/linux/idmap_compat.h b/include/os/linux/kernel/linux/idmap_compat.h
+new file mode 100644
+index 000000000..b77bbacd0
+--- /dev/null
++++ b/include/os/linux/kernel/linux/idmap_compat.h
+@@ -0,0 +1,78 @@
++// SPDX-License-Identifier: CDDL-1.0
++/*
++ * This file and its contents are supplied under the terms of the
++ * Common Development and Distribution License ("CDDL"), version 1.0.
++ * You may only use this file in accordance with the terms of version
++ * 1.0 of the CDDL.
++ *
++ * A full copy of the text of the CDDL should have accompanied this
++ * source. A copy of the CDDL is also available via the Internet at
++ * http://www.illumos.org/license/CDDL.
++ */
++
++/*
++ * Copyright (c) 2026, TrueNAS.
++ */
++
++#ifndef _ZFS_IDMAP_COMPAT_H
++#define _ZFS_IDMAP_COMPAT_H
++
++/*
++ * Linux has a notion of a "user namespace", the set of users & groups.
++ * Processes and mounts can exist in different namespaces, such that an
++ * operation performed by a user in one namespace may need to be applied
++ * as a user in a different namespace.
++ *
++ * Example: a regular user (id=1000) runs a program in a container. A host
++ * filesystem is mounted into the container. Inside the container, the
++ * filesystem is written to by the "root" user (id=0). So, the id needs to
++ * be "mapped" to the other namespace.
++ *
++ * The VFS takes care of most of this for us, however, inode operations can
++ * access the object representing the id mapping in case they need to do
++ * further work (eg permission checks), or pass it back into the kernel when
++ * using generic helper functions.
++ *
++ * The type and method for accessing the mapping object has changed over the
++ * years:
++ *
++ * - 3.8: user namespaces were introduce in 3.8. the "active" user namespace
++ * was bound to the current task credential, available to the inode
++ * operation via kcred->user_ns.
++ *
++ * - 5.12: to distinguish between the user namespace the current task is
++ * operating in vs the user namespace of the target inode (mount),
++ * a struct user_namespace is passed to the inode operation in the
++ * first arg.
++ *
++ * - 6.3: to allow the id mapping process to be changed in the future to
++ * consider more than just the user namespaces, inode operations now
++ * now get passed a struct mnt_idmap, an abstract object with methods
++ * to request the "mapped" value for particular things.
++ *
++ * We currently support kernels that span this range, so we need to support all
++ * three methods. Fortunately, the kernel core switched in its entirety in the
++ * same release, so we don't need to handle conversions between eg
++ * user_namespace and mnt_idmap or anything like that.
++ *
++ * This file contains the types and macros needed for this support.
++ */
++
++/*
++ * zidmap_t will always match the type of the thing carrying the mapping for
++ * the current context. It can't ever be used directly, but we can name it
++ * and cast to and from it safely in prototypes and calls.
++ */
++#ifdef HAVE_IDMAP_MNTIDMAP
++typedef struct mnt_idmap zidmap_t;
++#else
++typedef struct user_namespace zidmap_t;
++#endif
++
++/*
++ * The "identity" idmap, typically that of "host" namespace, "root" mount or
++ * similar. Prepared in advance by the SPL.
++ */
++extern zidmap_t *zfs_init_idmap;
++
++#endif
+diff --git a/include/os/linux/spl/sys/cred.h b/include/os/linux/spl/sys/cred.h
+index cd0fe96c8..fb89e729a 100644
+--- a/include/os/linux/spl/sys/cred.h
++++ b/include/os/linux/spl/sys/cred.h
+@@ -28,6 +28,7 @@
+ #include <linux/module.h>
+ #include <linux/cred.h>
+ #include <linux/sched.h>
++#include <linux/idmap_compat.h>
+ #include <sys/types.h>
+ #include <sys/vfs.h>
+
+diff --git a/include/os/linux/spl/sys/types.h b/include/os/linux/spl/sys/types.h
+index f0133394e..09aa6f416 100644
+--- a/include/os/linux/spl/sys/types.h
++++ b/include/os/linux/spl/sys/types.h
+@@ -67,23 +67,18 @@ struct mnt_idmap {
+ struct uid_gid_map gid_map;
+ refcount_t count;
+ };
+-typedef struct mnt_idmap zidmap_t;
+ #define idmap_owner(p) (NULL)
+ #else
+ struct mnt_idmap {
+ struct user_namespace *owner;
+ refcount_t count;
+ };
+-typedef struct mnt_idmap zidmap_t;
+ #define idmap_owner(p) (((struct mnt_idmap *)p)->owner)
+ #endif
+ #else
+-typedef struct user_namespace zidmap_t;
+ #define idmap_owner(p) ((struct user_namespace *)p)
+ #endif
+
+-extern zidmap_t *zfs_init_idmap;
+-
+ #ifdef HAVE_1ARG_ASSIGN_STR
+ #define __assign_str_impl(a, b) __assign_str(a)
+ #else
+diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h
+index 9e657d940..bb9cc3ff9 100644
+--- a/include/os/linux/zfs/sys/zpl.h
++++ b/include/os/linux/zfs/sys/zpl.h
+@@ -35,6 +35,7 @@
+ #include <linux/parser.h>
+ #include <linux/vfs_compat.h>
+ #include <linux/writeback.h>
++#include <linux/idmap_compat.h>
+ #include <linux/xattr_compat.h>
+
+ /* zpl_inode.c */
+--
+2.56.0
+
diff --git a/0002-linux-zpl-standardise-on-idmap-nomenclature.patch b/0002-linux-zpl-standardise-on-idmap-nomenclature.patch
new file mode 100644
index 0000000..4eacbc5
--- /dev/null
+++ b/0002-linux-zpl-standardise-on-idmap-nomenclature.patch
@@ -0,0 +1,1258 @@
+From ed11654233046c64df9bd00b38e7604a0594dc1f Mon Sep 17 00:00:00 2001
+From: Rob Norris <rob.norris at truenas.com>
+Date: Thu, 9 Jul 2026 14:28:47 +1000
+Subject: [PATCH 002/616] linux/zpl: standardise on 'idmap' nomenclature
+
+Wherever we use zidmap_t, name it idmap, since that is its purpose and
+we have no idea whether or not there's a user_namespace or a mnt_idmap
+under there.
+
+Sponsored-by: TrueNAS
+Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
+Signed-off-by: Rob Norris <rob.norris at truenas.com>
+Closes #18769
+---
+ include/os/linux/spl/sys/cred.h | 32 ++++-----
+ include/os/linux/zfs/sys/zfs_acl_impl.h | 2 +-
+ include/os/linux/zfs/sys/zfs_vnops_os.h | 12 ++--
+ include/os/linux/zfs/sys/zpl.h | 2 +-
+ module/os/linux/zfs/policy.c | 14 ++--
+ module/os/linux/zfs/zfs_acl.c | 52 +++++++-------
+ module/os/linux/zfs/zfs_vnops_os.c | 68 +++++++++---------
+ module/os/linux/zfs/zpl_ctldir.c | 52 +++++++-------
+ module/os/linux/zfs/zpl_inode.c | 92 ++++++++++++-------------
+ module/os/linux/zfs/zpl_xattr.c | 24 +++----
+ 10 files changed, 175 insertions(+), 175 deletions(-)
+
+diff --git a/include/os/linux/spl/sys/cred.h b/include/os/linux/spl/sys/cred.h
+index fb89e729a..3c033143a 100644
+--- a/include/os/linux/spl/sys/cred.h
++++ b/include/os/linux/spl/sys/cred.h
+@@ -75,20 +75,20 @@ static inline boolean_t zfs_no_idmapping(struct user_namespace *mnt_userns,
+ mnt_userns == fs_userns);
+ }
+
+-static inline uid_t zfs_uid_to_vfsuid(zidmap_t *mnt_userns,
++static inline uid_t zfs_uid_to_vfsuid(zidmap_t *idmap,
+ struct user_namespace *fs_userns, uid_t uid)
+ {
+ struct user_namespace *owner;
+ #ifdef HAVE_IOPS_CREATE_IDMAP
+- if (mnt_userns == zfs_init_idmap)
++ if (idmap == zfs_init_idmap)
+ return (uid);
+ #endif
+ #ifdef HAVE_IDMAP_NO_USERNS
+ struct user_namespace ns;
+- ns.uid_map = mnt_userns->uid_map;
++ ns.uid_map = idmap->uid_map;
+ owner = &ns;
+ #else
+- owner = idmap_owner(mnt_userns);
++ owner = idmap_owner(idmap);
+ #endif
+ if (zfs_no_idmapping(owner, fs_userns))
+ return (uid);
+@@ -99,20 +99,20 @@ static inline uid_t zfs_uid_to_vfsuid(zidmap_t *mnt_userns,
+ return (__kuid_val(make_kuid(owner, uid)));
+ }
+
+-static inline gid_t zfs_gid_to_vfsgid(zidmap_t *mnt_userns,
++static inline gid_t zfs_gid_to_vfsgid(zidmap_t *idmap,
+ struct user_namespace *fs_userns, gid_t gid)
+ {
+ struct user_namespace *owner;
+ #ifdef HAVE_IOPS_CREATE_IDMAP
+- if (mnt_userns == zfs_init_idmap)
++ if (idmap == zfs_init_idmap)
+ return (gid);
+ #endif
+ #ifdef HAVE_IDMAP_NO_USERNS
+ struct user_namespace ns;
+- ns.gid_map = mnt_userns->gid_map;
++ ns.gid_map = idmap->gid_map;
+ owner = &ns;
+ #else
+- owner = idmap_owner(mnt_userns);
++ owner = idmap_owner(idmap);
+ #endif
+ if (zfs_no_idmapping(owner, fs_userns))
+ return (gid);
+@@ -123,20 +123,20 @@ static inline gid_t zfs_gid_to_vfsgid(zidmap_t *mnt_userns,
+ return (__kgid_val(make_kgid(owner, gid)));
+ }
+
+-static inline uid_t zfs_vfsuid_to_uid(zidmap_t *mnt_userns,
++static inline uid_t zfs_vfsuid_to_uid(zidmap_t *idmap,
+ struct user_namespace *fs_userns, uid_t uid)
+ {
+ struct user_namespace *owner;
+ #ifdef HAVE_IOPS_CREATE_IDMAP
+- if (mnt_userns == zfs_init_idmap)
++ if (idmap == zfs_init_idmap)
+ return (uid);
+ #endif
+ #ifdef HAVE_IDMAP_NO_USERNS
+ struct user_namespace ns;
+- ns.uid_map = mnt_userns->uid_map;
++ ns.uid_map = idmap->uid_map;
+ owner = &ns;
+ #else
+- owner = idmap_owner(mnt_userns);
++ owner = idmap_owner(idmap);
+ #endif
+ if (zfs_no_idmapping(owner, fs_userns))
+ return (uid);
+@@ -148,20 +148,20 @@ static inline uid_t zfs_vfsuid_to_uid(zidmap_t *mnt_userns,
+ return (__kuid_val(make_kuid(fs_userns, uid)));
+ }
+
+-static inline gid_t zfs_vfsgid_to_gid(zidmap_t *mnt_userns,
++static inline gid_t zfs_vfsgid_to_gid(zidmap_t *idmap,
+ struct user_namespace *fs_userns, gid_t gid)
+ {
+ struct user_namespace *owner;
+ #ifdef HAVE_IOPS_CREATE_IDMAP
+- if (mnt_userns == zfs_init_idmap)
++ if (idmap == zfs_init_idmap)
+ return (gid);
+ #endif
+ #ifdef HAVE_IDMAP_NO_USERNS
+ struct user_namespace ns;
+- ns.gid_map = mnt_userns->gid_map;
++ ns.gid_map = idmap->gid_map;
+ owner = &ns;
+ #else
+- owner = idmap_owner(mnt_userns);
++ owner = idmap_owner(idmap);
+ #endif
+ if (zfs_no_idmapping(owner, fs_userns))
+ return (gid);
+diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h
+index bb9cc3ff9..d1c9efacc 100644
+--- a/include/os/linux/zfs/sys/zpl.h
++++ b/include/os/linux/zfs/sys/zpl.h
+@@ -40,7 +40,7 @@
+
+ /* zpl_inode.c */
+ extern void zpl_vap_init(vattr_t *vap, struct inode *dir,
+- umode_t mode, cred_t *cr, zidmap_t *mnt_ns);
++ umode_t mode, cred_t *cr, zidmap_t *idmap);
+
+ extern const struct inode_operations zpl_inode_operations;
+ extern const struct inode_operations zpl_dir_inode_operations;
+diff --git a/module/os/linux/zfs/policy.c b/module/os/linux/zfs/policy.c
+index 4396a5d9e..0b1c6b89e 100644
+--- a/module/os/linux/zfs/policy.c
++++ b/module/os/linux/zfs/policy.c
+@@ -220,10 +220,10 @@ secpolicy_vnode_setid_retain(struct znode *zp __maybe_unused, const cred_t *cr,
+ * Determine that subject can set the file setgid flag.
+ */
+ int
+-secpolicy_vnode_setids_setgids(const cred_t *cr, gid_t gid, zidmap_t *mnt_ns,
++secpolicy_vnode_setids_setgids(const cred_t *cr, gid_t gid, zidmap_t *idmap,
+ struct user_namespace *fs_ns)
+ {
+- gid = zfs_gid_to_vfsgid(mnt_ns, fs_ns, gid);
++ gid = zfs_gid_to_vfsgid(idmap, fs_ns, gid);
+ #if defined(CONFIG_USER_NS)
+ if (!kgid_has_mapping(cr->user_ns, SGID_TO_KGID(gid)))
+ return (EPERM);
+@@ -270,10 +270,10 @@ secpolicy_setid_clear(vattr_t *vap, cred_t *cr)
+ * Determine that subject can set the file setid flags.
+ */
+ static int
+-secpolicy_vnode_setid_modify(const cred_t *cr, uid_t owner, zidmap_t *mnt_ns,
++secpolicy_vnode_setid_modify(const cred_t *cr, uid_t owner, zidmap_t *idmap,
+ struct user_namespace *fs_ns)
+ {
+- owner = zfs_uid_to_vfsuid(mnt_ns, fs_ns, owner);
++ owner = zfs_uid_to_vfsuid(idmap, fs_ns, owner);
+
+ if (crgetuid(cr) == owner)
+ return (0);
+@@ -299,14 +299,14 @@ secpolicy_vnode_stky_modify(const cred_t *cr)
+
+ int
+ secpolicy_setid_setsticky_clear(struct inode *ip, vattr_t *vap,
+- const vattr_t *ovap, cred_t *cr, zidmap_t *mnt_ns,
++ const vattr_t *ovap, cred_t *cr, zidmap_t *idmap,
+ struct user_namespace *fs_ns)
+ {
+ int error;
+
+ if ((vap->va_mode & S_ISUID) != 0 &&
+ (error = secpolicy_vnode_setid_modify(cr,
+- ovap->va_uid, mnt_ns, fs_ns)) != 0) {
++ ovap->va_uid, idmap, fs_ns)) != 0) {
+ return (error);
+ }
+
+@@ -325,7 +325,7 @@ secpolicy_setid_setsticky_clear(struct inode *ip, vattr_t *vap,
+ */
+ if ((vap->va_mode & S_ISGID) != 0 &&
+ secpolicy_vnode_setids_setgids(cr, ovap->va_gid,
+- mnt_ns, fs_ns) != 0) {
++ idmap, fs_ns) != 0) {
+ vap->va_mode &= ~S_ISGID;
+ }
+
+diff --git a/module/os/linux/zfs/zfs_acl.c b/module/os/linux/zfs/zfs_acl.c
+index 5fde58dff..0b75391d8 100644
+--- a/module/os/linux/zfs/zfs_acl.c
++++ b/module/os/linux/zfs/zfs_acl.c
+@@ -1805,7 +1805,7 @@ zfs_acl_inherit(zfsvfs_t *zfsvfs, umode_t va_mode, zfs_acl_t *paclp,
+ */
+ int
+ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr,
+- vsecattr_t *vsecp, zfs_acl_ids_t *acl_ids, zidmap_t *mnt_ns)
++ vsecattr_t *vsecp, zfs_acl_ids_t *acl_ids, zidmap_t *idmap)
+ {
+ int error;
+ zfsvfs_t *zfsvfs = ZTOZSB(dzp);
+@@ -1892,7 +1892,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr,
+ acl_ids->z_mode |= S_ISGID;
+ } else {
+ if ((acl_ids->z_mode & S_ISGID) &&
+- secpolicy_vnode_setids_setgids(cr, gid, mnt_ns,
++ secpolicy_vnode_setids_setgids(cr, gid, idmap,
+ zfs_i_user_ns(ZTOI(dzp))) != 0) {
+ acl_ids->z_mode &= ~S_ISGID;
+ }
+@@ -2287,7 +2287,7 @@ zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mode)
+ */
+ static int
+ zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode,
+- boolean_t anyaccess, cred_t *cr, zidmap_t *mnt_ns)
++ boolean_t anyaccess, cred_t *cr, zidmap_t *idmap)
+ {
+ zfsvfs_t *zfsvfs = ZTOZSB(zp);
+ zfs_acl_t *aclp;
+@@ -2303,10 +2303,10 @@ zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode,
+ uid_t gowner;
+ uid_t fowner;
+
+- if (mnt_ns) {
+- fowner = zfs_uid_to_vfsuid(mnt_ns, zfs_i_user_ns(ZTOI(zp)),
++ if (idmap) {
++ fowner = zfs_uid_to_vfsuid(idmap, zfs_i_user_ns(ZTOI(zp)),
+ KUID_TO_SUID(ZTOI(zp)->i_uid));
+- gowner = zfs_gid_to_vfsgid(mnt_ns, zfs_i_user_ns(ZTOI(zp)),
++ gowner = zfs_gid_to_vfsgid(idmap, zfs_i_user_ns(ZTOI(zp)),
+ KGID_TO_SGID(ZTOI(zp)->i_gid));
+ } else
+ zfs_fuid_map_ids(zp, cr, &fowner, &gowner);
+@@ -2432,7 +2432,7 @@ zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode,
+ */
+ static int
+ zfs_zaccess_trivial(znode_t *zp, uint32_t *working_mode, cred_t *cr,
+- zidmap_t *mnt_ns)
++ zidmap_t *idmap)
+ {
+ int err, mask;
+ int unmapped = 0;
+@@ -2447,7 +2447,7 @@ zfs_zaccess_trivial(znode_t *zp, uint32_t *working_mode, cred_t *cr,
+
+ #if (defined(HAVE_IOPS_PERMISSION_USERNS) || \
+ defined(HAVE_IOPS_PERMISSION_IDMAP))
+- err = generic_permission(mnt_ns, ZTOI(zp), mask);
++ err = generic_permission(idmap, ZTOI(zp), mask);
+ #else
+ err = generic_permission(ZTOI(zp), mask);
+ #endif
+@@ -2462,7 +2462,7 @@ zfs_zaccess_trivial(znode_t *zp, uint32_t *working_mode, cred_t *cr,
+
+ static int
+ zfs_zaccess_common(znode_t *zp, uint32_t v4_mode, uint32_t *working_mode,
+- boolean_t *check_privs, boolean_t skipaclchk, cred_t *cr, zidmap_t *mnt_ns)
++ boolean_t *check_privs, boolean_t skipaclchk, cred_t *cr, zidmap_t *idmap)
+ {
+ zfsvfs_t *zfsvfs = ZTOZSB(zp);
+ int err;
+@@ -2512,20 +2512,20 @@ zfs_zaccess_common(znode_t *zp, uint32_t v4_mode, uint32_t *working_mode,
+ }
+
+ if (zp->z_pflags & ZFS_ACL_TRIVIAL)
+- return (zfs_zaccess_trivial(zp, working_mode, cr, mnt_ns));
++ return (zfs_zaccess_trivial(zp, working_mode, cr, idmap));
+
+- return (zfs_zaccess_aces_check(zp, working_mode, B_FALSE, cr, mnt_ns));
++ return (zfs_zaccess_aces_check(zp, working_mode, B_FALSE, cr, idmap));
+ }
+
+ static int
+ zfs_zaccess_append(znode_t *zp, uint32_t *working_mode, boolean_t *check_privs,
+- cred_t *cr, zidmap_t *mnt_ns)
++ cred_t *cr, zidmap_t *idmap)
+ {
+ if (*working_mode != ACE_WRITE_DATA)
+ return (SET_ERROR(EACCES));
+
+ return (zfs_zaccess_common(zp, ACE_APPEND_DATA, working_mode,
+- check_privs, B_FALSE, cr, mnt_ns));
++ check_privs, B_FALSE, cr, idmap));
+ }
+
+ int
+@@ -2642,7 +2642,7 @@ zfs_zaccess_idmap(znode_t *zp, int mode, int flags, boolean_t skipaclchk,
+ }
+ }
+
+- owner = zfs_uid_to_vfsuid(mnt_ns, zfs_i_user_ns(ZTOI(zp)),
++ owner = zfs_uid_to_vfsuid(idmap, zfs_i_user_ns(ZTOI(zp)),
+ KUID_TO_SUID(ZTOI(zp)->i_uid));
+ owner = zfs_fuid_map_id(ZTOZSB(zp), owner, cr, ZFS_OWNER);
+
+@@ -2670,7 +2670,7 @@ zfs_zaccess_idmap(znode_t *zp, int mode, int flags, boolean_t skipaclchk,
+ needed_bits |= S_IXUSR;
+
+ if ((error = zfs_zaccess_common(check_zp, mode, &working_mode,
+- &check_privs, skipaclchk, cr, mnt_ns)) == 0) {
++ &check_privs, skipaclchk, cr, idmap)) == 0) {
+ if (is_attr)
+ zrele(xzp);
+ return (secpolicy_vnode_access2(cr, ZTOI(zp), owner,
+@@ -2685,7 +2685,7 @@ zfs_zaccess_idmap(znode_t *zp, int mode, int flags, boolean_t skipaclchk,
+
+ if (error && (flags & V_APPEND)) {
+ error = zfs_zaccess_append(zp, &working_mode, &check_privs, cr,
+- mnt_ns);
++ idmap);
+ }
+
+ if (error && check_privs) {
+@@ -2760,10 +2760,10 @@ zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk,
+ */
+ int
+ zfs_zaccess_rwx(znode_t *zp, mode_t mode, int flags, cred_t *cr,
+- zidmap_t *mnt_ns)
++ zidmap_t *idmap)
+ {
+ return (zfs_zaccess(zp, zfs_unix_to_v4(mode >> 6), flags, B_FALSE, cr,
+- mnt_ns));
++_ idmap));
+ }
+
+ /*
+@@ -2857,7 +2857,7 @@ static const boolean_t zfs_write_implies_delete_child = B_TRUE;
+ * zfs_write_implies_delete_child
+ */
+ int
+-zfs_zaccess_delete(znode_t *dzp, znode_t *zp, cred_t *cr, zidmap_t *mnt_ns)
++zfs_zaccess_delete(znode_t *dzp, znode_t *zp, cred_t *cr, zidmap_t *idmap)
+ {
+ uint32_t wanted_dirperms;
+ uint32_t dzp_working_mode = 0;
+@@ -2884,7 +2884,7 @@ zfs_zaccess_delete(znode_t *dzp, znode_t *zp, cred_t *cr, zidmap_t *mnt_ns)
+ * (This is part of why we're checking the target first.)
+ */
+ zp_error = zfs_zaccess_common(zp, ACE_DELETE, &zp_working_mode,
+- &zpcheck_privs, B_FALSE, cr, mnt_ns);
++ &zpcheck_privs, B_FALSE, cr, idmap);
+ if (zp_error == EACCES) {
+ /* We hit a DENY ACE. */
+ if (!zpcheck_privs)
+@@ -2906,7 +2906,7 @@ zfs_zaccess_delete(znode_t *dzp, znode_t *zp, cred_t *cr, zidmap_t *mnt_ns)
+ if (zfs_write_implies_delete_child)
+ wanted_dirperms |= ACE_WRITE_DATA;
+ dzp_error = zfs_zaccess_common(dzp, wanted_dirperms,
+- &dzp_working_mode, &dzpcheck_privs, B_FALSE, cr, mnt_ns);
++ &dzp_working_mode, &dzpcheck_privs, B_FALSE, cr, idmap);
+ if (dzp_error == EACCES) {
+ /* We hit a DENY ACE. */
+ if (!dzpcheck_privs)
+@@ -2988,7 +2988,7 @@ zfs_zaccess_delete(znode_t *dzp, znode_t *zp, cred_t *cr, zidmap_t *mnt_ns)
+
+ int
+ zfs_zaccess_rename(znode_t *sdzp, znode_t *szp, znode_t *tdzp,
+- znode_t *tzp, cred_t *cr, zidmap_t *mnt_ns)
++ znode_t *tzp, cred_t *cr, zidmap_t *idmap)
+ {
+ int add_perm;
+ int error;
+@@ -3010,21 +3010,21 @@ zfs_zaccess_rename(znode_t *sdzp, znode_t *szp, znode_t *tdzp,
+ * If that succeeds then check for add_file/add_subdir permissions
+ */
+
+- if ((error = zfs_zaccess_delete(sdzp, szp, cr, mnt_ns)))
++ if ((error = zfs_zaccess_delete(sdzp, szp, cr, idmap)))
+ return (error);
+
+ /*
+ * If we have a tzp, see if we can delete it?
+ */
+ if (tzp) {
+- if ((error = zfs_zaccess_delete(tdzp, tzp, cr, mnt_ns)))
++ if ((error = zfs_zaccess_delete(tdzp, tzp, cr, idmap)))
+ return (error);
+ }
+
+ /*
+ * Now check for add permissions
+ */
+- error = zfs_zaccess(tdzp, add_perm, 0, B_FALSE, cr, mnt_ns);
++ error = zfs_zaccess(tdzp, add_perm, 0, B_FALSE, cr, idmap);
+
+ return (error);
+ }
+diff --git a/module/os/linux/zfs/zfs_vnops_os.c b/module/os/linux/zfs/zfs_vnops_os.c
+index 1a2898352..d35b67e82 100644
+--- a/module/os/linux/zfs/zfs_vnops_os.c
++++ b/module/os/linux/zfs/zfs_vnops_os.c
+@@ -610,7 +610,7 @@ zfs_get_name(znode_t *dzp, char *name, znode_t *zp)
+ * cr - credentials of caller.
+ * flag - file flag.
+ * vsecp - ACL to be set
+- * mnt_ns - user namespace of the mount
++ * idmap - idmap of the mount
+ *
+ * OUT: zpp - znode of created or trunc'd entry.
+ *
+@@ -623,7 +623,7 @@ zfs_get_name(znode_t *dzp, char *name, znode_t *zp)
+ int
+ zfs_create_idmap(znode_t *dzp, char *name, vattr_t *vap, int excl,
+ int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp,
+- zidmap_t *mnt_ns)
++ zidmap_t *idmap)
+ {
+ znode_t *zp;
+ zfsvfs_t *zfsvfs = ZTOZSB(dzp);
+@@ -712,7 +712,7 @@ top:
+ * to reference it.
+ */
+ if ((error = zfs_zaccess_idmap(dzp, ACE_ADD_FILE, 0, skip_acl,
+- cr, mnt_ns))) {
++ cr, idmap))) {
+ if (have_acl)
+ zfs_acl_ids_free(&acl_ids);
+ goto out;
+@@ -731,7 +731,7 @@ top:
+ }
+
+ if (!have_acl && (error = zfs_acl_ids_create(dzp, 0, vap,
+- cr, vsecp, &acl_ids, mnt_ns)) != 0)
++ cr, vsecp, &acl_ids, idmap)) != 0)
+ goto out;
+ have_acl = B_TRUE;
+
+@@ -826,7 +826,7 @@ top:
+ * Verify requested access to file.
+ */
+ if (mode && (error = zfs_zaccess_rwx_idmap(zp, mode, aflags,
+- cr, mnt_ns))) {
++ cr, idmap))) {
+ goto out;
+ }
+
+@@ -876,7 +876,7 @@ zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl,
+ int
+ zfs_tmpfile_idmap(struct inode *dip, vattr_t *vap, int excl,
+ int mode, struct inode **ipp, cred_t *cr, int flag, vsecattr_t *vsecp,
+- zidmap_t *mnt_ns)
++ zidmap_t *idmap)
+ {
+ (void) excl, (void) mode, (void) flag;
+ znode_t *zp = NULL, *dzp = ITOZ(dip);
+@@ -924,14 +924,14 @@ top:
+ * to reference it.
+ */
+ if ((error = zfs_zaccess_idmap(dzp, ACE_ADD_FILE, 0, B_FALSE,
+- cr, mnt_ns))) {
++ cr, idmap))) {
+ if (have_acl)
+ zfs_acl_ids_free(&acl_ids);
+ goto out;
+ }
+
+ if (!have_acl && (error = zfs_acl_ids_create(dzp, 0, vap,
+- cr, vsecp, &acl_ids, mnt_ns)) != 0)
++ cr, vsecp, &acl_ids, idmap)) != 0)
+ goto out;
+ have_acl = B_TRUE;
+
+@@ -1254,7 +1254,7 @@ out:
+ * cr - credentials of caller.
+ * flags - case flags.
+ * vsecp - ACL to be set
+- * mnt_ns - user namespace of the mount
++ * idmap - idmap of the mount
+ *
+ * OUT: zpp - znode of created directory.
+ *
+@@ -1267,7 +1267,7 @@ out:
+ */
+ int
+ zfs_mkdir_idmap(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp,
+- cred_t *cr, int flags, vsecattr_t *vsecp, zidmap_t *mnt_ns)
++ cred_t *cr, int flags, vsecattr_t *vsecp, zidmap_t *idmap)
+ {
+ znode_t *zp;
+ zfsvfs_t *zfsvfs = ZTOZSB(dzp);
+@@ -1324,7 +1324,7 @@ zfs_mkdir_idmap(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp,
+ }
+
+ if ((error = zfs_acl_ids_create(dzp, 0, vap, cr,
+- vsecp, &acl_ids, mnt_ns)) != 0) {
++ vsecp, &acl_ids, idmap)) != 0) {
+ zfs_exit(zfsvfs, FTAG);
+ return (error);
+ }
+@@ -1346,7 +1346,7 @@ top:
+ }
+
+ if ((error = zfs_zaccess_idmap(dzp, ACE_ADD_SUBDIRECTORY, 0, B_FALSE,
+- cr, mnt_ns))) {
++ cr, idmap))) {
+ zfs_acl_ids_free(&acl_ids);
+ zfs_dirent_unlock(dl);
+ zfs_exit(zfsvfs, FTAG);
+@@ -1752,10 +1752,10 @@ out:
+ */
+ int
+ #ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
+-zfs_getattr_fast(zidmap_t *user_ns, u32 request_mask, struct inode *ip,
++zfs_getattr_fast(zidmap_t *idmap, u32 request_mask, struct inode *ip,
+ struct kstat *sp)
+ #else
+-zfs_getattr_fast(zidmap_t *user_ns, struct inode *ip, struct kstat *sp)
++zfs_getattr_fast(zidmap_t *idmap, struct inode *ip, struct kstat *sp)
+ #endif
+ {
+ znode_t *zp = ITOZ(ip);
+@@ -1770,9 +1770,9 @@ zfs_getattr_fast(zidmap_t *user_ns, struct inode *ip, struct kstat *sp)
+ mutex_enter(&zp->z_lock);
+
+ #ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
+- zpl_generic_fillattr(user_ns, request_mask, ip, sp);
++ zpl_generic_fillattr(idmap, request_mask, ip, sp);
+ #else
+- zpl_generic_fillattr(user_ns, ip, sp);
++ zpl_generic_fillattr(idmap, ip, sp);
+ #endif
+ /*
+ * +1 link count for root inode with visible '.zfs' directory.
+@@ -1953,7 +1953,7 @@ next:
+ * flags - ATTR_UTIME set if non-default time values provided.
+ * - ATTR_NOACLCHECK (CIFS context only).
+ * cr - credentials of caller.
+- * mnt_ns - user namespace of the mount
++ * idmap - idmap of the mount
+ *
+ * RETURN: 0 if success
+ * error code if failure
+@@ -1963,7 +1963,7 @@ next:
+ */
+ int
+ zfs_setattr_idmap(znode_t *zp, vattr_t *vap, int flags, cred_t *cr,
+- zidmap_t *mnt_ns)
++ zidmap_t *idmap)
+ {
+ struct inode *ip;
+ zfsvfs_t *zfsvfs = ZTOZSB(zp);
+@@ -2111,7 +2111,7 @@ top:
+
+ if (mask & ATTR_SIZE) {
+ err = zfs_zaccess_idmap(zp, ACE_WRITE_DATA, 0, skipaclchk,
+- cr, mnt_ns);
++ cr, idmap);
+ if (err)
+ goto out3;
+
+@@ -2136,7 +2136,7 @@ top:
+ XVA_ISSET_REQ(xvap, XAT_CREATETIME) ||
+ XVA_ISSET_REQ(xvap, XAT_SYSTEM)))) {
+ need_policy = zfs_zaccess_idmap(zp, ACE_WRITE_ATTRIBUTES, 0,
+- skipaclchk, cr, mnt_ns);
++ skipaclchk, cr, idmap);
+ }
+
+ if (mask & (ATTR_UID|ATTR_GID)) {
+@@ -2158,9 +2158,9 @@ top:
+ * Take ownership or chgrp to group we are a member of
+ */
+
+- uid = zfs_uid_to_vfsuid(mnt_ns, zfs_i_user_ns(ip),
++ uid = zfs_uid_to_vfsuid(idmap, zfs_i_user_ns(ip),
+ vap->va_uid);
+- gid = zfs_gid_to_vfsgid(mnt_ns, zfs_i_user_ns(ip),
++ gid = zfs_gid_to_vfsgid(idmap, zfs_i_user_ns(ip),
+ vap->va_gid);
+ take_owner = (mask & ATTR_UID) && (uid == crgetuid(cr));
+ take_group = (mask & ATTR_GID) &&
+@@ -2180,7 +2180,7 @@ top:
+ ((idmask == ATTR_UID) && take_owner) ||
+ ((idmask == ATTR_GID) && take_group)) {
+ if (zfs_zaccess_idmap(zp, ACE_WRITE_OWNER, 0,
+- skipaclchk, cr, mnt_ns) == 0) {
++ skipaclchk, cr, idmap) == 0) {
+ /*
+ * Remove setuid/setgid for non-privileged users
+ */
+@@ -2294,9 +2294,9 @@ top:
+
+ if (mask & ATTR_MODE) {
+ if (zfs_zaccess_idmap(zp, ACE_WRITE_ACL, 0, skipaclchk, cr,
+- mnt_ns) == 0) {
++ idmap) == 0) {
+ err = secpolicy_setid_setsticky_clear(ip, vap,
+- &oldva, cr, mnt_ns, zfs_i_user_ns(ip));
++ &oldva, cr, idmap, zfs_i_user_ns(ip));
+ if (err)
+ goto out3;
+ trim_mask |= ATTR_MODE;
+@@ -2812,7 +2812,7 @@ zfs_rename_lock(znode_t *szp, znode_t *tdzp, znode_t *sdzp, zfs_zlock_t **zlpp)
+ * flags - case flags
+ * rflags - RENAME_* flags
+ * wa_vap - attributes for RENAME_WHITEOUT (must be a char 0:0).
+- * mnt_ns - user namespace of the mount
++ * idmap - idmap of the mount
+ *
+ * RETURN: 0 on success, error code on failure.
+ *
+@@ -2821,7 +2821,7 @@ zfs_rename_lock(znode_t *szp, znode_t *tdzp, znode_t *sdzp, zfs_zlock_t **zlpp)
+ */
+ int
+ zfs_rename_idmap(znode_t *sdzp, char *snm, znode_t *tdzp, char *tnm,
+- cred_t *cr, int flags, uint64_t rflags, vattr_t *wo_vap, zidmap_t *mnt_ns)
++ cred_t *cr, int flags, uint64_t rflags, vattr_t *wo_vap, zidmap_t *idmap)
+ {
+ znode_t *szp, *tzp;
+ zfsvfs_t *zfsvfs = ZTOZSB(sdzp);
+@@ -3036,7 +3036,7 @@ top:
+ * Note that if target and source are the same, this can be
+ * done in a single check.
+ */
+- if ((error = zfs_zaccess_rename(sdzp, szp, tdzp, tzp, cr, mnt_ns)))
++ if ((error = zfs_zaccess_rename(sdzp, szp, tdzp, tzp, cr, idmap)))
+ goto out;
+
+ if (S_ISDIR(ZTOI(szp)->i_mode)) {
+@@ -3092,13 +3092,13 @@ top:
+ uint64_t wo_projid = ZFS_DEFAULT_PROJID;
+
+ error = zfs_zaccess_idmap(sdzp, ACE_ADD_FILE, 0, B_FALSE,
+- cr, mnt_ns);
++ cr, idmap);
+ if (error)
+ goto out;
+
+ if (!have_acl) {
+ error = zfs_acl_ids_create(sdzp, 0, wo_vap, cr, NULL,
+- &acl_ids, mnt_ns);
++ &acl_ids, idmap);
+ if (error)
+ goto out;
+ have_acl = B_TRUE;
+@@ -3352,7 +3352,7 @@ zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp, char *tnm,
+ * link - Name for new symlink entry.
+ * cr - credentials of caller.
+ * flags - case flags
+- * mnt_ns - user namespace of the mount
++ * idmap - user namespace of the mount
+ *
+ * OUT: zpp - Znode for new symbolic link.
+ *
+@@ -3363,7 +3363,7 @@ zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp, char *tnm,
+ */
+ int
+ zfs_symlink_idmap(znode_t *dzp, char *name, vattr_t *vap, char *link,
+- znode_t **zpp, cred_t *cr, int flags, zidmap_t *mnt_ns)
++ znode_t **zpp, cred_t *cr, int flags, zidmap_t *idmap)
+ {
+ znode_t *zp;
+ zfs_dirlock_t *dl;
+@@ -3401,7 +3401,7 @@ zfs_symlink_idmap(znode_t *dzp, char *name, vattr_t *vap, char *link,
+ }
+
+ if ((error = zfs_acl_ids_create(dzp, 0,
+- vap, cr, NULL, &acl_ids, mnt_ns)) != 0) {
++ vap, cr, NULL, &acl_ids, idmap)) != 0) {
+ zfs_exit(zfsvfs, FTAG);
+ return (error);
+ }
+@@ -3419,7 +3419,7 @@ top:
+ }
+
+ if ((error = zfs_zaccess_idmap(dzp, ACE_ADD_FILE, 0, B_FALSE,
+- cr, mnt_ns))) {
++ cr, idmap))) {
+ zfs_acl_ids_free(&acl_ids);
+ zfs_dirent_unlock(dl);
+ zfs_exit(zfsvfs, FTAG);
+diff --git a/module/os/linux/zfs/zpl_ctldir.c b/module/os/linux/zfs/zpl_ctldir.c
+index 98c877db3..b6af9e8a3 100644
+--- a/module/os/linux/zfs/zpl_ctldir.c
++++ b/module/os/linux/zfs/zpl_ctldir.c
+@@ -94,11 +94,11 @@ out:
+ */
+ static int
+ #ifdef HAVE_IDMAP_IOPS_GETATTR
+-zpl_root_getattr_impl(struct mnt_idmap *user_ns,
++zpl_root_getattr_impl(struct mnt_idmap *idmap,
+ const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ #elif defined(HAVE_USERNS_IOPS_GETATTR)
+-zpl_root_getattr_impl(struct user_namespace *user_ns,
++zpl_root_getattr_impl(struct user_namespace *idmap,
+ const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ #else
+@@ -111,13 +111,13 @@ zpl_root_getattr_impl(const struct path *path, struct kstat *stat,
+
+ #if (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
+ #ifdef HAVE_GENERIC_FILLATTR_USERNS
+- generic_fillattr(user_ns, ip, stat);
++ generic_fillattr(idmap, ip, stat);
+ #elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
+- generic_fillattr(user_ns, ip, stat);
++ generic_fillattr(idmap, ip, stat);
+ #elif defined(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK)
+- generic_fillattr(user_ns, request_mask, ip, stat);
++ generic_fillattr(idmap, request_mask, ip, stat);
+ #else
+- (void) user_ns;
++ (void) idmap;
+ #endif
+ #else
+ generic_fillattr(ip, stat);
+@@ -329,11 +329,11 @@ out:
+
+ static int
+ #ifdef HAVE_IOPS_RENAME_USERNS
+-zpl_snapdir_rename(struct user_namespace *user_ns, struct inode *sdip,
++zpl_snapdir_rename(struct user_namespace *idmap, struct inode *sdip,
+ struct dentry *sdentry, struct inode *tdip, struct dentry *tdentry,
+ unsigned int flags)
+ #elif defined(HAVE_IOPS_RENAME_IDMAP)
+-zpl_snapdir_rename(struct mnt_idmap *user_ns, struct inode *sdip,
++zpl_snapdir_rename(struct mnt_idmap *idmap, struct inode *sdip,
+ struct dentry *sdentry, struct inode *tdip, struct dentry *tdentry,
+ unsigned int flags)
+ #else
+@@ -373,15 +373,15 @@ zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry)
+
+ #if defined(HAVE_IOPS_MKDIR_USERNS)
+ static int
+-zpl_snapdir_mkdir(struct user_namespace *user_ns, struct inode *dip,
++zpl_snapdir_mkdir(struct user_namespace *idmap, struct inode *dip,
+ struct dentry *dentry, umode_t mode)
+ #elif defined(HAVE_IOPS_MKDIR_IDMAP)
+ static int
+-zpl_snapdir_mkdir(struct mnt_idmap *user_ns, struct inode *dip,
++zpl_snapdir_mkdir(struct mnt_idmap *idmap, struct inode *dip,
+ struct dentry *dentry, umode_t mode)
+ #elif defined(HAVE_IOPS_MKDIR_DENTRY)
+ static struct dentry *
+-zpl_snapdir_mkdir(struct mnt_idmap *user_ns, struct inode *dip,
++zpl_snapdir_mkdir(struct mnt_idmap *idmap, struct inode *dip,
+ struct dentry *dentry, umode_t mode)
+ #else
+ static int
+@@ -396,7 +396,7 @@ zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
+ crhold(cr);
+ vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
+ #if (defined(HAVE_IOPS_MKDIR_USERNS) || defined(HAVE_IOPS_MKDIR_IDMAP))
+- zpl_vap_init(vap, dip, mode | S_IFDIR, cr, user_ns);
++ zpl_vap_init(vap, dip, mode | S_IFDIR, cr, idmap);
+ #else
+ zpl_vap_init(vap, dip, mode | S_IFDIR, cr, zfs_init_idmap);
+ #endif
+@@ -423,11 +423,11 @@ zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
+ */
+ static int
+ #ifdef HAVE_IDMAP_IOPS_GETATTR
+-zpl_snapdir_getattr_impl(struct mnt_idmap *user_ns,
++zpl_snapdir_getattr_impl(struct mnt_idmap *idmap,
+ const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ #elif defined(HAVE_USERNS_IOPS_GETATTR)
+-zpl_snapdir_getattr_impl(struct user_namespace *user_ns,
++zpl_snapdir_getattr_impl(struct user_namespace *idmap,
+ const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ #else
+@@ -444,13 +444,13 @@ zpl_snapdir_getattr_impl(const struct path *path, struct kstat *stat,
+ return (error);
+ #if (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
+ #ifdef HAVE_GENERIC_FILLATTR_USERNS
+- generic_fillattr(user_ns, ip, stat);
++ generic_fillattr(idmap, ip, stat);
+ #elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
+- generic_fillattr(user_ns, ip, stat);
++ generic_fillattr(idmap, ip, stat);
+ #elif defined(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK)
+- generic_fillattr(user_ns, request_mask, ip, stat);
++ generic_fillattr(idmap, request_mask, ip, stat);
+ #else
+- (void) user_ns;
++ (void) idmap;
+ #endif
+ #else
+ generic_fillattr(ip, stat);
+@@ -569,11 +569,11 @@ out:
+
+ static int
+ #ifdef HAVE_USERNS_IOPS_GETATTR
+-zpl_shares_getattr_impl(struct user_namespace *user_ns,
++zpl_shares_getattr_impl(struct user_namespace *idmap,
+ const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ #elif defined(HAVE_IDMAP_IOPS_GETATTR)
+-zpl_shares_getattr_impl(struct mnt_idmap *user_ns,
++zpl_shares_getattr_impl(struct mnt_idmap *idmap,
+ const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ #else
+@@ -593,13 +593,13 @@ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
+ if (zfsvfs->z_shares_dir == 0) {
+ #if (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
+ #ifdef HAVE_GENERIC_FILLATTR_USERNS
+- generic_fillattr(user_ns, path->dentry->d_inode, stat);
++ generic_fillattr(idmap, path->dentry->d_inode, stat);
+ #elif defined(HAVE_GENERIC_FILLATTR_IDMAP)
+- generic_fillattr(user_ns, path->dentry->d_inode, stat);
++ generic_fillattr(idmap, path->dentry->d_inode, stat);
+ #elif defined(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK)
+- generic_fillattr(user_ns, request_mask, ip, stat);
++ generic_fillattr(idmap, request_mask, ip, stat);
+ #else
+- (void) user_ns;
++ (void) idmap;
+ #endif
+ #else
+ generic_fillattr(path->dentry->d_inode, stat);
+@@ -613,10 +613,10 @@ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
+ error = -zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp);
+ if (error == 0) {
+ #ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
+- error = -zfs_getattr_fast(user_ns, request_mask, ZTOI(dzp),
++ error = -zfs_getattr_fast(idmap, request_mask, ZTOI(dzp),
+ stat);
+ #elif (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
+- error = -zfs_getattr_fast(user_ns, ZTOI(dzp), stat);
++ error = -zfs_getattr_fast(idmap, ZTOI(dzp), stat);
+ #else
+ error = -zfs_getattr_fast(kcred->user_ns, ZTOI(dzp), stat);
+ #endif
+diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c
+index 77419c781..9f98ee6de 100644
+--- a/module/os/linux/zfs/zpl_inode.c
++++ b/module/os/linux/zfs/zpl_inode.c
+@@ -137,12 +137,12 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
+
+ void
+ zpl_vap_init(vattr_t *vap, struct inode *dir, umode_t mode, cred_t *cr,
+- zidmap_t *mnt_ns)
++ zidmap_t *idmap)
+ {
+ vap->va_mask = ATTR_MODE;
+ vap->va_mode = mode;
+
+- vap->va_uid = zfs_vfsuid_to_uid(mnt_ns,
++ vap->va_uid = zfs_vfsuid_to_uid(idmap,
+ zfs_i_user_ns(dir), crgetuid(cr));
+
+ if (dir->i_mode & S_ISGID) {
+@@ -150,7 +150,7 @@ zpl_vap_init(vattr_t *vap, struct inode *dir, umode_t mode, cred_t *cr,
+ if (S_ISDIR(mode))
+ vap->va_mode |= S_ISGID;
+ } else {
+- vap->va_gid = zfs_vfsgid_to_gid(mnt_ns,
++ vap->va_gid = zfs_vfsgid_to_gid(idmap,
+ zfs_i_user_ns(dir), crgetgid(cr));
+ }
+ }
+@@ -167,10 +167,10 @@ is_nametoolong(struct dentry *dentry)
+
+ static int
+ #ifdef HAVE_IOPS_CREATE_USERNS
+-zpl_create(struct user_namespace *user_ns, struct inode *dir,
++zpl_create(struct user_namespace *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode, bool flag)
+ #elif defined(HAVE_IOPS_CREATE_IDMAP)
+-zpl_create(struct mnt_idmap *user_ns, struct inode *dir,
++zpl_create(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode, bool flag)
+ #else
+ zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag)
+@@ -182,7 +182,7 @@ zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag)
+ int error;
+ fstrans_cookie_t cookie;
+ #if !(defined(HAVE_IOPS_CREATE_USERNS) || defined(HAVE_IOPS_CREATE_IDMAP))
+- zidmap_t *user_ns = kcred->user_ns;
++ zidmap_t *idmap = kcred->user_ns;
+ #endif
+
+ if (is_nametoolong(dentry)) {
+@@ -191,11 +191,11 @@ zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag)
+
+ crhold(cr);
+ vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
+- zpl_vap_init(vap, dir, mode, cr, user_ns);
++ zpl_vap_init(vap, dir, mode, cr, idmap);
+
+ cookie = spl_fstrans_mark();
+ error = -zfs_create_idmap(ITOZ(dir), dname(dentry), vap, 0,
+- mode, &zp, cr, 0, NULL, user_ns);
++ mode, &zp, cr, 0, NULL, idmap);
+ if (error == 0) {
+ error = zpl_xattr_security_init(ZTOI(zp), dir, &dentry->d_name);
+ if (error == 0)
+@@ -220,10 +220,10 @@ zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag)
+
+ static int
+ #ifdef HAVE_IOPS_MKNOD_USERNS
+-zpl_mknod(struct user_namespace *user_ns, struct inode *dir,
++zpl_mknod(struct user_namespace *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode,
+ #elif defined(HAVE_IOPS_MKNOD_IDMAP)
+-zpl_mknod(struct mnt_idmap *user_ns, struct inode *dir,
++zpl_mknod(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode,
+ #else
+ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
+@@ -236,7 +236,7 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
+ int error;
+ fstrans_cookie_t cookie;
+ #if !(defined(HAVE_IOPS_MKNOD_USERNS) || defined(HAVE_IOPS_MKNOD_IDMAP))
+- zidmap_t *user_ns = kcred->user_ns;
++ zidmap_t *idmap = kcred->idmap;
+ #endif
+
+ if (is_nametoolong(dentry)) {
+@@ -252,12 +252,12 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
+
+ crhold(cr);
+ vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
+- zpl_vap_init(vap, dir, mode, cr, user_ns);
++ zpl_vap_init(vap, dir, mode, cr, idmap);
+ vap->va_rdev = rdev;
+
+ cookie = spl_fstrans_mark();
+ error = -zfs_create_idmap(ITOZ(dir), dname(dentry), vap, 0,
+- mode, &zp, cr, 0, NULL, user_ns);
++ mode, &zp, cr, 0, NULL, idmap);
+ if (error == 0) {
+ error = zpl_xattr_security_init(ZTOI(zp), dir, &dentry->d_name);
+ if (error == 0)
+@@ -282,14 +282,14 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
+
+ static int
+ #ifdef HAVE_TMPFILE_IDMAP
+-zpl_tmpfile(struct mnt_idmap *userns, struct inode *dir,
++zpl_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
+ struct file *file, umode_t mode)
+ #elif !defined(HAVE_TMPFILE_DENTRY)
+-zpl_tmpfile(struct user_namespace *userns, struct inode *dir,
++zpl_tmpfile(struct user_namespace *idmap, struct inode *dir,
+ struct file *file, umode_t mode)
+ #else
+ #ifdef HAVE_TMPFILE_USERNS
+-zpl_tmpfile(struct user_namespace *userns, struct inode *dir,
++zpl_tmpfile(struct user_namespace *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode)
+ #else
+ zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
+@@ -302,7 +302,7 @@ zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
+ int error;
+ fstrans_cookie_t cookie;
+ #if !(defined(HAVE_TMPFILE_USERNS) || defined(HAVE_TMPFILE_IDMAP))
+- zidmap_t *userns = kcred->user_ns;
++ zidmap_t *idmap = kcred->user_ns;
+ #endif
+
+ crhold(cr);
+@@ -313,10 +313,10 @@ zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
+ */
+ if (!IS_POSIXACL(dir))
+ mode &= ~current_umask();
+- zpl_vap_init(vap, dir, mode, cr, userns);
++ zpl_vap_init(vap, dir, mode, cr, idmap);
+
+ cookie = spl_fstrans_mark();
+- error = -zfs_tmpfile_idmap(dir, vap, 0, mode, &ip, cr, 0, NULL, userns);
++ error = -zfs_tmpfile_idmap(dir, vap, 0, mode, &ip, cr, 0, NULL, idmap);
+ if (error == 0) {
+ /* d_tmpfile will do drop_nlink, so we should set it first */
+ set_nlink(ip, 1);
+@@ -377,15 +377,15 @@ zpl_unlink(struct inode *dir, struct dentry *dentry)
+
+ #if defined(HAVE_IOPS_MKDIR_USERNS)
+ static int
+-zpl_mkdir(struct user_namespace *user_ns, struct inode *dir,
++zpl_mkdir(struct user_namespace *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode)
+ #elif defined(HAVE_IOPS_MKDIR_IDMAP)
+ static int
+-zpl_mkdir(struct mnt_idmap *user_ns, struct inode *dir,
++zpl_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode)
+ #elif defined(HAVE_IOPS_MKDIR_DENTRY)
+ static struct dentry *
+-zpl_mkdir(struct mnt_idmap *user_ns, struct inode *dir,
++zpl_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode)
+ #else
+ static int
+@@ -409,11 +409,11 @@ zpl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
+
+ crhold(cr);
+ vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
+- zpl_vap_init(vap, dir, mode | S_IFDIR, cr, user_ns);
++ zpl_vap_init(vap, dir, mode | S_IFDIR, cr, idmap);
+
+ cookie = spl_fstrans_mark();
+ error = -zfs_mkdir_idmap(ITOZ(dir), dname(dentry), vap, &zp, cr, 0,
+- NULL, user_ns);
++ NULL, idmap);
+ if (error == 0) {
+ error = zpl_xattr_security_init(ZTOI(zp), dir, &dentry->d_name);
+ if (error == 0)
+@@ -469,11 +469,11 @@ zpl_rmdir(struct inode *dir, struct dentry *dentry)
+
+ static int
+ #ifdef HAVE_USERNS_IOPS_GETATTR
+-zpl_getattr_impl(struct user_namespace *user_ns,
++zpl_getattr_impl(struct user_namespace *idmap,
+ const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ #elif defined(HAVE_IDMAP_IOPS_GETATTR)
+-zpl_getattr_impl(struct mnt_idmap *user_ns,
++zpl_getattr_impl(struct mnt_idmap *idmap,
+ const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ #else
+@@ -493,9 +493,9 @@ zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
+ */
+
+ #ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
+- error = -zfs_getattr_fast(user_ns, request_mask, ip, stat);
++ error = -zfs_getattr_fast(idmap, request_mask, ip, stat);
+ #elif (defined(HAVE_USERNS_IOPS_GETATTR) || defined(HAVE_IDMAP_IOPS_GETATTR))
+- error = -zfs_getattr_fast(user_ns, ip, stat);
++ error = -zfs_getattr_fast(idmap, ip, stat);
+ #else
+ error = -zfs_getattr_fast(kcred->user_ns, ip, stat);
+ #endif
+@@ -573,10 +573,10 @@ ZPL_GETATTR_WRAPPER(zpl_getattr);
+
+ static int
+ #ifdef HAVE_USERNS_IOPS_SETATTR
+-zpl_setattr(struct user_namespace *user_ns, struct dentry *dentry,
++zpl_setattr(struct user_namespace *idmap, struct dentry *dentry,
+ struct iattr *ia)
+ #elif defined(HAVE_IDMAP_IOPS_SETATTR)
+-zpl_setattr(struct mnt_idmap *user_ns, struct dentry *dentry,
++zpl_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
+ struct iattr *ia)
+ #else
+ zpl_setattr(struct dentry *dentry, struct iattr *ia)
+@@ -589,9 +589,9 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
+ fstrans_cookie_t cookie;
+
+ #ifdef HAVE_SETATTR_PREPARE_USERNS
+- error = zpl_setattr_prepare(user_ns, dentry, ia);
++ error = zpl_setattr_prepare(idmap, dentry, ia);
+ #elif defined(HAVE_SETATTR_PREPARE_IDMAP)
+- error = zpl_setattr_prepare(user_ns, dentry, ia);
++ error = zpl_setattr_prepare(idmap, dentry, ia);
+ #else
+ error = zpl_setattr_prepare(zfs_init_idmap, dentry, ia);
+ #endif
+@@ -604,14 +604,14 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
+ vap->va_mode = ia->ia_mode;
+ if (ia->ia_valid & ATTR_UID)
+ #ifdef HAVE_IATTR_VFSID
+- vap->va_uid = zfs_vfsuid_to_uid(user_ns, zfs_i_user_ns(ip),
++ vap->va_uid = zfs_vfsuid_to_uid(idmap, zfs_i_user_ns(ip),
+ __vfsuid_val(ia->ia_vfsuid));
+ #else
+ vap->va_uid = KUID_TO_SUID(ia->ia_uid);
+ #endif
+ if (ia->ia_valid & ATTR_GID)
+ #ifdef HAVE_IATTR_VFSID
+- vap->va_gid = zfs_vfsgid_to_gid(user_ns, zfs_i_user_ns(ip),
++ vap->va_gid = zfs_vfsgid_to_gid(idmap, zfs_i_user_ns(ip),
+ __vfsgid_val(ia->ia_vfsgid));
+ #else
+ vap->va_gid = KGID_TO_SGID(ia->ia_gid);
+@@ -627,9 +627,9 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
+
+ cookie = spl_fstrans_mark();
+ #ifdef HAVE_USERNS_IOPS_SETATTR
+- error = -zfs_setattr_idmap(ITOZ(ip), vap, 0, cr, user_ns);
++ error = -zfs_setattr_idmap(ITOZ(ip), vap, 0, cr, idmap);
+ #elif defined(HAVE_IDMAP_IOPS_SETATTR)
+- error = -zfs_setattr_idmap(ITOZ(ip), vap, 0, cr, user_ns);
++ error = -zfs_setattr_idmap(ITOZ(ip), vap, 0, cr, idmap);
+ #else
+ error = -zfs_setattr(ITOZ(ip), vap, 0, cr);
+ #endif
+@@ -646,11 +646,11 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
+
+ static int
+ #ifdef HAVE_IOPS_RENAME_USERNS
+-zpl_rename(struct user_namespace *user_ns, struct inode *sdip,
++zpl_rename(struct user_namespace *idmap, struct inode *sdip,
+ struct dentry *sdentry, struct inode *tdip, struct dentry *tdentry,
+ unsigned int rflags)
+ #elif defined(HAVE_IOPS_RENAME_IDMAP)
+-zpl_rename(struct mnt_idmap *user_ns, struct inode *sdip,
++zpl_rename(struct mnt_idmap *idmap, struct inode *sdip,
+ struct dentry *sdentry, struct inode *tdip, struct dentry *tdentry,
+ unsigned int rflags)
+ #else
+@@ -663,7 +663,7 @@ zpl_rename(struct inode *sdip, struct dentry *sdentry,
+ int error;
+ fstrans_cookie_t cookie;
+ #if !(defined(HAVE_IOPS_RENAME_USERNS) || defined(HAVE_IOPS_RENAME_IDMAP))
+- zidmap_t *user_ns = kcred->user_ns;
++ zidmap_t *idmap = kcred->user_ns;
+ #endif
+
+ if (is_nametoolong(tdentry)) {
+@@ -673,13 +673,13 @@ zpl_rename(struct inode *sdip, struct dentry *sdentry,
+ crhold(cr);
+ if (rflags & RENAME_WHITEOUT) {
+ wo_vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
+- zpl_vap_init(wo_vap, sdip, S_IFCHR, cr, user_ns);
++ zpl_vap_init(wo_vap, sdip, S_IFCHR, cr, idmap);
+ wo_vap->va_rdev = makedevice(0, 0);
+ }
+
+ cookie = spl_fstrans_mark();
+ error = -zfs_rename_idmap(ITOZ(sdip), dname(sdentry), ITOZ(tdip),
+- dname(tdentry), cr, 0, rflags, wo_vap, user_ns);
++ dname(tdentry), cr, 0, rflags, wo_vap, idmap);
+ spl_fstrans_unmark(cookie);
+ if (wo_vap)
+ kmem_free(wo_vap, sizeof (vattr_t));
+@@ -691,10 +691,10 @@ zpl_rename(struct inode *sdip, struct dentry *sdentry,
+
+ static int
+ #ifdef HAVE_IOPS_SYMLINK_USERNS
+-zpl_symlink(struct user_namespace *user_ns, struct inode *dir,
++zpl_symlink(struct user_namespace *idmap, struct inode *dir,
+ struct dentry *dentry, const char *name)
+ #elif defined(HAVE_IOPS_SYMLINK_IDMAP)
+-zpl_symlink(struct mnt_idmap *user_ns, struct inode *dir,
++zpl_symlink(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, const char *name)
+ #else
+ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
+@@ -706,7 +706,7 @@ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
+ int error;
+ fstrans_cookie_t cookie;
+ #if !(defined(HAVE_IOPS_SYMLINK_USERNS) || defined(HAVE_IOPS_SYMLINK_IDMAP))
+- zidmap_t *user_ns = kcred->user_ns;
++ zidmap_t *idmap = kcred->user_ns;
+ #endif
+
+ if (is_nametoolong(dentry)) {
+@@ -715,11 +715,11 @@ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
+
+ crhold(cr);
+ vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
+- zpl_vap_init(vap, dir, S_IFLNK | S_IRWXUGO, cr, user_ns);
++ zpl_vap_init(vap, dir, S_IFLNK | S_IRWXUGO, cr, idmap);
+
+ cookie = spl_fstrans_mark();
+ error = -zfs_symlink_idmap(ITOZ(dir), dname(dentry), vap,
+- (char *)name, &zp, cr, 0, user_ns);
++ (char *)name, &zp, cr, 0, idmap);
+ if (error == 0) {
+ error = zpl_xattr_security_init(ZTOI(zp), dir, &dentry->d_name);
+ if (error) {
+diff --git a/module/os/linux/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c
+index 8ae6ed1f5..512d554b8 100644
+--- a/module/os/linux/zfs/zpl_xattr.c
++++ b/module/os/linux/zfs/zpl_xattr.c
+@@ -766,11 +766,11 @@ __zpl_xattr_user_get(struct inode *ip, const char *name,
+ ZPL_XATTR_GET_WRAPPER(zpl_xattr_user_get);
+
+ static int
+-__zpl_xattr_user_set(zidmap_t *user_ns,
++__zpl_xattr_user_set(zidmap_t *idmap,
+ struct inode *ip, const char *name,
+ const void *value, size_t size, int flags)
+ {
+- (void) user_ns;
++ (void) idmap;
+ int error = 0;
+ /* xattr_resolve_name will do this for us if this is defined */
+ if (ZFS_XA_NS_PREFIX_FORBIDDEN(name))
+@@ -869,11 +869,11 @@ __zpl_xattr_trusted_get(struct inode *ip, const char *name,
+ ZPL_XATTR_GET_WRAPPER(zpl_xattr_trusted_get);
+
+ static int
+-__zpl_xattr_trusted_set(zidmap_t *user_ns,
++__zpl_xattr_trusted_set(zidmap_t *idmap,
+ struct inode *ip, const char *name,
+ const void *value, size_t size, int flags)
+ {
+- (void) user_ns;
++ (void) idmap;
+ char xattr_name[XATTR_NAME_MAX + 1];
+
+ if (!capable(CAP_SYS_ADMIN))
+@@ -929,11 +929,11 @@ __zpl_xattr_security_get(struct inode *ip, const char *name,
+ ZPL_XATTR_GET_WRAPPER(zpl_xattr_security_get);
+
+ static int
+-__zpl_xattr_security_set(zidmap_t *user_ns,
++__zpl_xattr_security_set(zidmap_t *idmap,
+ struct inode *ip, const char *name,
+ const void *value, size_t size, int flags)
+ {
+- (void) user_ns;
++ (void) idmap;
+ char xattr_name[XATTR_NAME_MAX + 1];
+
+ zpl_xattr_join_name(xattr_name, sizeof (xattr_name),
+@@ -1259,7 +1259,7 @@ __zpl_xattr_acl_get_default(struct inode *ip, const char *name,
+ ZPL_XATTR_GET_WRAPPER(zpl_xattr_acl_get_default);
+
+ static int
+-__zpl_xattr_acl_set_access(zidmap_t *mnt_ns,
++__zpl_xattr_acl_set_access(zidmap_t *idmap,
+ struct inode *ip, const char *name,
+ const void *value, size_t size, int flags)
+ {
+@@ -1271,10 +1271,10 @@ __zpl_xattr_acl_set_access(zidmap_t *mnt_ns,
+ return (-EOPNOTSUPP);
+
+ #if defined(HAVE_XATTR_SET_USERNS) || defined(HAVE_XATTR_SET_IDMAP)
+- if (!zpl_inode_owner_or_capable(mnt_ns, ip))
++ if (!zpl_inode_owner_or_capable(idmap, ip))
+ return (-EPERM);
+ #else
+- (void) mnt_ns;
++ (void) idmap;
+ if (!zpl_inode_owner_or_capable(zfs_init_idmap, ip))
+ return (-EPERM);
+ #endif
+@@ -1301,7 +1301,7 @@ __zpl_xattr_acl_set_access(zidmap_t *mnt_ns,
+ ZPL_XATTR_SET_WRAPPER(zpl_xattr_acl_set_access);
+
+ static int
+-__zpl_xattr_acl_set_default(zidmap_t *mnt_ns,
++__zpl_xattr_acl_set_default(zidmap_t *idmap,
+ struct inode *ip, const char *name,
+ const void *value, size_t size, int flags)
+ {
+@@ -1313,10 +1313,10 @@ __zpl_xattr_acl_set_default(zidmap_t *mnt_ns,
+ return (-EOPNOTSUPP);
+
+ #if defined(HAVE_XATTR_SET_USERNS) || defined(HAVE_XATTR_SET_IDMAP)
+- if (!zpl_inode_owner_or_capable(mnt_ns, ip))
++ if (!zpl_inode_owner_or_capable(idmap, ip))
+ return (-EPERM);
+ #else
+- (void) mnt_ns;
++ (void) idmap;
+ if (!zpl_inode_owner_or_capable(zfs_init_idmap, ip))
+ return (-EPERM);
+ #endif
+--
+2.56.0
+
diff --git a/0003-spl-cred-move-remaining-idmap-compat-use-generic-che.patch b/0003-spl-cred-move-remaining-idmap-compat-use-generic-che.patch
new file mode 100644
index 0000000..01deed5
--- /dev/null
+++ b/0003-spl-cred-move-remaining-idmap-compat-use-generic-che.patch
@@ -0,0 +1,139 @@
+From 0a3241f5960e7e37848acbb250419e4d5bd8bad6 Mon Sep 17 00:00:00 2001
+From: Rob Norris <rob.norris at truenas.com>
+Date: Thu, 2 Jul 2026 21:13:16 +1000
+Subject: [PATCH 003/616] spl/cred: move remaining idmap compat, use generic
+ checks
+
+Move the remaining idmap/cred checks from sys/types.h to sys/cred.h, the
+only direct user, and change them to use the generic macros.
+
+These should be folded back into idmap_compat at some point but they
+need careful auditing first.
+
+Sponsored-by: TrueNAS
+Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
+Signed-off-by: Rob Norris <rob.norris at truenas.com>
+Closes #18769
+---
+ include/os/linux/spl/sys/cred.h | 29 +++++++++++++++++++++++++----
+ include/os/linux/spl/sys/types.h | 22 ----------------------
+ module/os/linux/spl/spl-cred.c | 2 +-
+ 3 files changed, 26 insertions(+), 27 deletions(-)
+
+diff --git a/include/os/linux/spl/sys/cred.h b/include/os/linux/spl/sys/cred.h
+index 3c033143a..85ffa0217 100644
+--- a/include/os/linux/spl/sys/cred.h
++++ b/include/os/linux/spl/sys/cred.h
+@@ -50,6 +50,27 @@ extern struct task_struct init_task;
+ #define SGID_TO_KGID(x) (KGIDT_INIT(x))
+ #define KGIDP_TO_SGIDP(x) (&(x)->val)
+
++#ifdef HAVE_IDMAP_MNTIDMAP
++#include <linux/refcount.h>
++#ifdef HAVE_IDMAP_NO_USERNS
++#include <linux/user_namespace.h>
++struct mnt_idmap {
++ struct uid_gid_map uid_map;
++ struct uid_gid_map gid_map;
++ refcount_t count;
++};
++#define idmap_owner(p) (NULL)
++#else
++struct mnt_idmap {
++ struct user_namespace *owner;
++ refcount_t count;
++};
++#define idmap_owner(p) (((struct mnt_idmap *)p)->owner)
++#endif
++#else
++#define idmap_owner(p) ((struct user_namespace *)p)
++#endif
++
+ extern zidmap_t *zfs_get_init_idmap(void);
+
+ /* Check if the user ns is the initial one */
+@@ -79,7 +100,7 @@ static inline uid_t zfs_uid_to_vfsuid(zidmap_t *idmap,
+ struct user_namespace *fs_userns, uid_t uid)
+ {
+ struct user_namespace *owner;
+-#ifdef HAVE_IOPS_CREATE_IDMAP
++#ifdef HAVE_IDMAP_MNTIDMAP
+ if (mnt_userns == zfs_init_idmap)
+ return (uid);
+ #endif
+@@ -103,7 +124,7 @@ static inline gid_t zfs_gid_to_vfsgid(zidmap_t *idmap,
+ struct user_namespace *fs_userns, gid_t gid)
+ {
+ struct user_namespace *owner;
+-#ifdef HAVE_IOPS_CREATE_IDMAP
++#ifdef HAVE_IDMAP_MNTIDMAP
+ if (mnt_userns == zfs_init_idmap)
+ return (gid);
+ #endif
+@@ -127,7 +148,7 @@ static inline uid_t zfs_vfsuid_to_uid(zidmap_t *idmap,
+ struct user_namespace *fs_userns, uid_t uid)
+ {
+ struct user_namespace *owner;
+-#ifdef HAVE_IOPS_CREATE_IDMAP
++#ifdef HAVE_IDMAP_MNTIDMAP
+ if (mnt_userns == zfs_init_idmap)
+ return (uid);
+ #endif
+@@ -152,7 +173,7 @@ static inline gid_t zfs_vfsgid_to_gid(zidmap_t *idmap,
+ struct user_namespace *fs_userns, gid_t gid)
+ {
+ struct user_namespace *owner;
+-#ifdef HAVE_IOPS_CREATE_IDMAP
++#ifdef HAVE_IDMAP_MNTIDMAP
+ if (mnt_userns == zfs_init_idmap)
+ return (gid);
+ #endif
+diff --git a/include/os/linux/spl/sys/types.h b/include/os/linux/spl/sys/types.h
+index 09aa6f416..650f06c1a 100644
+--- a/include/os/linux/spl/sys/types.h
++++ b/include/os/linux/spl/sys/types.h
+@@ -57,28 +57,6 @@ typedef ulong_t pgcnt_t;
+ typedef int major_t;
+ typedef int minor_t;
+
+-struct user_namespace;
+-#ifdef HAVE_IOPS_CREATE_IDMAP
+-#include <linux/refcount.h>
+-#ifdef HAVE_IDMAP_NO_USERNS
+-#include <linux/user_namespace.h>
+-struct mnt_idmap {
+- struct uid_gid_map uid_map;
+- struct uid_gid_map gid_map;
+- refcount_t count;
+-};
+-#define idmap_owner(p) (NULL)
+-#else
+-struct mnt_idmap {
+- struct user_namespace *owner;
+- refcount_t count;
+-};
+-#define idmap_owner(p) (((struct mnt_idmap *)p)->owner)
+-#endif
+-#else
+-#define idmap_owner(p) ((struct user_namespace *)p)
+-#endif
+-
+ #ifdef HAVE_1ARG_ASSIGN_STR
+ #define __assign_str_impl(a, b) __assign_str(a)
+ #else
+diff --git a/module/os/linux/spl/spl-cred.c b/module/os/linux/spl/spl-cred.c
+index 3a9db725c..db745a6fa 100644
+--- a/module/os/linux/spl/spl-cred.c
++++ b/module/os/linux/spl/spl-cred.c
+@@ -133,7 +133,7 @@ crgetgid(const cred_t *cr)
+ zidmap_t *
+ zfs_get_init_idmap(void)
+ {
+-#ifdef HAVE_IOPS_CREATE_IDMAP
++#ifdef HAVE_IDMAP_MNTIDMAP
+ return ((zidmap_t *)&nop_mnt_idmap);
+ #else
+ return ((zidmap_t *)&init_user_ns);
+--
+2.56.0
+
diff --git a/0004-Linux-7.3-bvec_iter.bi_bvec_done-is-now-bi_offset.patch b/0004-Linux-7.3-bvec_iter.bi_bvec_done-is-now-bi_offset.patch
new file mode 100644
index 0000000..9ca2720
--- /dev/null
+++ b/0004-Linux-7.3-bvec_iter.bi_bvec_done-is-now-bi_offset.patch
@@ -0,0 +1,84 @@
+From d966f3dd8c2e4eb04e52227b7a87f5828924f89c Mon Sep 17 00:00:00 2001
+From: Rob Norris <rob.norris at truenas.com>
+Date: Sat, 15 Aug 2026 12:58:45 +1000
+Subject: [PATCH 001/346] Linux 7.3: bvec_iter.bi_bvec_done is now bi_offset
+
+Sponsored-by: TrueNAS
+Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
+Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
+Co-developed-by: TheAlmightyOgreLord <beardedtechwizard at protonmail.com>
+Signed-off-by: Rob Norris <rob.norris at truenas.com>
+Closes #19082
+---
+ config/kernel-bio.m4 | 26 +++++++++++++++++++
+ include/os/linux/kernel/linux/blkdev_compat.h | 4 +++
+ 2 files changed, 30 insertions(+)
+
+diff --git a/config/kernel-bio.m4 b/config/kernel-bio.m4
+index 099b11eff..305d3ccd6 100644
+--- a/config/kernel-bio.m4
++++ b/config/kernel-bio.m4
+@@ -234,6 +234,30 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO_ALLOC_4ARG], [
+ ])
+ ])
+
++dnl #
++dnl # Linux 7.3 API
++dnl #
++dnl # bi_iter.bi_bvec_done renamed to bi_iter.bi_offset
++dnl #
++AC_DEFUN([ZFS_AC_KERNEL_SRC_BVEC_ITER_OFFSET], [
++ ZFS_LINUX_TEST_SRC([bvec_iter_offset], [
++ #include <linux/bio.h>
++ ],[
++ struct bvec_iter *bi = NULL;
++ unsigned int __attribute__((unused)) offset = bi->bi_offset;
++ ])
++])
++
++AC_DEFUN([ZFS_AC_KERNEL_BVEC_ITER_OFFSET], [
++ AC_MSG_CHECKING([if bvec_iter has bi_offset])
++ ZFS_LINUX_TEST_RESULT([bvec_iter_offset],[
++ AC_MSG_RESULT(yes)
++ AC_DEFINE([HAVE_BVEC_ITER_OFFSET], 1, [bvec_iter has bi_offset])
++ ],[
++ AC_MSG_RESULT(no)
++ ])
++])
++
+ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
+ ZFS_AC_KERNEL_SRC_BIO_OPS
+ ZFS_AC_KERNEL_SRC_BIO_SET_DEV
+@@ -243,6 +267,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [
+ ZFS_AC_KERNEL_SRC_BDEV_SUBMIT_BIO_RETURNS_VOID
+ ZFS_AC_KERNEL_SRC_BIO_SET_DEV_MACRO
+ ZFS_AC_KERNEL_SRC_BIO_ALLOC_4ARG
++ ZFS_AC_KERNEL_SRC_BVEC_ITER_OFFSET
+ ])
+
+ AC_DEFUN([ZFS_AC_KERNEL_BIO], [
+@@ -253,4 +278,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO], [
+ ZFS_AC_KERNEL_BIO_BDEV_DISK
+ ZFS_AC_KERNEL_BDEV_SUBMIT_BIO_RETURNS_VOID
+ ZFS_AC_KERNEL_BIO_ALLOC_4ARG
++ ZFS_AC_KERNEL_BVEC_ITER_OFFSET
+ ])
+diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h
+index 8cd486e18..5b116f330 100644
+--- a/include/os/linux/kernel/linux/blkdev_compat.h
++++ b/include/os/linux/kernel/linux/blkdev_compat.h
+@@ -103,7 +103,11 @@ blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages)
+ #define BIO_BI_SECTOR(bio) (bio)->bi_iter.bi_sector
+ #define BIO_BI_SIZE(bio) (bio)->bi_iter.bi_size
+ #define BIO_BI_IDX(bio) (bio)->bi_iter.bi_idx
++#ifdef HAVE_BVEC_ITER_OFFSET
++#define BIO_BI_SKIP(bio) (bio)->bi_iter.bi_offset
++#else
+ #define BIO_BI_SKIP(bio) (bio)->bi_iter.bi_bvec_done
++#endif
+ #define bio_for_each_segment4(bv, bvp, b, i) \
+ bio_for_each_segment((bv), (b), (i))
+ typedef struct bvec_iter bvec_iterator_t;
+--
+2.56.0
+
diff --git a/0005-Linux-use-cpu_feature_enabled-instead-of-static_cpu_.patch b/0005-Linux-use-cpu_feature_enabled-instead-of-static_cpu_.patch
new file mode 100644
index 0000000..53c2680
--- /dev/null
+++ b/0005-Linux-use-cpu_feature_enabled-instead-of-static_cpu_.patch
@@ -0,0 +1,101 @@
+From 315bc75afc18f548df3b738b69bfaad7cff094ad Mon Sep 17 00:00:00 2001
+From: Rob Norris <rob.norris at truenas.com>
+Date: Sat, 15 Aug 2026 13:27:50 +1000
+Subject: [PATCH 002/346] Linux: use cpu_feature_enabled() instead of
+ static_cpu_has()
+
+static_cpu_has() was renamed in 7.3 because since 3.18
+cpu_feature_enabled() has always been the "right" way to do the same
+thing. So we just switch everything over.
+
+Sponsored-by: TrueNAS
+Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
+Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
+Co-developed-by: TheAlmightyOgreLord <beardedtechwizard at protonmail.com>
+Signed-off-by: Rob Norris <rob.norris at truenas.com>
+Closes #19082
+---
+ include/os/linux/kernel/linux/simd_x86.h | 14 +++++++-------
+ module/zcommon/simd_stat.c | 8 ++++----
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/include/os/linux/kernel/linux/simd_x86.h b/include/os/linux/kernel/linux/simd_x86.h
+index 9016117c9..ebb4dd94b 100644
+--- a/include/os/linux/kernel/linux/simd_x86.h
++++ b/include/os/linux/kernel/linux/simd_x86.h
+@@ -306,24 +306,24 @@ kfpu_begin(void)
+ */
+ uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()];
+ #if defined(HAVE_XSAVES)
+- if (static_cpu_has(X86_FEATURE_XSAVES)) {
++ if (cpu_feature_enabled(X86_FEATURE_XSAVES)) {
+ kfpu_do_xsave("xsaves", state, ~XFEATURE_MASK_XTILE);
+ return;
+ }
+ #endif
+ #if defined(HAVE_XSAVEOPT)
+- if (static_cpu_has(X86_FEATURE_XSAVEOPT)) {
++ if (cpu_feature_enabled(X86_FEATURE_XSAVEOPT)) {
+ kfpu_do_xsave("xsaveopt", state, ~XFEATURE_MASK_XTILE);
+ return;
+ }
+ #endif
+ #if defined(HAVE_XSAVE)
+- if (static_cpu_has(X86_FEATURE_XSAVE)) {
++ if (cpu_feature_enabled(X86_FEATURE_XSAVE)) {
+ kfpu_do_xsave("xsave", state, ~XFEATURE_MASK_XTILE);
+ return;
+ }
+ #endif
+- if (static_cpu_has(X86_FEATURE_FXSR)) {
++ if (cpu_feature_enabled(X86_FEATURE_FXSR)) {
+ kfpu_save_fxsr(state);
+ } else {
+ kfpu_save_fsave(state);
+@@ -371,18 +371,18 @@ kfpu_end(void)
+ {
+ uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()];
+ #if defined(HAVE_XSAVES)
+- if (static_cpu_has(X86_FEATURE_XSAVES)) {
++ if (cpu_feature_enabled(X86_FEATURE_XSAVES)) {
+ kfpu_do_xrstor("xrstors", state, ~XFEATURE_MASK_XTILE);
+ goto out;
+ }
+ #endif
+ #if defined(HAVE_XSAVE)
+- if (static_cpu_has(X86_FEATURE_XSAVE)) {
++ if (cpu_feature_enabled(X86_FEATURE_XSAVE)) {
+ kfpu_do_xrstor("xrstor", state, ~XFEATURE_MASK_XTILE);
+ goto out;
+ }
+ #endif
+- if (static_cpu_has(X86_FEATURE_FXSR)) {
++ if (cpu_feature_enabled(X86_FEATURE_FXSR)) {
+ kfpu_restore_fxsr(state);
+ } else {
+ kfpu_restore_fsave(state);
+diff --git a/module/zcommon/simd_stat.c b/module/zcommon/simd_stat.c
+index 58b2c1501..d19150a26 100644
+--- a/module/zcommon/simd_stat.c
++++ b/module/zcommon/simd_stat.c
+@@ -118,13 +118,13 @@ simd_stat_kstat_data(char *buf, size_t size, void *data)
+ off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
+ "osxsave", boot_cpu_has(X86_FEATURE_OSXSAVE));
+ off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
+- "xsaves", static_cpu_has(X86_FEATURE_XSAVES));
++ "xsaves", cpu_feature_enabled(X86_FEATURE_XSAVES));
+ off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
+- "xsaveopt", static_cpu_has(X86_FEATURE_XSAVEOPT));
++ "xsaveopt", cpu_feature_enabled(X86_FEATURE_XSAVEOPT));
+ off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
+- "xsave", static_cpu_has(X86_FEATURE_XSAVE));
++ "xsave", cpu_feature_enabled(X86_FEATURE_XSAVE));
+ off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
+- "fxsr", static_cpu_has(X86_FEATURE_FXSR));
++ "fxsr", cpu_feature_enabled(X86_FEATURE_FXSR));
+ #endif /* __x86__ */
+ #if defined(__arm__) || defined(__aarch64__)
+ off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
+--
+2.56.0
+
diff --git a/0006-Linux-7.3-inode_operations.create-dropped-flag-arg.patch b/0006-Linux-7.3-inode_operations.create-dropped-flag-arg.patch
new file mode 100644
index 0000000..2fa1c7f
--- /dev/null
+++ b/0006-Linux-7.3-inode_operations.create-dropped-flag-arg.patch
@@ -0,0 +1,92 @@
+From 6e2fa4bc87c35086ce36a4022cfa2b4212518eab Mon Sep 17 00:00:00 2001
+From: Rob Norris <rob.norris at truenas.com>
+Date: Sun, 16 Aug 2026 09:14:34 +1000
+Subject: [PATCH 003/346] Linux 7.3: inode_operations.create dropped flag arg
+
+Sponsored-by: TrueNAS
+Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
+Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
+Co-developed-by: TheAlmightyOgreLord <beardedtechwizard at protonmail.com>
+Signed-off-by: Rob Norris <rob.norris at truenas.com>
+Closes #19082
+---
+ config/kernel-inode-create.m4 | 34 +++++++++++++++++++++++++++++++++
+ config/kernel.m4 | 2 ++
+ module/os/linux/zfs/zpl_inode.c | 5 +++++
+ 3 files changed, 41 insertions(+)
+ create mode 100644 config/kernel-inode-create.m4
+
+diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c
+index 7e701eca9..0c36b7a3b 100644
+--- a/module/os/linux/zfs/zpl_inode.c
++++ b/module/os/linux/zfs/zpl_inode.c
+@@ -155,7 +155,11 @@ is_nametoolong(struct dentry *dentry)
+ zpl_create(struct mnt_idmap *user_ns, struct inode *dir,
+ struct dentry *dentry, umode_t mode, bool flag)
+ #else
++#ifdef HAVE_IOPS_CREATE_NO_FLAG_ARG
++zpl_create(struct mnt_idmap *user_ns, struct inode *dir, struct dentry *dentry, umode_t mode)
++#else
+ zpl_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool flag)
++#endif
+ #endif
+ {
+ cred_t *cr = CRED();
+@@ -184,7 +184,7 @@
+ vattr_t *vap;
+ int error;
+ fstrans_cookie_t cookie;
+-#if !(defined(HAVE_IOPS_CREATE_USERNS) || defined(HAVE_IOPS_CREATE_IDMAP))
++#if !(defined(HAVE_IOPS_CREATE_USERNS) || defined(HAVE_IOPS_CREATE_IDMAP) || defined(HAVE_IOPS_CREATE_NO_FLAG_ARG))
+ zidmap_t *user_ns = kcred->user_ns;
+ #endif
+
+--
+2.56.0
+
+--- zfs-2.4.4/config/kernel-inode-create.m4.orig 2026-08-21 22:46:48.806974550 +0200
++++ zfs-2.4.4/config/kernel-inode-create.m4 2026-10-25 15:44:08.086404502 +0100
+@@ -1,5 +1,23 @@
+ dnl # SPDX-License-Identifier: CDDL-1.0
+ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
++ dnl # 7.3 API change.
++ dnl #
++ dnl # inode_operations->create drops flag arg. We test for the mnt_idmap
++ dnl # version without the flag arg, to avoid have to test for all the
++ dnl # idmap/userns variants back to before 5.12 (see kernel-idmap.m4).
++ dnl #
++ ZFS_LINUX_TEST_SRC([iops_create_no_flag], [
++ #include <linux/fs.h>
++
++ static int test_iops_create(struct mnt_idmap *idmap,
++ struct inode *inode, struct dentry *dentry,
++ umode_t mode) { return 0; }
++
++ static const struct inode_operations test_iops
++ __attribute__ ((unused)) = {
++ .create = test_iops_create
++ };
++ ],[])
+ dnl #
+ dnl # 6.3 API change
+ dnl # The first arg is changed to struct mnt_idmap *
+@@ -74,7 +92,18 @@
+ ZFS_LINUX_TEST_RESULT([create_flags], [
+ AC_MSG_RESULT(yes)
+ ],[
+- ZFS_LINUX_TEST_ERROR([iops->create()])
++ AC_MSG_RESULT(no)
++
++ AC_MSG_CHECKING([whether iops->create() takes a flag arg])
++ ZFS_LINUX_TEST_RESULT([iops_create_no_flag], [
++ AC_MSG_RESULT(no)
++ AC_DEFINE(HAVE_IOPS_CREATE_NO_FLAG_ARG, 1,
++ [iops->create() does not take a flag arg])
++ ],[
++ AC_MSG_RESULT(yes)
++ ],[
++ ZFS_LINUX_TEST_ERROR([iops->create()])
++ ])
+ ])
+ ])
+ ])
diff --git a/0007-Linux-7.3-make-host-filesystem-available-to-kernel-t.patch b/0007-Linux-7.3-make-host-filesystem-available-to-kernel-t.patch
new file mode 100644
index 0000000..cdf1f86
--- /dev/null
+++ b/0007-Linux-7.3-make-host-filesystem-available-to-kernel-t.patch
@@ -0,0 +1,147 @@
+From cd3699d308e1b37dcdd0d5a9a8c3624deb5fc3e9 Mon Sep 17 00:00:00 2001
+From: Rob Norris <rob.norris at truenas.com>
+Date: Tue, 8 Sep 2026 10:24:30 +1000
+Subject: [PATCH 004/346] Linux 7.3: make host filesystem available to kernel
+ threads
+
+Every kernel task has a `struct fs_struct *fs` that points to the root
+of the filesystem tree for this task, and is used as the starting point
+for path resolution. This is what is modified by chroot(2),
+pivot_root(2), etc.
+
+Kernel threads (as spawned by kthreadd) used to get a pointer to the
+root filesystem by default. In 7.3 this changed, and kernel threads now
+get a pointer to an internal nullfs; effectively a "no-op" filesystem
+with no path into the true filesystem. An opt-in mechanism is provided
+in the form of `scoped_with_init_fs()`, which swaps in a a pointer to
+the root filesystem for the scoped code, and reverts it at end of scope.
+
+Currently we don't have any good notion of whether or not a given thread
+(including taskq tasks) will require filesystem access, and no good way
+to signal it anyway. For now, to maintain the status quo, we add
+`scoped_with_init_fs()` in the two places where arbitrary code may run
+on a kernel thread: in `thread_generic_wrapper()`, the startup
+trampoline for `thread_create()`, and in `taskq_thread()`, when calling
+a task entry. This ensures all SPL-managed threads and tasks retain
+filesystem access.
+
+For older kernels that do not have `scoped_with_init_fs()`, a compat
+wrapper is provided (a much grander description than it deserves).
+
+Sponsored-by: TrueNAS
+Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
+Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
+Co-developed-by: TheAlmightyOgreLord <beardedtechwizard at protonmail.com>
+Signed-off-by: Rob Norris <rob.norris at truenas.com>
+Closes #19082
+---
+ include/os/linux/Makefile.am | 1 +
+ .../os/linux/kernel/linux/kthread_compat.h | 35 +++++++++++++++++++
+ module/os/linux/spl/spl-taskq.c | 4 ++-
+ module/os/linux/spl/spl-thread.c | 7 ++--
+ 4 files changed, 44 insertions(+), 3 deletions(-)
+ create mode 100644 include/os/linux/kernel/linux/kthread_compat.h
+
+diff --git a/include/os/linux/Makefile.am b/include/os/linux/Makefile.am
+index 3844bf87e..d2f182795 100644
+--- a/include/os/linux/Makefile.am
++++ b/include/os/linux/Makefile.am
+@@ -7,6 +7,7 @@ kernel_linux_HEADERS = \
+ %D%/kernel/linux/dcache_compat.h \
+ %D%/kernel/linux/idmap_compat.h \
+ %D%/kernel/linux/kmap_compat.h \
++ %D%/kernel/linux/kthread_compat.h \
+ %D%/kernel/linux/mm_compat.h \
+ %D%/kernel/linux/mod_compat.h \
+ %D%/kernel/linux/page_compat.h \
+diff --git a/include/os/linux/kernel/linux/kthread_compat.h b/include/os/linux/kernel/linux/kthread_compat.h
+new file mode 100644
+index 000000000..f68fc9f09
+--- /dev/null
++++ b/include/os/linux/kernel/linux/kthread_compat.h
+@@ -0,0 +1,35 @@
++// SPDX-License-Identifier: CDDL-1.0
++/*
++ * This file and its contents are supplied under the terms of the
++ * Common Development and Distribution License ("CDDL"), version 1.0.
++ * You may only use this file in accordance with the terms of version
++ * 1.0 of the CDDL.
++ *
++ * A full copy of the text of the CDDL should have accompanied this
++ * source. A copy of the CDDL is also available via the Internet at
++ * https://opensource.org/license/CDDL-1.0.
++ */
++
++/*
++ * Copyright (c) 2026, TrueNAS.
++ */
++
++#ifndef _ZFS_KTHREAD_COMPAT_H
++#define _ZFS_KTHREAD_COMPAT_H
++
++#include <linux/fs_struct.h>
++
++/*
++ * Linux 7.3 change. Kernel-internal threads no longer have access to the
++ * filesystem by default. Callers that need it should wrap the necessary code
++ * in `scoped_with_init_fs()`, which will make the filesystem availble until
++ * end of scope.
++ *
++ * For older kernels that do not provide this macro, we define it to be a
++ * no-op.
++ */
++#ifndef scoped_with_init_fs
++#define scoped_with_init_fs() if (1)
++#endif
++
++#endif
+diff --git a/module/os/linux/spl/spl-taskq.c b/module/os/linux/spl/spl-taskq.c
+index c0d654e0d..11e25c827 100644
+--- a/module/os/linux/spl/spl-taskq.c
++++ b/module/os/linux/spl/spl-taskq.c
+@@ -37,6 +37,7 @@
+ #include <sys/kstat.h>
+ #include <linux/cpuhotplug.h>
+ #include <linux/mod_compat.h>
++#include <linux/kthread_compat.h>
+
+ /* Linux 6.2 renamed timer_delete_sync(); point it at its old name for those. */
+ #ifndef HAVE_TIMER_DELETE_SYNC
+@@ -1095,7 +1096,8 @@ taskq_thread(void *args)
+ DTRACE_PROBE1(taskq_ent__start, taskq_ent_t *, t);
+
+ /* Perform the requested task */
+- t->tqent_func(t->tqent_arg);
++ scoped_with_init_fs()
++ t->tqent_func(t->tqent_arg);
+
+ DTRACE_PROBE1(taskq_ent__finish, taskq_ent_t *, t);
+
+diff --git a/module/os/linux/spl/spl-thread.c b/module/os/linux/spl/spl-thread.c
+index 8f5c73b13..c63bf4580 100644
+--- a/module/os/linux/spl/spl-thread.c
++++ b/module/os/linux/spl/spl-thread.c
+@@ -29,6 +29,7 @@
+ #include <sys/tsd.h>
+ #include <sys/string.h>
+ #include <sys/misc.h>
++#include <linux/kthread_compat.h>
+
+ /*
+ * Thread interfaces
+@@ -59,8 +60,10 @@ thread_generic_wrapper(void *arg)
+ kmem_free(tp->tp_name, tp->tp_name_size);
+ kmem_free(tp, sizeof (thread_priv_t));
+
+- if (func)
+- func(args);
++ if (func) {
++ scoped_with_init_fs()
++ func(args);
++ }
+
+ return (0);
+ }
+--
+2.56.0
+
diff --git a/kernel-7.3.patch b/kernel-7.3.patch
new file mode 100644
index 0000000..b0f3722
--- /dev/null
+++ b/kernel-7.3.patch
@@ -0,0 +1,9 @@
+--- zfs-2.4.4/META~ 2026-08-21 23:05:57.000000000 +0200
++++ zfs-2.4.4/META 2026-10-25 15:59:07.300510831 +0100
+@@ -6,5 +6,5 @@
+ Release-Tags: relext
+ License: CDDL
+ Author: OpenZFS
+-Linux-Maximum: 7.2
++Linux-Maximum: 7.3
+ Linux-Minimum: 4.18
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/zfs.git/commitdiff/c47c08b02ed510aeb2bc231b42e14bc3d50f9495
More information about the pld-cvs-commit
mailing list