* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2019-05-29 22:15 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2019-05-29 22:15 UTC (permalink / raw
To: gentoo-commits
commit: abf3bbd8488b7eb5177cac9898ccc8ea6d963429
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Wed May 29 22:12:55 2019 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Wed May 29 22:14:29 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abf3bbd8
sys-fs/zfs-kmod: revbump 0.8.0 with critical patches
Issue: https://github.com/zfsonlinux/zfs/issues/8816
Issue: https://github.com/zfsonlinux/zfs/issues/8778
Bug: https://bugs.gentoo.org/635002
Package-Manager: Portage-2.3.67, Repoman-2.3.12
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
....0_Fix_integer_overflow_in_get_next_chunk.patch | 32 ++++
.../zfs-kmod/files/0.8.0_revert_Report_holes.patch | 53 ++++++
sys-fs/zfs-kmod/zfs-kmod-0.8.0-r1.ebuild | 178 +++++++++++++++++++++
3 files changed, 263 insertions(+)
diff --git a/sys-fs/zfs-kmod/files/0.8.0_Fix_integer_overflow_in_get_next_chunk.patch b/sys-fs/zfs-kmod/files/0.8.0_Fix_integer_overflow_in_get_next_chunk.patch
new file mode 100644
index 00000000000..0042bfdc99c
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/0.8.0_Fix_integer_overflow_in_get_next_chunk.patch
@@ -0,0 +1,32 @@
+From ec4afd27f198d93a7bd32a05cb288708ba754ada Mon Sep 17 00:00:00 2001
+From: madz <olivier.mazouffre@ims-bordeaux.fr>
+Date: Wed, 29 May 2019 19:17:25 +0200
+Subject: [PATCH] Fix integer overflow in get_next_chunk()
+
+dn->dn_datablksz type is uint32_t and need to be casted to uint64_t
+to avoid an overflow when the record size is greater than 4 MiB.
+
+Reviewed-by: Tom Caputi <tcaputi@datto.com>
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Olivier Mazouffre <olivier.mazouffre@ims-bordeaux.fr>
+Closes #8778
+Closes #8797
+---
+ module/zfs/dmu.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
+index 1697a632078..a283b062238 100644
+--- a/module/zfs/dmu.c
++++ b/module/zfs/dmu.c
+@@ -719,8 +719,8 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum, uint64_t *l1blks)
+ uint64_t blks;
+ uint64_t maxblks = DMU_MAX_ACCESS >> (dn->dn_indblkshift + 1);
+ /* bytes of data covered by a level-1 indirect block */
+- uint64_t iblkrange =
+- dn->dn_datablksz * EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT);
++ uint64_t iblkrange = (uint64_t)dn->dn_datablksz *
++ EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT);
+
+ ASSERT3U(minimum, <=, *start);
+
diff --git a/sys-fs/zfs-kmod/files/0.8.0_revert_Report_holes.patch b/sys-fs/zfs-kmod/files/0.8.0_revert_Report_holes.patch
new file mode 100644
index 00000000000..f8d67ccc7ce
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/0.8.0_revert_Report_holes.patch
@@ -0,0 +1,53 @@
+From: Georgy Yakovlev <gyakovlev@gentoo.org>
+Date: Wed, 29 May 2019 14:38:15 -0700
+Subject: Revert [PATCH] Report holes when there are only metadata changes
+
+This reverts ec4f9b8f30391a3fb46c8d4a31c2dc9250dca1bb
+Issue: https://github.com/zfsonlinux/zfs/issues/8816
+Bug: https://bugs.gentoo.org/635002
+---
+--- b/module/zfs/dmu.c
++++ a/module/zfs/dmu.c
+@@ -2366,39 +2366,14 @@
+ return (err);
+
+ /*
++ * Check if dnode is dirty
+- * Check if there are dirty data blocks or frees which have not been
+- * synced. Dirty spill and bonus blocks which are external to the
+- * object can ignored when reporting holes.
+ */
+- mutex_enter(&dn->dn_mtx);
+ for (i = 0; i < TXG_SIZE; i++) {
+ if (multilist_link_active(&dn->dn_dirty_link[i])) {
++ clean = B_FALSE;
++ break;
+-
+- if (dn->dn_free_ranges[i] != NULL) {
+- clean = B_FALSE;
+- break;
+- }
+-
+- list_t *list = &dn->dn_dirty_records[i];
+- dbuf_dirty_record_t *dr;
+-
+- for (dr = list_head(list); dr != NULL;
+- dr = list_next(list, dr)) {
+- dmu_buf_impl_t *db = dr->dr_dbuf;
+-
+- if (db->db_blkid == DMU_SPILL_BLKID ||
+- db->db_blkid == DMU_BONUS_BLKID)
+- continue;
+-
+- clean = B_FALSE;
+- break;
+- }
+ }
+-
+- if (clean == B_FALSE)
+- break;
+ }
+- mutex_exit(&dn->dn_mtx);
+
+ /*
+ * If compatibility option is on, sync any current changes before
diff --git a/sys-fs/zfs-kmod/zfs-kmod-0.8.0-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-0.8.0-r1.ebuild
new file mode 100644
index 00000000000..0108a7a9b3b
--- /dev/null
+++ b/sys-fs/zfs-kmod/zfs-kmod-0.8.0-r1.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic linux-info linux-mod toolchain-funcs
+
+DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
+HOMEPAGE="https://zfsonlinux.org/"
+
+if [[ ${PV} == "9999" ]]; then
+ inherit autotools git-r3
+ EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
+else
+ SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz"
+ KEYWORDS="~amd64"
+ S="${WORKDIR}/zfs-${PV}"
+ ZFS_KERNEL_COMPAT="5.1"
+fi
+
+LICENSE="CDDL debug? ( GPL-2+ )"
+SLOT="0"
+IUSE="custom-cflags debug +rootfs"
+
+DEPEND=""
+
+RDEPEND="${DEPEND}
+ !sys-fs/zfs-fuse
+ !sys-kernel/spl
+"
+
+BDEPEND="
+ dev-lang/perl
+ virtual/awk
+"
+
+RESTRICT="debug? ( strip ) test"
+
+DOCS=( AUTHORS COPYRIGHT META README.md )
+
+PATCHES=(
+ "${FILESDIR}"/0.8.0_revert_Report_holes.patch
+ "${FILESDIR}"/0.8.0_Fix_integer_overflow_in_get_next_chunk.patch
+)
+
+pkg_setup() {
+ linux-info_pkg_setup
+
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ EFI_PARTITION
+ MODULES
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !TRIM_UNUSED_KSYMS
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ use rootfs && \
+ CONFIG_CHECK="${CONFIG_CHECK}
+ BLK_DEV_INITRD
+ DEVTMPFS
+ "
+
+ kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
+
+ kernel_is -ge 2 6 32 || die "Linux 2.6.32 or newer required"
+
+ if [[ ${PV} != "9999" ]]; then
+ local kv_major_max kv_minor_max zcompat
+ zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ kv_major_max="${zcompat%%.*}"
+ zcompat="${zcompat#*.}"
+ kv_minor_max="${zcompat%%.*}"
+ kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
+ "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
+ fi
+
+ check_extra_config
+}
+
+src_prepare() {
+ default
+
+ if [[ ${PV} == "9999" ]]; then
+ eautoreconf
+ else
+ # Set module revision number
+ sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
+ fi
+
+ # Remove GPLv2-licensed ZPIOS unless we are debugging
+ use debug || sed -e 's/^subdir-m += zpios$//' -i module/Makefile.in
+}
+
+src_configure() {
+ set_arch_to_kernel
+
+ use custom-cflags || strip-flags
+
+ filter-ldflags -Wl,*
+
+ local myconf=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=kernel
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ set_arch_to_kernel
+
+ myemakeargs=( V=1 )
+
+ emake "${myemakeargs[@]}"
+}
+
+src_install() {
+ set_arch_to_kernel
+
+ myemakeargs+=(
+ DEPMOD="/bin/true"
+ DESTDIR="${D}"
+ INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
+ )
+
+ emake "${myemakeargs[@]}" install
+
+ einstalldocs
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
+ ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
+ ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon"
+ fi
+
+ if use x86 || use arm; then
+ ewarn "32-bit kernels will likely require increasing vmalloc to"
+ ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
+ fi
+
+ ewarn "This version of ZFSOnLinux includes support for new feature flags"
+ ewarn "that are incompatible with previous versions. GRUB2 support for"
+ ewarn "/boot with the new feature flags is not yet available."
+ ewarn "Do *NOT* upgrade root pools to use the new feature flags."
+ ewarn "Any new pools will be created with the new feature flags by default"
+ ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
+ ewarn "create a newpool that is backward compatible wih GRUB2, use "
+ ewarn
+ ewarn "zpool create -d -o feature@async_destroy=enabled "
+ ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
+ ewarn " -o feature@spacemap_histogram=enabled"
+ ewarn " -o feature@enabled_txg=enabled "
+ ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
+ ewarn " ..."
+ ewarn
+ ewarn "GRUB2 support will be updated as soon as either the GRUB2"
+ ewarn "developers do a tag or the Gentoo developers find time to backport"
+ ewarn "support from GRUB2 HEAD."
+}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2020-03-30 21:08 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2020-03-30 21:08 UTC (permalink / raw
To: gentoo-commits
commit: 3bda2d24492bc217e169d0e6dc821de2bec6af19
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 30 19:10:03 2020 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Mon Mar 30 21:07:44 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3bda2d24
sys-fs/zfs-kmod: drop 0.8.2
Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 1 -
sys-fs/zfs-kmod/files/0.8.2-umask_O_TMPFILE.patch | 34 ----
sys-fs/zfs-kmod/zfs-kmod-0.8.2-r2.ebuild | 179 ----------------------
3 files changed, 214 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index 84cfb1d2a3e..5de6d1f5c77 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,3 +1,2 @@
DIST zfs-0.7.13.tar.gz 6614047 BLAKE2B c59c46287715779eb04d69333b0a417fa9865eb0d61c642b043188c4c97d4eed369f76a48327326ed1d4dd608ff95d91d20d26c80ed0b120a8fcd5f83cea638f SHA512 457d8f110b68c9656194cd3738b216d5d807d680e5cfc6ed1f3cf5ebde67860476387c6b862ba3ba7f972d8945075963e6c325543ab84468e3eff5dbce68476e
-DIST zfs-0.8.2.tar.gz 8738111 BLAKE2B 5c15f6664ca70f0deeb5b9e32f2bcff68f9821529e5203ff18612ce88473fee9af369354c442f3db7882d301cf17c805c9635b05bfd3460833ed8e5ff8004dd0 SHA512 1424b1a030b814f812b5da422100669db5b8c3ccae14c2fdd62a5e0df28e7255247fe5ca99c95a14f08c92cc1574c22dd132093e4a1dd81e38c95b10cc5e2496
DIST zfs-0.8.3.tar.gz 8779385 BLAKE2B 8b51b9d5b61543566bc7839d8452fdf9358442155e95f93a011531338824bbd4fc8879500e276b02d5d49d504a046728ecc0c6154f69eb7b47180b9bb0e46958 SHA512 aded632e6b04180560d4f2ff283260016e883dadae4e7fda9070b7113dee948099cb7a7b183f1c8139654389a2610fb9cc6f997acdc846040e605125cf016010
diff --git a/sys-fs/zfs-kmod/files/0.8.2-umask_O_TMPFILE.patch b/sys-fs/zfs-kmod/files/0.8.2-umask_O_TMPFILE.patch
deleted file mode 100644
index 9252b6e7815..00000000000
--- a/sys-fs/zfs-kmod/files/0.8.2-umask_O_TMPFILE.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From ddb4e69db5eb0ed741dc4e32714af3e0f054086c Mon Sep 17 00:00:00 2001
-From: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
-Date: Sat, 14 Dec 2019 08:02:23 +0900
-Subject: [PATCH] Don't fail to apply umask for O_TMPFILE files
-
-Apply umask to `mode` which will eventually be applied to inode.
-This is needed since VFS doesn't apply umask for O_TMPFILE files.
-
-(Note that zpl_init_acl() applies `ip->i_mode &= ~current_umask();`
-only when POSIX ACL is used.)
-
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Reviewed-by: Tony Hutter <hutter2@llnl.gov>
-Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
-Closes #8997
-Closes #8998
-
-diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
-index 264c5d2b1cf..e1c6ce7b705 100644
---- a/module/zfs/zpl_inode.c
-+++ b/module/zfs/zpl_inode.c
-@@ -218,6 +218,12 @@ zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
-
- crhold(cr);
- vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
-+ /*
-+ * The VFS does not apply the umask, therefore it is applied here
-+ * when POSIX ACLs are not enabled.
-+ */
-+ if (!IS_POSIXACL(dir))
-+ mode &= ~current_umask();
- zpl_vap_init(vap, dir, mode, cr);
-
- cookie = spl_fstrans_mark();
diff --git a/sys-fs/zfs-kmod/zfs-kmod-0.8.2-r2.ebuild b/sys-fs/zfs-kmod/zfs-kmod-0.8.2-r2.ebuild
deleted file mode 100644
index 961ee269f06..00000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-0.8.2-r2.ebuild
+++ /dev/null
@@ -1,179 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit flag-o-matic linux-info linux-mod toolchain-funcs
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://zfsonlinux.org/"
-
-if [[ ${PV} == "9999" ]]; then
- inherit autotools git-r3
- EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
-else
- SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz"
- KEYWORDS="~amd64 ~arm64 ~ppc64"
- S="${WORKDIR}/zfs-${PV}"
- ZFS_KERNEL_COMPAT="5.4"
-fi
-
-LICENSE="CDDL debug? ( GPL-2+ )"
-SLOT="0"
-IUSE="custom-cflags debug +rootfs"
-
-DEPEND=""
-
-RDEPEND="${DEPEND}
- !sys-fs/zfs-fuse
- !sys-kernel/spl
-"
-
-BDEPEND="
- dev-lang/perl
- virtual/awk
-"
-
-RESTRICT="debug? ( strip ) test"
-
-DOCS=( AUTHORS COPYRIGHT META README.md )
-
-PATCHES=( "${FILESDIR}/${PV}-umask_O_TMPFILE.patch" )
-
-pkg_setup() {
- linux-info_pkg_setup
-
- CONFIG_CHECK="
- !DEBUG_LOCK_ALLOC
- EFI_PARTITION
- MODULES
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- !TRIM_UNUSED_KSYMS
- ZLIB_DEFLATE
- ZLIB_INFLATE
- "
-
- use debug && CONFIG_CHECK="${CONFIG_CHECK}
- FRAME_POINTER
- DEBUG_INFO
- !DEBUG_INFO_REDUCED
- "
-
- use rootfs && \
- CONFIG_CHECK="${CONFIG_CHECK}
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- if use arm64; then
- kernel_is -ge 5 && CONFIG_CHECK="${CONFIG_CHECK} !PREEMPT"
- fi
-
- kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
-
- kernel_is -ge 2 6 32 || die "Linux 2.6.32 or newer required"
-
- if [[ ${PV} != "9999" ]]; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
- fi
-
- check_extra_config
-}
-
-src_prepare() {
- default
-
- if [[ ${PV} == "9999" ]]; then
- eautoreconf
- else
- # Set module revision number
- sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
- fi
-
- # Remove GPLv2-licensed ZPIOS unless we are debugging
- use debug || sed -e 's/^subdir-m += zpios$//' -i module/Makefile.in
-}
-
-src_configure() {
- set_arch_to_kernel
-
- use custom-cflags || strip-flags
-
- filter-ldflags -Wl,*
-
- local myconf=(
- --bindir="${EPREFIX}/bin"
- --sbindir="${EPREFIX}/sbin"
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- set_arch_to_kernel
-
- myemakeargs=( V=1 )
-
- emake "${myemakeargs[@]}"
-}
-
-src_install() {
- set_arch_to_kernel
-
- myemakeargs+=(
- DEPMOD="/bin/true"
- DESTDIR="${D}"
- INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
- )
-
- emake "${myemakeargs[@]}" install
-
- einstalldocs
-}
-
-pkg_postinst() {
- linux-mod_pkg_postinst
-
- # Remove old modules
- if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
- ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
- ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
- ewarn "Automatically removing old modules to avoid problems."
- rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
- rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon"
- fi
-
- if use x86 || use arm; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- ewarn "This version of ZFSOnLinux includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
- ewarn "create a newpool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -d -o feature@async_destroy=enabled "
- ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
- ewarn " -o feature@spacemap_histogram=enabled"
- ewarn " -o feature@enabled_txg=enabled "
- ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
- ewarn " ..."
- ewarn
- ewarn "GRUB2 support will be updated as soon as either the GRUB2"
- ewarn "developers do a tag or the Gentoo developers find time to backport"
- ewarn "support from GRUB2 HEAD."
-}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2020-09-07 4:04 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2020-09-07 4:04 UTC (permalink / raw
To: gentoo-commits
commit: 180d1e95aaa2e831bd2480b73af927a1632a9817
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 7 03:14:36 2020 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Mon Sep 7 04:04:24 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=180d1e95
sys-fs/zfs-kmod: add powerpc setjmp/longjmp patch to 0.8.4
kernel-builtin build fails with
powerpc64le-unknown-linux-gnu-ld.bfd: fs/zfs/lua/setjmp/setjmp.o: in
function `setjmp':
(.text+0x0): multiple definition of `setjmp';
arch/powerpc/kernel/misc.o:(.text+0x30): first defined here
powerpc64le-unknown-linux-gnu-ld.bfd: fs/zfs/lua/setjmp/setjmp.o: in
function `longjmp':
(.text+0x78): multiple definition of `longjmp';
arch/powerpc/kernel/misc.o:(.text+0x9c): first defined here
Package-Manager: Portage-3.0.5, Repoman-3.0.1
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/files/0.8.4-powerpc_jmp_weak.patch | 48 ++++++++++++++++++++++
sys-fs/zfs-kmod/zfs-kmod-0.8.4-r1.ebuild | 2 +
2 files changed, 50 insertions(+)
diff --git a/sys-fs/zfs-kmod/files/0.8.4-powerpc_jmp_weak.patch b/sys-fs/zfs-kmod/files/0.8.4-powerpc_jmp_weak.patch
new file mode 100644
index 00000000000..1a2948a3158
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/0.8.4-powerpc_jmp_weak.patch
@@ -0,0 +1,48 @@
+From bd0efd1f062bfba5dd2d6b1fe30b6949f8e0a8ef Mon Sep 17 00:00:00 2001
+From: sterlingjensen <5555776+sterlingjensen@users.noreply.github.com>
+Date: Mon, 24 Aug 2020 22:41:05 -0500
+Subject: [PATCH] Mark lua setjmp/longjmp for powerpc weak
+
+Linux already defines setjmp/longjmp for powerpc, which leads to
+duplicate symbols in a statically linked build.
+
+Signed-off-by: Sterlng Jensen <sterlingjensen@users.noreply.github.com>
+---
+ module/lua/setjmp/setjmp_ppc.S | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/module/lua/setjmp/setjmp_ppc.S b/module/lua/setjmp/setjmp_ppc.S
+index f787ef34913..72aa5d5ab5b 100644
+--- a/module/lua/setjmp/setjmp_ppc.S
++++ b/module/lua/setjmp/setjmp_ppc.S
+@@ -56,7 +56,7 @@
+ #define ENTRY(name) \
+ .align 2 ; \
+ .type name,@function; \
+- .globl name; \
++ .weak name; \
+ name:
+
+ #else /* PPC64_ELF_ABI_v1 */
+@@ -65,8 +65,8 @@ name:
+ #define GLUE(a,b) XGLUE(a,b)
+ #define ENTRY(name) \
+ .align 2 ; \
+- .globl name; \
+- .globl GLUE(.,name); \
++ .weak name; \
++ .weak GLUE(.,name); \
+ .pushsection ".opd","aw"; \
+ name: \
+ .quad GLUE(.,name); \
+@@ -83,8 +83,8 @@ GLUE(.,name):
+ #define ENTRY(name) \
+ .text; \
+ .p2align 4; \
+- .globl name; \
+- .type name,@function; \
++ .weak name; \
++ .type name,@function; \
+ name:
+
+ #endif /* __powerpc64__ */
diff --git a/sys-fs/zfs-kmod/zfs-kmod-0.8.4-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-0.8.4-r1.ebuild
index 59ea52ab658..2276604b161 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-0.8.4-r1.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-0.8.4-r1.ebuild
@@ -37,6 +37,8 @@ RESTRICT="debug? ( strip ) test"
DOCS=( AUTHORS COPYRIGHT META README.md )
+PATCHES=( "${FILESDIR}/${PV}-powerpc_jmp_weak.patch" )
+
pkg_setup() {
CONFIG_CHECK="
!DEBUG_LOCK_ALLOC
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2020-09-21 23:04 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2020-09-21 23:04 UTC (permalink / raw
To: gentoo-commits
commit: 95ea0372437186b62ad95fce2f314eed8d43fe66
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 21 23:04:09 2020 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:04:09 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95ea0372
sys-fs/zfs-kmod: drop 2.0.0_rc1
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 1 -
sys-fs/zfs-kmod/files/2.0.0_rc1-U__BMI__.patch | 29 ----
sys-fs/zfs-kmod/zfs-kmod-2.0.0_rc1.ebuild | 178 -------------------------
3 files changed, 208 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index 7165523a32c..fcbe351955d 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,3 +1,2 @@
DIST zfs-0.8.4.tar.gz 9285838 BLAKE2B 776bcd6dfab8825c07d315085e288b29bf543d6957325d5d566b7b78c04505dde9bd25eb6684cb4a1b6a657de8a4e1290d04d2b9079d26d6b834a70f1ec3b569 SHA512 9086dc6a6262dd93ca6ec43f1b4c2e5c804deba708c8a7460b8531aa4802b0bf8cac0917a1a00e6af2e96d4a21cd68b85e226bf571bd94041d0325c457106eb1
-DIST zfs-2.0.0-rc1.tar.gz 12820598 BLAKE2B 6ea935447e4f95eb4040533843677f0091c9620fc387c76818df69a6653467e10aecd07ece22b2a32f849dc52ab0160149147416af90d78c5284f403571f7962 SHA512 b70cd10672d4424a6ffaaa58b4fa14b7d1b6481413463abd9b6d75698e80d94301fd54c7e091d63ebad9c8838eaaef6449223a55f041a62ae8292882feb195b5
DIST zfs-2.0.0-rc2.tar.gz 12854085 BLAKE2B 73cabd565c11eef1bebbc391f8c4ba18acd1610f98f1b8afb507bc844f4b6a64ba32d9727e634c7f26c48fe365a841bf071513df234b9b7a87e954610a6d7f3b SHA512 14b17d06124890efef15b3b073e103c9faeecaea761779fff9a8420e3ab72fa611df9875fa766a323d69646e9025f8b19f918ded4c6705af116cf9f14eea4f40
diff --git a/sys-fs/zfs-kmod/files/2.0.0_rc1-U__BMI__.patch b/sys-fs/zfs-kmod/files/2.0.0_rc1-U__BMI__.patch
deleted file mode 100644
index 9e9a007c300..00000000000
--- a/sys-fs/zfs-kmod/files/2.0.0_rc1-U__BMI__.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 81a3970fca5759499effc3131e59c9bd8f446cc9 Mon Sep 17 00:00:00 2001
-From: Georgy Yakovlev <gyakovlev@gentoo.org>
-Date: Wed, 26 Aug 2020 16:02:48 -0700
-Subject: [PATCH] module/zstd: pass -U__BMI__
-
-Closes: https://github.com/openzfs/zfs/issues/10758
-Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
----
- module/zstd/Makefile.in | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/module/zstd/Makefile.in b/module/zstd/Makefile.in
-index eea749ea8..bfceca920 100644
---- a/module/zstd/Makefile.in
-+++ b/module/zstd/Makefile.in
-@@ -20,6 +20,10 @@ ccflags-y += -O3
- # Set it for other compilers, too.
- $(obj)/lib/zstd.o: c_flags += -fno-tree-vectorize
-
-+# SSE register return with SSE disabled if -march=znverX is passed
-+# https://github.com/openzfs/zfs/issues/10758
-+$(obj)/lib/zstd.o: c_flags += -U__BMI__
-+
- # Quiet warnings about frame size due to unused code in unmodified zstd lib
- $(obj)/lib/zstd.o: c_flags += -Wframe-larger-than=20480
-
---
-2.28.0
-
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.0.0_rc1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.0.0_rc1.ebuild
deleted file mode 100644
index 73b00ca17e0..00000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.0.0_rc1.ebuild
+++ /dev/null
@@ -1,178 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-MY_PV="${PV/_rc/-rc}"
-
-inherit autotools flag-o-matic linux-mod toolchain-funcs
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-if [[ ${PV} == "9999" ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
-else
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- KEYWORDS="~amd64 ~arm64 ~ppc64"
- S="${WORKDIR}/zfs-${PV%_rc?}"
- ZFS_KERNEL_COMPAT="5.8"
-fi
-
-LICENSE="CDDL debug? ( GPL-2+ )"
-SLOT="0"
-IUSE="custom-cflags debug +rootfs"
-
-DEPEND=""
-
-RDEPEND="${DEPEND}
- !sys-kernel/spl
-"
-
-BDEPEND="
- dev-lang/perl
- virtual/awk
-"
-
-RESTRICT="debug? ( strip ) test"
-
-DOCS=( AUTHORS COPYRIGHT META README.md )
-
-PATCHES=( "${FILESDIR}/${PV}-U__BMI__.patch" )
-
-pkg_setup() {
- CONFIG_CHECK="
- !DEBUG_LOCK_ALLOC
- EFI_PARTITION
- MODULES
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- !TRIM_UNUSED_KSYMS
- ZLIB_DEFLATE
- ZLIB_INFLATE
- "
-
- use debug && CONFIG_CHECK="${CONFIG_CHECK}
- FRAME_POINTER
- DEBUG_INFO
- !DEBUG_INFO_REDUCED
- "
-
- use rootfs && \
- CONFIG_CHECK="${CONFIG_CHECK}
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
-
- if [[ ${PV} != "9999" ]]; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
-
- fi
-
- # 2.0.0 requires at least 3.10
- kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
-
- linux-mod_pkg_setup
-}
-
-src_prepare() {
- default
-
- if [[ ${PV} == "9999" ]]; then
- eautoreconf
- else
- # Set module revision number
- sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
- fi
-}
-
-src_configure() {
- set_arch_to_kernel
-
- use custom-cflags || strip-flags
-
- filter-ldflags -Wl,*
-
- local myconf=(
- CROSS_COMPILE="${CHOST}-"
- HOSTCC="$(tc-getBUILD_CC)"
- --bindir="${EPREFIX}/bin"
- --sbindir="${EPREFIX}/sbin"
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- set_arch_to_kernel
-
- myemakeargs=(
- CROSS_COMPILE="${CHOST}-"
- HOSTCC="$(tc-getBUILD_CC)"
- V=1
- )
-
- emake "${myemakeargs[@]}"
-}
-
-src_install() {
- set_arch_to_kernel
-
- myemakeargs+=(
- DEPMOD="/bin/true"
- DESTDIR="${D}"
- INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
- )
-
- emake "${myemakeargs[@]}" install
-
- einstalldocs
-}
-
-pkg_postinst() {
- linux-mod_pkg_postinst
-
- # Remove old modules
- if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
- ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
- ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
- ewarn "Automatically removing old modules to avoid problems."
- rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
- rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon"
- fi
-
- if use x86 || use arm; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
- ewarn "create a newpool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -d -o feature@async_destroy=enabled "
- ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
- ewarn " -o feature@spacemap_histogram=enabled"
- ewarn " -o feature@enabled_txg=enabled "
- ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
- ewarn " ..."
- ewarn
- ewarn "GRUB2 support will be updated as soon as either the GRUB2"
- ewarn "developers do a tag or the Gentoo developers find time to backport"
- ewarn "support from GRUB2 HEAD."
-}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2020-12-18 20:04 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2020-12-18 20:04 UTC (permalink / raw
To: gentoo-commits
commit: c40d3a5fdfabc90e96db6212924f917283b4cf9c
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 18 19:57:00 2020 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Fri Dec 18 20:03:57 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c40d3a5f
sys-fs/zfs-kmod: replace sed with a proper patch in 0.8.6
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/files/0.8.6-copy-builtin.patch | 27 ++++++++++++++++++++++++++
sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild | 7 +++----
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/sys-fs/zfs-kmod/files/0.8.6-copy-builtin.patch b/sys-fs/zfs-kmod/files/0.8.6-copy-builtin.patch
new file mode 100644
index 00000000000..2b1ef858254
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/0.8.6-copy-builtin.patch
@@ -0,0 +1,27 @@
+From 0ce99b43b339226d62362f624d37f80a921eb197 Mon Sep 17 00:00:00 2001
+From: Georgy Yakovlev <gyakovlev@gentoo.org>
+Date: Fri, 18 Dec 2020 11:35:07 -0800
+Subject: [PATCH] copy-builtin: handle missing .gitignore
+
+acfc4944d0d6db114db9f2bb5401251c5bd767b6 broke copy-builtin in
+release tarballs, because those do not contain .gitignore file.
+Adding -f to rm call will make it return 0 even if file does not exist.
+
+Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
+---
+ copy-builtin | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/copy-builtin b/copy-builtin
+index 84f469fef02..6a6eb1f3695 100755
+--- a/copy-builtin
++++ b/copy-builtin
+@@ -36,7 +36,7 @@ rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs"
+ cp --recursive include "$KERNEL_DIR/include/zfs"
+ cp --recursive module "$KERNEL_DIR/fs/zfs"
+ cp zfs_config.h "$KERNEL_DIR/include/zfs/"
+-rm "$KERNEL_DIR/include/zfs/.gitignore"
++rm -f "$KERNEL_DIR/include/zfs/.gitignore"
+
+ for MODULE in "${MODULES[@]}"
+ do
diff --git a/sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild b/sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild
index cc5f18c9067..9067f366236 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild
@@ -37,6 +37,9 @@ RESTRICT="debug? ( strip ) test"
DOCS=( AUTHORS COPYRIGHT META README.md )
+# https://github.com/openzfs/zfs/pull/11371
+PATCHES=( "${FILESDIR}/${PV}-copy-builtin.patch" )
+
pkg_setup() {
CONFIG_CHECK="
!DEBUG_LOCK_ALLOC
@@ -94,10 +97,6 @@ src_prepare() {
# Set module revision number
sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
fi
-
- # undo https://github.com/openzfs/zfs/commit/acfc4944d0d6db114db9f2bb5401251c5bd767b6
- # we use release tarballs with no gitignore files already
- sed -i 's:rm "$KERNEL_DIR/include/zfs/.gitignore"::' copy-builtin || die
}
src_configure() {
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2021-06-04 2:14 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2021-06-04 2:14 UTC (permalink / raw
To: gentoo-commits
commit: 919f0c385d58501b3b1aa32543ff3772aea483ee
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 4 01:20:37 2021 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Fri Jun 4 01:25:13 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=919f0c38
sys-fs/zfs-kmod: revbump 2.0.4, add 5.12 support and fixes
run eautoreconf, as a lot of m4 files changed
Bug: https://bugs.gentoo.org/792627
Bug: https://bugs.gentoo.org/790686
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
.../files/zfs-8.0.4_5.12_compat_bio_max_segs.patch | 91 ++
.../zfs-8.0.4_5.12_compat_idmapped_mounts.patch | 1231 ++++++++++++++++++++
.../zfs-8.0.4_5.12_compat_iov_iter_advance.patch | 40 +
.../files/zfs-8.0.4_5.12_compat_tmpfile.patch | 89 ++
.../files/zfs-8.0.4_5.12_compat_userns.patch | 173 +++
.../zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch | 59 +
.../zfs-kmod/files/zfs-8.0.4_stream_resume.patch | 33 +
sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild | 186 +++
8 files changed, 1902 insertions(+)
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_bio_max_segs.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_bio_max_segs.patch
new file mode 100644
index 00000000000..33f9a344e2f
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_bio_max_segs.patch
@@ -0,0 +1,91 @@
+From 77352db228c07ce8ba50478b9029820ca69c6c1b Mon Sep 17 00:00:00 2001
+From: Coleman Kane <ckane@colemankane.org>
+Date: Sat, 20 Mar 2021 01:33:42 -0400
+Subject: [PATCH] Linux 5.12 update: bio_max_segs() replaces BIO_MAX_PAGES
+
+The BIO_MAX_PAGES macro is being retired in favor of a bio_max_segs()
+function that implements the typical MIN(x,y) logic used throughout the
+kernel for bounding the allocation, and also the new implementation is
+intended to be signed-safe (which the former was not).
+
+Reviewed-by: Tony Hutter <hutter2@llnl.gov>
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Coleman Kane <ckane@colemankane.org>
+Closes #11765
+(cherry picked from commit ffd6978ef59cfe2773e984bf03de2f0b93b03f5c)
+Signed-off-by: Jonathon Fernyhough <jonathon@m2x.dev>
+---
+ config/kernel-bio_max_segs.m4 | 23 +++++++++++++++++++++++
+ config/kernel.m4 | 2 ++
+ module/os/linux/zfs/vdev_disk.c | 5 +++++
+ 3 files changed, 30 insertions(+)
+ create mode 100644 config/kernel-bio_max_segs.m4
+
+diff --git a/config/kernel-bio_max_segs.m4 b/config/kernel-bio_max_segs.m4
+new file mode 100644
+index 00000000000..a90d75455c1
+--- /dev/null
++++ b/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/config/kernel.m4 b/config/kernel.m4
+index 51c7fb926ec..b8d53490a4a 100644
+--- a/config/kernel.m4
++++ b/config/kernel.m4
+@@ -127,6 +127,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
+ 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])
+@@ -227,6 +228,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
+ ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS
+ ZFS_AC_KERNEL_MKNOD
+ ZFS_AC_KERNEL_SYMLINK
++ ZFS_AC_KERNEL_BIO_MAX_SEGS
+ ])
+
+ dnl #
+diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c
+index 08c33313407..aaaf4105979 100644
+--- a/module/os/linux/zfs/vdev_disk.c
++++ b/module/os/linux/zfs/vdev_disk.c
+@@ -593,9 +593,14 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio,
+ }
+
+ /* bio_alloc() with __GFP_WAIT never returns NULL */
++#ifdef HAVE_BIO_MAX_SEGS
++ dr->dr_bio[i] = bio_alloc(GFP_NOIO, bio_max_segs(
++ abd_nr_pages_off(zio->io_abd, bio_size, abd_offset)));
++#else
+ dr->dr_bio[i] = bio_alloc(GFP_NOIO,
+ MIN(abd_nr_pages_off(zio->io_abd, bio_size, abd_offset),
+ BIO_MAX_PAGES));
++#endif
+ if (unlikely(dr->dr_bio[i] == NULL)) {
+ vdev_disk_dio_free(dr);
+ return (SET_ERROR(ENOMEM));
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_idmapped_mounts.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_idmapped_mounts.patch
new file mode 100644
index 00000000000..fd8b025a8fd
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_idmapped_mounts.patch
@@ -0,0 +1,1231 @@
+From f315d9a3ff3cc0b81c99dd9be5878a55d2e98d8e Mon Sep 17 00:00:00 2001
+From: Coleman Kane <ckane@colemankane.org>
+Date: Sat, 20 Mar 2021 00:00:59 -0400
+Subject: [PATCH] Linux 5.12 compat: idmapped mounts
+
+In Linux 5.12, the filesystem API was modified to support ipmapped
+mounts by adding a "struct user_namespace *" parameter to a number
+functions and VFS handlers. This change adds the needed autoconf
+macros to detect the new interfaces and updates the code appropriately.
+This change does not add support for idmapped mounts, instead it
+preserves the existing behavior by passing the initial user namespace
+where needed. A subsequent commit will be required to add support
+for idmapped mounted.
+
+Reviewed-by: Tony Hutter <hutter2@llnl.gov>
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Coleman Kane <ckane@colemankane.org>
+Closes #11712
+(cherry picked from commit e2a8296131e94ad785f5564156ed2db1fdb2e080)
+Signed-off-by: Jonathon Fernyhough <jonathon@m2x.dev>
+---
+ config/kernel-generic_fillattr.m4 | 28 +++++++
+ config/kernel-inode-create.m4 | 43 +++++++++--
+ config/kernel-inode-getattr.m4 | 63 +++++++++++++---
+ config/kernel-is_owner_or_cap.m4 | 23 +++++-
+ config/kernel-mkdir-umode-t.m4 | 32 --------
+ config/kernel-mkdir.m4 | 65 ++++++++++++++++
+ config/kernel-mknod.m4 | 30 ++++++++
+ config/kernel-rename.m4 | 50 ++++++++++---
+ config/kernel-setattr-prepare.m4 | 45 ++++++++---
+ config/kernel-symlink.m4 | 30 ++++++++
+ config/kernel-xattr-handler.m4 | 78 +++++++++++++-------
+ config/kernel.m4 | 18 +++--
+ 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/zpl.h | 18 +++++
+ module/os/linux/zfs/policy.c | 2 +-
+ module/os/linux/zfs/zfs_vnops_os.c | 5 +-
+ module/os/linux/zfs/zpl_ctldir.c | 51 ++++++++++++-
+ module/os/linux/zfs/zpl_file.c | 2 +-
+ module/os/linux/zfs/zpl_inode.c | 49 +++++++++++-
+ module/os/linux/zfs/zpl_xattr.c | 4 +-
+ 22 files changed, 557 insertions(+), 123 deletions(-)
+ create mode 100644 config/kernel-generic_fillattr.m4
+ delete mode 100644 config/kernel-mkdir-umode-t.m4
+ create mode 100644 config/kernel-mkdir.m4
+ create mode 100644 config/kernel-mknod.m4
+ create mode 100644 config/kernel-symlink.m4
+
+diff --git a/config/kernel-generic_fillattr.m4 b/config/kernel-generic_fillattr.m4
+new file mode 100644
+index 00000000000..50c8031305b
+--- /dev/null
++++ b/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/config/kernel-inode-create.m4 b/config/kernel-inode-create.m4
+index 9f28bcbd4f7..a6ea11fb61b 100644
+--- a/config/kernel-inode-create.m4
++++ b/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/config/kernel-inode-getattr.m4 b/config/kernel-inode-getattr.m4
+index 48391d66f8b..f62e82f5230 100644
+--- a/config/kernel-inode-getattr.m4
++++ b/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/config/kernel-is_owner_or_cap.m4 b/config/kernel-is_owner_or_cap.m4
+index 3df6163da27..3c3c6ad2240 100644
+--- a/config/kernel-is_owner_or_cap.m4
++++ b/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/config/kernel-mkdir-umode-t.m4 b/config/kernel-mkdir-umode-t.m4
+deleted file mode 100644
+index 19599670df3..00000000000
+--- a/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/config/kernel-mkdir.m4 b/config/kernel-mkdir.m4
+new file mode 100644
+index 00000000000..a162bcd880f
+--- /dev/null
++++ b/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/config/kernel-mknod.m4 b/config/kernel-mknod.m4
+new file mode 100644
+index 00000000000..ffe45106003
+--- /dev/null
++++ b/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/config/kernel-rename.m4 b/config/kernel-rename.m4
+index f707391539d..31d199f33bb 100644
+--- a/config/kernel-rename.m4
++++ b/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/config/kernel-setattr-prepare.m4 b/config/kernel-setattr-prepare.m4
+index 45408c45c69..24245aa5344 100644
+--- a/config/kernel-setattr-prepare.m4
++++ b/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/config/kernel-symlink.m4 b/config/kernel-symlink.m4
+new file mode 100644
+index 00000000000..d90366d04b7
+--- /dev/null
++++ b/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/config/kernel-xattr-handler.m4 b/config/kernel-xattr-handler.m4
+index 137bf4a8aff..00b1e74a9cc 100644
+--- a/config/kernel-xattr-handler.m4
++++ b/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/config/kernel.m4 b/config/kernel.m4
+index 55620b3daa8..51c7fb926ec 100644
+--- a/config/kernel.m4
++++ b/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
+@@ -124,6 +124,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
+ ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES
+ ZFS_AC_KERNEL_SRC_KSTRTOUL
+ ZFS_AC_KERNEL_SRC_PERCPU
++ ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS
++ ZFS_AC_KERNEL_SRC_MKNOD
++ ZFS_AC_KERNEL_SRC_SYMLINK
+
+ AC_MSG_CHECKING([for available kernel interfaces])
+ ZFS_LINUX_TEST_COMPILE_ALL([kabi])
+@@ -176,9 +179,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
+@@ -212,7 +215,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
+@@ -221,6 +224,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
+ ZFS_AC_KERNEL_TOTALHIGH_PAGES
+ ZFS_AC_KERNEL_KSTRTOUL
+ ZFS_AC_KERNEL_PERCPU
++ ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS
++ ZFS_AC_KERNEL_MKNOD
++ ZFS_AC_KERNEL_SYMLINK
+ ])
+
+ dnl #
+diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h
+index c35e80d31cd..91e908598fb 100644
+--- a/include/os/linux/kernel/linux/vfs_compat.h
++++ b/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/include/os/linux/kernel/linux/xattr_compat.h b/include/os/linux/kernel/linux/xattr_compat.h
+index 8348e99198a..54690727eab 100644
+--- a/include/os/linux/kernel/linux/xattr_compat.h
++++ b/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)); \
++}
+ /*
+ * 4.7 API change,
+ * The xattr_handler->set() callback was changed to take a both dentry and
+ * inode, because the dentry might not be attached to an inode yet.
+ */
+-#if defined(HAVE_XATTR_SET_DENTRY_INODE)
++#elif defined(HAVE_XATTR_SET_DENTRY_INODE)
+ #define ZPL_XATTR_SET_WRAPPER(fn) \
+ static int \
+ fn(const struct xattr_handler *handler, struct dentry *dentry, \
+diff --git a/include/os/linux/zfs/sys/zfs_vnops_os.h b/include/os/linux/zfs/sys/zfs_vnops_os.h
+index 1c9cdf7bf8f..ba83f5dd83d 100644
+--- a/include/os/linux/zfs/sys/zfs_vnops_os.h
++++ b/include/os/linux/zfs/sys/zfs_vnops_os.h
+@@ -56,7 +56,8 @@ extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap,
+ extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd,
+ cred_t *cr, int flags);
+ extern int zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr);
+-extern int zfs_getattr_fast(struct inode *ip, struct kstat *sp);
++extern int zfs_getattr_fast(struct user_namespace *, struct inode *ip,
++ struct kstat *sp);
+ extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr);
+ extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp,
+ char *tnm, cred_t *cr, int flags);
+diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h
+index b0bb9c29c0b..21825d1f378 100644
+--- a/include/os/linux/zfs/sys/zpl.h
++++ b/include/os/linux/zfs/sys/zpl.h
+@@ -171,4 +171,22 @@ zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
+ timespec_trunc(ts, (ip)->i_sb->s_time_gran)
+ #endif
+
++#if defined(HAVE_INODE_OWNER_OR_CAPABLE)
++#define zpl_inode_owner_or_capable(ns, ip) inode_owner_or_capable(ip)
++#elif defined(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED)
++#define zpl_inode_owner_or_capable(ns, ip) inode_owner_or_capable(ns, ip)
++#else
++#error "Unsupported kernel"
++#endif
++
++#ifdef HAVE_SETATTR_PREPARE_USERNS
++#define zpl_setattr_prepare(ns, dentry, ia) setattr_prepare(ns, dentry, ia)
++#else
++/*
++ * Use kernel-provided version, or our own from
++ * linux/vfs_compat.h
++ */
++#define zpl_setattr_prepare(ns, dentry, ia) setattr_prepare(dentry, ia)
++#endif
++
+ #endif /* _SYS_ZPL_H */
+diff --git a/module/os/linux/zfs/policy.c b/module/os/linux/zfs/policy.c
+index 8780d7f6c70..bbccb2e572d 100644
+--- a/module/os/linux/zfs/policy.c
++++ b/module/os/linux/zfs/policy.c
+@@ -124,7 +124,7 @@ secpolicy_vnode_any_access(const cred_t *cr, struct inode *ip, uid_t owner)
+ if (crgetfsuid(cr) == owner)
+ return (0);
+
+- if (inode_owner_or_capable(ip))
++ if (zpl_inode_owner_or_capable(kcred->user_ns, ip))
+ return (0);
+
+ #if defined(CONFIG_USER_NS)
+diff --git a/module/os/linux/zfs/zfs_vnops_os.c b/module/os/linux/zfs/zfs_vnops_os.c
+index 7484d651c1f..ce0701763fd 100644
+--- a/module/os/linux/zfs/zfs_vnops_os.c
++++ b/module/os/linux/zfs/zfs_vnops_os.c
+@@ -1907,7 +1907,8 @@ zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr)
+ */
+ /* ARGSUSED */
+ int
+-zfs_getattr_fast(struct inode *ip, struct kstat *sp)
++zfs_getattr_fast(struct user_namespace *user_ns, struct inode *ip,
++ struct kstat *sp)
+ {
+ znode_t *zp = ITOZ(ip);
+ zfsvfs_t *zfsvfs = ITOZSB(ip);
+@@ -1919,7 +1920,7 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp)
+
+ mutex_enter(&zp->z_lock);
+
+- generic_fillattr(ip, sp);
++ zpl_generic_fillattr(user_ns, ip, sp);
+ /*
+ * +1 link count for root inode with visible '.zfs' directory.
+ */
+diff --git a/module/os/linux/zfs/zpl_ctldir.c b/module/os/linux/zfs/zpl_ctldir.c
+index e6420f19ed8..9b526afd000 100644
+--- a/module/os/linux/zfs/zpl_ctldir.c
++++ b/module/os/linux/zfs/zpl_ctldir.c
+@@ -101,12 +101,22 @@ zpl_root_readdir(struct file *filp, void *dirent, filldir_t filldir)
+ */
+ /* ARGSUSED */
+ static int
++#ifdef HAVE_USERNS_IOPS_GETATTR
++zpl_root_getattr_impl(struct user_namespace *user_ns,
++ const struct path *path, struct kstat *stat, u32 request_mask,
++ unsigned int query_flags)
++#else
+ zpl_root_getattr_impl(const struct path *path, struct kstat *stat,
+ u32 request_mask, unsigned int query_flags)
++#endif
+ {
+ struct inode *ip = path->dentry->d_inode;
+
++#if defined(HAVE_GENERIC_FILLATTR_USERNS) && defined(HAVE_USERNS_IOPS_GETATTR)
++ generic_fillattr(user_ns, ip, stat);
++#else
+ generic_fillattr(ip, stat);
++#endif
+ stat->atime = current_time(ip);
+
+ return (0);
+@@ -290,8 +300,14 @@ zpl_snapdir_readdir(struct file *filp, void *dirent, filldir_t filldir)
+ #endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
+
+ static int
++#ifdef HAVE_IOPS_RENAME_USERNS
++zpl_snapdir_rename2(struct user_namespace *user_ns, struct inode *sdip,
++ struct dentry *sdentry, struct inode *tdip, struct dentry *tdentry,
++ unsigned int flags)
++#else
+ zpl_snapdir_rename2(struct inode *sdip, struct dentry *sdentry,
+ struct inode *tdip, struct dentry *tdentry, unsigned int flags)
++#endif
+ {
+ cred_t *cr = CRED();
+ int error;
+@@ -309,7 +325,7 @@ zpl_snapdir_rename2(struct inode *sdip, struct dentry *sdentry,
+ return (error);
+ }
+
+-#ifndef HAVE_RENAME_WANTS_FLAGS
++#if !defined(HAVE_RENAME_WANTS_FLAGS) && !defined(HAVE_IOPS_RENAME_USERNS)
+ static int
+ zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry,
+ struct inode *tdip, struct dentry *tdentry)
+@@ -333,7 +349,12 @@ zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry)
+ }
+
+ static int
++#ifdef HAVE_IOPS_MKDIR_USERNS
++zpl_snapdir_mkdir(struct user_namespace *user_ns, struct inode *dip,
++ struct dentry *dentry, umode_t mode)
++#else
+ zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
++#endif
+ {
+ cred_t *cr = CRED();
+ vattr_t *vap;
+@@ -363,14 +384,24 @@ zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
+ */
+ /* ARGSUSED */
+ static int
++#ifdef HAVE_USERNS_IOPS_GETATTR
++zpl_snapdir_getattr_impl(struct user_namespace *user_ns,
++ const struct path *path, struct kstat *stat, u32 request_mask,
++ unsigned int query_flags)
++#else
+ zpl_snapdir_getattr_impl(const struct path *path, struct kstat *stat,
+ u32 request_mask, unsigned int query_flags)
++#endif
+ {
+ struct inode *ip = path->dentry->d_inode;
+ zfsvfs_t *zfsvfs = ITOZSB(ip);
+
+ ZPL_ENTER(zfsvfs);
++#if defined(HAVE_GENERIC_FILLATTR_USERNS) && defined(HAVE_USERNS_IOPS_GETATTR)
++ generic_fillattr(user_ns, ip, stat);
++#else
+ generic_fillattr(ip, stat);
++#endif
+
+ stat->nlink = stat->size = 2;
+ stat->ctime = stat->mtime = dmu_objset_snap_cmtime(zfsvfs->z_os);
+@@ -408,7 +439,7 @@ const struct file_operations zpl_fops_snapdir = {
+ const struct inode_operations zpl_ops_snapdir = {
+ .lookup = zpl_snapdir_lookup,
+ .getattr = zpl_snapdir_getattr,
+-#ifdef HAVE_RENAME_WANTS_FLAGS
++#if defined(HAVE_RENAME_WANTS_FLAGS) || defined(HAVE_IOPS_RENAME_USERNS)
+ .rename = zpl_snapdir_rename2,
+ #else
+ .rename = zpl_snapdir_rename,
+@@ -495,8 +526,14 @@ zpl_shares_readdir(struct file *filp, void *dirent, filldir_t filldir)
+
+ /* ARGSUSED */
+ static int
++#ifdef HAVE_USERNS_IOPS_GETATTR
++zpl_shares_getattr_impl(struct user_namespace *user_ns,
++ const struct path *path, struct kstat *stat, u32 request_mask,
++ unsigned int query_flags)
++#else
+ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
+ u32 request_mask, unsigned int query_flags)
++#endif
+ {
+ struct inode *ip = path->dentry->d_inode;
+ zfsvfs_t *zfsvfs = ITOZSB(ip);
+@@ -506,7 +543,11 @@ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
+ ZPL_ENTER(zfsvfs);
+
+ if (zfsvfs->z_shares_dir == 0) {
++#if defined(HAVE_GENERIC_FILLATTR_USERNS) && defined(HAVE_USERNS_IOPS_GETATTR)
++ generic_fillattr(user_ns, path->dentry->d_inode, stat);
++#else
+ generic_fillattr(path->dentry->d_inode, stat);
++#endif
+ stat->nlink = stat->size = 2;
+ stat->atime = current_time(ip);
+ ZPL_EXIT(zfsvfs);
+@@ -515,7 +556,11 @@ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
+
+ error = -zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp);
+ if (error == 0) {
+- error = -zfs_getattr_fast(ZTOI(dzp), stat);
++#if defined(HAVE_GENERIC_FILLATTR_USERNS) && defined(HAVE_USERNS_IOPS_GETATTR)
++ error = -zfs_getattr_fast(user_ns, ZTOI(dzp), stat);
++#else
++ error = -zfs_getattr_fast(kcred->user_ns, ZTOI(dzp), stat);
++#endif
+ iput(ZTOI(dzp));
+ }
+
+diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c
+index 80762f9669b..08bf97ff338 100644
+--- a/module/os/linux/zfs/zpl_file.c
++++ b/module/os/linux/zfs/zpl_file.c
+@@ -869,7 +869,7 @@ __zpl_ioctl_setflags(struct inode *ip, uint32_t ioctl_flags, xvattr_t *xva)
+ !capable(CAP_LINUX_IMMUTABLE))
+ return (-EACCES);
+
+- if (!inode_owner_or_capable(ip))
++ if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
+ return (-EACCES);
+
+ xva_init(xva);
+diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c
+index f336fbb1272..364b9fbef24 100644
+--- a/module/os/linux/zfs/zpl_inode.c
++++ b/module/os/linux/zfs/zpl_inode.c
+@@ -128,7 +128,12 @@ zpl_vap_init(vattr_t *vap, struct inode *dir, umode_t mode, cred_t *cr)
+ }
+
+ static int
++#ifdef HAVE_IOPS_CREATE_USERNS
++zpl_create(struct user_namespace *user_ns, 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)
++#endif
+ {
+ cred_t *cr = CRED();
+ znode_t *zp;
+@@ -163,7 +168,12 @@ 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,
++ struct dentry *dentry, umode_t mode,
++#else
+ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
++#endif
+ dev_t rdev)
+ {
+ cred_t *cr = CRED();
+@@ -278,7 +288,12 @@ zpl_unlink(struct inode *dir, struct dentry *dentry)
+ }
+
+ static int
++#ifdef HAVE_IOPS_MKDIR_USERNS
++zpl_mkdir(struct user_namespace *user_ns, struct inode *dir,
++ struct dentry *dentry, umode_t mode)
++#else
+ zpl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
++#endif
+ {
+ cred_t *cr = CRED();
+ vattr_t *vap;
+@@ -338,8 +353,14 @@ zpl_rmdir(struct inode *dir, struct dentry *dentry)
+ }
+
+ static int
++#ifdef HAVE_USERNS_IOPS_GETATTR
++zpl_getattr_impl(struct user_namespace *user_ns,
++ const struct path *path, struct kstat *stat, u32 request_mask,
++ unsigned int query_flags)
++#else
+ zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
++#endif
+ {
+ int error;
+ fstrans_cookie_t cookie;
+@@ -350,7 +371,11 @@ zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
+ * XXX request_mask and query_flags currently ignored.
+ */
+
+- error = -zfs_getattr_fast(path->dentry->d_inode, stat);
++#ifdef HAVE_USERNS_IOPS_GETATTR
++ error = -zfs_getattr_fast(user_ns, path->dentry->d_inode, stat);
++#else
++ error = -zfs_getattr_fast(kcred->user_ns, path->dentry->d_inode, stat);
++#endif
+ spl_fstrans_unmark(cookie);
+ ASSERT3S(error, <=, 0);
+
+@@ -359,7 +384,12 @@ zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
+ ZPL_GETATTR_WRAPPER(zpl_getattr);
+
+ static int
++#ifdef HAVE_SETATTR_PREPARE_USERNS
++zpl_setattr(struct user_namespace *user_ns, struct dentry *dentry,
++ struct iattr *ia)
++#else
+ zpl_setattr(struct dentry *dentry, struct iattr *ia)
++#endif
+ {
+ struct inode *ip = dentry->d_inode;
+ cred_t *cr = CRED();
+@@ -367,7 +397,7 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
+ int error;
+ fstrans_cookie_t cookie;
+
+- error = setattr_prepare(dentry, ia);
++ error = zpl_setattr_prepare(kcred->user_ns, dentry, ia);
+ if (error)
+ return (error);
+
+@@ -399,8 +429,14 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
+ }
+
+ static int
++#ifdef HAVE_IOPS_RENAME_USERNS
++zpl_rename2(struct user_namespace *user_ns, struct inode *sdip,
++ struct dentry *sdentry, struct inode *tdip, struct dentry *tdentry,
++ unsigned int flags)
++#else
+ zpl_rename2(struct inode *sdip, struct dentry *sdentry,
+ struct inode *tdip, struct dentry *tdentry, unsigned int flags)
++#endif
+ {
+ cred_t *cr = CRED();
+ int error;
+@@ -421,7 +457,7 @@ zpl_rename2(struct inode *sdip, struct dentry *sdentry,
+ return (error);
+ }
+
+-#ifndef HAVE_RENAME_WANTS_FLAGS
++#if !defined(HAVE_RENAME_WANTS_FLAGS) && !defined(HAVE_IOPS_RENAME_USERNS)
+ static int
+ zpl_rename(struct inode *sdip, struct dentry *sdentry,
+ struct inode *tdip, struct dentry *tdentry)
+@@ -431,7 +467,12 @@ zpl_rename(struct inode *sdip, struct dentry *sdentry,
+ #endif
+
+ static int
++#ifdef HAVE_IOPS_SYMLINK_USERNS
++zpl_symlink(struct user_namespace *user_ns, struct inode *dir,
++ struct dentry *dentry, const char *name)
++#else
+ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
++#endif
+ {
+ cred_t *cr = CRED();
+ vattr_t *vap;
+@@ -677,7 +718,7 @@ const struct inode_operations zpl_dir_inode_operations = {
+ .mkdir = zpl_mkdir,
+ .rmdir = zpl_rmdir,
+ .mknod = zpl_mknod,
+-#ifdef HAVE_RENAME_WANTS_FLAGS
++#if defined(HAVE_RENAME_WANTS_FLAGS) || defined(HAVE_IOPS_RENAME_USERNS)
+ .rename = zpl_rename2,
+ #else
+ .rename = zpl_rename,
+diff --git a/module/os/linux/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c
+index 1ec3dae2bb8..5e35f90df85 100644
+--- a/module/os/linux/zfs/zpl_xattr.c
++++ b/module/os/linux/zfs/zpl_xattr.c
+@@ -1233,7 +1233,7 @@ __zpl_xattr_acl_set_access(struct inode *ip, const char *name,
+ if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX)
+ return (-EOPNOTSUPP);
+
+- if (!inode_owner_or_capable(ip))
++ if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
+ return (-EPERM);
+
+ if (value) {
+@@ -1273,7 +1273,7 @@ __zpl_xattr_acl_set_default(struct inode *ip, const char *name,
+ if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX)
+ return (-EOPNOTSUPP);
+
+- if (!inode_owner_or_capable(ip))
++ if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
+ return (-EPERM);
+
+ if (value) {
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_iov_iter_advance.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_iov_iter_advance.patch
new file mode 100644
index 00000000000..95ecda34652
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_iov_iter_advance.patch
@@ -0,0 +1,40 @@
+From 3e0bc63e1b0ca03493b936e92e871ca7ae451a0a Mon Sep 17 00:00:00 2001
+From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
+Date: Tue, 1 Jun 2021 14:58:08 -0400
+Subject: [PATCH] Remove iov_iter_advance() for iter_write
+
+The additional iter advance is incorrect, as copy_from_iter() has
+already done the right thing. This will result in the following
+warning being printed to the console as of the 5.12 kernel.
+
+ Attempted to advance past end of bvec iter
+
+This change should have been included with #11378 when a
+similar change was made on the read side.
+
+Suggested-by: @siebenmann
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
+Issue #11378
+Closes #12041
+Closes #12155
+(cherry picked from commit 3f81aba7668143c6ca6fc44983d4c880606dea8f)
+Signed-off-by: Jonathon Fernyhough <jonathon@m2x.dev>
+---
+ module/os/linux/zfs/zpl_file.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c
+index 08bf97ff338..e20c1dd413c 100644
+--- a/module/os/linux/zfs/zpl_file.c
++++ b/module/os/linux/zfs/zpl_file.c
+@@ -342,9 +342,6 @@ zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)
+ ssize_t wrote = count - uio.uio_resid;
+ kiocb->ki_pos += wrote;
+
+- if (wrote > 0)
+- iov_iter_advance(from, wrote);
+-
+ return (wrote);
+ }
+
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_tmpfile.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_tmpfile.patch
new file mode 100644
index 00000000000..08acee82148
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_tmpfile.patch
@@ -0,0 +1,89 @@
+From 6eced028dbbc2a44e32c4c0a76234ac2da9a365a Mon Sep 17 00:00:00 2001
+From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
+Date: Thu, 20 May 2021 19:02:36 -0400
+Subject: [PATCH] Update tmpfile() existence detection
+
+Linux changed the tmpfile() signature again in torvalds/linux@6521f89,
+which in turn broke our HAVE_TMPFILE detection in configure.
+
+Update that macro to include the new case, and change the signature of
+zpl_tmpfile as appropriate.
+
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
+Closes: #12060
+Closes: #12087
+---
+ config/kernel-tmpfile.m4 | 28 ++++++++++++++++++++++++----
+ module/os/linux/zfs/zpl_inode.c | 5 +++++
+ 2 files changed, 29 insertions(+), 4 deletions(-)
+
+diff --git a/config/kernel-tmpfile.m4 b/config/kernel-tmpfile.m4
+index f510bfe6ba0..45c2e6ceea5 100644
+--- a/config/kernel-tmpfile.m4
++++ b/config/kernel-tmpfile.m4
+@@ -3,23 +3,43 @@ dnl # 3.11 API change
+ dnl # Add support for i_op->tmpfile
+ dnl #
+ AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
+- ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
++ dnl #
++ dnl # 5.11 API change
++ dnl # add support for userns parameter to tmpfile
++ dnl #
++ ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_userns], [
+ #include <linux/fs.h>
+- int tmpfile(struct inode *inode, struct dentry *dentry,
++ int tmpfile(struct user_namespace *userns,
++ struct inode *inode, struct dentry *dentry,
+ umode_t mode) { return 0; }
+ static struct inode_operations
+ iops __attribute__ ((unused)) = {
+ .tmpfile = tmpfile,
+ };
+ ],[])
++ ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
++ #include <linux/fs.h>
++ int tmpfile(struct inode *inode, struct dentry *dentry,
++ umode_t mode) { return 0; }
++ static struct inode_operations
++ iops __attribute__ ((unused)) = {
++ .tmpfile = tmpfile,
++ };
++ ],[])
+ ])
+
+ AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
+ AC_MSG_CHECKING([whether i_op->tmpfile() exists])
+- ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
++ ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_userns], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
++ AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
+ ],[
+- AC_MSG_RESULT(no)
++ ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
++ ],[
++ AC_MSG_RESULT(no)
++ ])
+ ])
+ ])
+diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c
+index 364b9fbef24..ab0373ef9ba 100644
+--- a/module/os/linux/zfs/zpl_inode.c
++++ b/module/os/linux/zfs/zpl_inode.c
+@@ -218,7 +218,12 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
+
+ #ifdef HAVE_TMPFILE
+ static int
++#ifdef HAVE_TMPFILE_USERNS
++zpl_tmpfile(struct user_namespace *userns, struct inode *dir,
++ struct dentry *dentry, umode_t mode)
++#else
+ zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
++#endif
+ {
+ cred_t *cr = CRED();
+ struct inode *ip;
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_userns.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_userns.patch
new file mode 100644
index 00000000000..1d8530ec8c6
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_userns.patch
@@ -0,0 +1,173 @@
+From b3f8b103cb3a4bbb7ad41f6faf630be7baa4f585 Mon Sep 17 00:00:00 2001
+From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
+Date: Thu, 27 May 2021 11:55:49 -0400
+Subject: [PATCH] Bend zpl_set_acl to permit the new userns* parameter
+
+Just like #12087, the set_acl signature changed with all the bolted-on
+*userns parameters, which disabled set_acl usage, and caused #12076.
+
+Turn zpl_set_acl into zpl_set_acl and zpl_set_acl_impl, and add a
+new configure test for the new version.
+
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
+Closes #12076
+Closes #12093
+---
+ config/kernel-acl.m4 | 25 +++++++++++++++++++++--
+ include/os/linux/zfs/sys/zpl.h | 5 +++++
+ module/os/linux/zfs/zpl_xattr.c | 35 ++++++++++++++++++++++-----------
+ 3 files changed, 51 insertions(+), 14 deletions(-)
+
+diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4
+index e02ce665323..c6da4df24eb 100644
+--- a/config/kernel-acl.m4
++++ b/config/kernel-acl.m4
+@@ -189,7 +189,22 @@ dnl #
+ dnl # 3.14 API change,
+ dnl # Check if inode_operations contains the function set_acl
+ dnl #
++dnl # 5.12 API change,
++dnl # set_acl() added a user_namespace* parameter first
++dnl #
+ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
++ ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [
++ #include <linux/fs.h>
++
++ int set_acl_fn(struct user_namespace *userns,
++ struct inode *inode, struct posix_acl *acl,
++ int type) { return 0; }
++
++ static const struct inode_operations
++ iops __attribute__ ((unused)) = {
++ .set_acl = set_acl_fn,
++ };
++ ],[])
+ ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
+ #include <linux/fs.h>
+
+@@ -205,11 +220,17 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
+
+ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
+ AC_MSG_CHECKING([whether iops->set_acl() exists])
+- ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
++ ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
++ AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
+ ],[
+- AC_MSG_RESULT(no)
++ ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists, takes 3 args])
++ ],[
++ AC_MSG_RESULT(no)
++ ])
+ ])
+ ])
+
+diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h
+index 21825d1f378..54f3fa0fdb0 100644
+--- a/include/os/linux/zfs/sys/zpl.h
++++ b/include/os/linux/zfs/sys/zpl.h
+@@ -63,7 +63,12 @@ extern int zpl_xattr_security_init(struct inode *ip, struct inode *dip,
+ const struct qstr *qstr);
+ #if defined(CONFIG_FS_POSIX_ACL)
+ #if defined(HAVE_SET_ACL)
++#if defined(HAVE_SET_ACL_USERNS)
++extern int zpl_set_acl(struct user_namespace *userns, struct inode *ip,
++ struct posix_acl *acl, int type);
++#else
+ extern int zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type);
++#endif /* HAVE_SET_ACL_USERNS */
+ #endif /* HAVE_SET_ACL */
+ extern struct posix_acl *zpl_get_acl(struct inode *ip, int type);
+ extern int zpl_init_acl(struct inode *ip, struct inode *dir);
+diff --git a/module/os/linux/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c
+index 5e35f90df85..89ba9de14f6 100644
+--- a/module/os/linux/zfs/zpl_xattr.c
++++ b/module/os/linux/zfs/zpl_xattr.c
+@@ -926,11 +926,8 @@ xattr_handler_t zpl_xattr_security_handler = {
+ * attribute implemented by filesystems in the kernel." - xattr(7)
+ */
+ #ifdef CONFIG_FS_POSIX_ACL
+-#ifndef HAVE_SET_ACL
+-static
+-#endif
+-int
+-zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type)
++static int
++zpl_set_acl_impl(struct inode *ip, struct posix_acl *acl, int type)
+ {
+ char *name, *value = NULL;
+ int error = 0;
+@@ -1002,6 +999,19 @@ zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type)
+ return (error);
+ }
+
++#ifdef HAVE_SET_ACL
++int
++#ifdef HAVE_SET_ACL_USERNS
++zpl_set_acl(struct user_namespace *userns, struct inode *ip,
++ struct posix_acl *acl, int type)
++#else
++zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type)
++#endif /* HAVE_SET_ACL_USERNS */
++{
++ return (zpl_set_acl_impl(ip, acl, type));
++}
++#endif /* HAVE_SET_ACL */
++
+ struct posix_acl *
+ zpl_get_acl(struct inode *ip, int type)
+ {
+@@ -1083,7 +1093,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
+ umode_t mode;
+
+ if (S_ISDIR(ip->i_mode)) {
+- error = zpl_set_acl(ip, acl, ACL_TYPE_DEFAULT);
++ error = zpl_set_acl_impl(ip, acl, ACL_TYPE_DEFAULT);
+ if (error)
+ goto out;
+ }
+@@ -1093,8 +1103,10 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
+ if (error >= 0) {
+ ip->i_mode = mode;
+ zfs_mark_inode_dirty(ip);
+- if (error > 0)
+- error = zpl_set_acl(ip, acl, ACL_TYPE_ACCESS);
++ if (error > 0) {
++ error = zpl_set_acl_impl(ip, acl,
++ ACL_TYPE_ACCESS);
++ }
+ }
+ }
+ out:
+@@ -1121,7 +1133,7 @@ zpl_chmod_acl(struct inode *ip)
+
+ error = __posix_acl_chmod(&acl, GFP_KERNEL, ip->i_mode);
+ if (!error)
+- error = zpl_set_acl(ip, acl, ACL_TYPE_ACCESS);
++ error = zpl_set_acl_impl(ip, acl, ACL_TYPE_ACCESS);
+
+ zpl_posix_acl_release(acl);
+
+@@ -1250,8 +1262,7 @@ __zpl_xattr_acl_set_access(struct inode *ip, const char *name,
+ } else {
+ acl = NULL;
+ }
+-
+- error = zpl_set_acl(ip, acl, type);
++ error = zpl_set_acl_impl(ip, acl, type);
+ zpl_posix_acl_release(acl);
+
+ return (error);
+@@ -1291,7 +1302,7 @@ __zpl_xattr_acl_set_default(struct inode *ip, const char *name,
+ acl = NULL;
+ }
+
+- error = zpl_set_acl(ip, acl, type);
++ error = zpl_set_acl_impl(ip, acl, type);
+ zpl_posix_acl_release(acl);
+
+ return (error);
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch
new file mode 100644
index 00000000000..3448f76a801
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch
@@ -0,0 +1,59 @@
+From 783784582225e8ddfbf07993d9fc278bf08025c5 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Thu, 3 Jun 2021 13:37:45 -0700
+Subject: [PATCH] Linux: Set spl_kmem_cache_slab_limit when page size !4K
+
+For small objects the kernel's slab implementation is very fast and
+space efficient. However, as the allocation size increases to
+require multiple pages performance suffers. The SPL kmem cache
+allocator was designed to better handle these large allocation
+sizes. Therefore, on Linux the kmem_cache_* compatibility wrappers
+prefer to use the kernel's slab allocator for small objects and
+the custom SPL kmem cache allocator for larger objects.
+
+This logic was effectively disabled for all architectures using
+a non-4K page size which caused all kmem caches to only use the
+SPL implementation. Functionally this is fine, but the SPL code
+which calculates the target number of objects per-slab does not
+take in to account that __vmalloc() always returns page-aligned
+memory. This can result in a massive amount of wasted space when
+allocating tiny objects on a platform using large pages (64k).
+
+To resolve this issue we set the spl_kmem_cache_slab_limit cutoff
+to 16K for all architectures.
+
+This particular change does not attempt to update the logic used
+to calculate the optimal number of pages per slab. This remains
+an issue which should be addressed in a future change.
+
+Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
+Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Closes #12152
+Closes #11429
+Closes #11574
+Closes #12150
+---
+ module/os/linux/spl/spl-kmem-cache.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c
+index 3699b6a159a..2151ef008fd 100644
+--- a/module/os/linux/spl/spl-kmem-cache.c
++++ b/module/os/linux/spl/spl-kmem-cache.c
+@@ -100,13 +100,10 @@ MODULE_PARM_DESC(spl_kmem_cache_max_size, "Maximum size of slab in MB");
+ * For small objects the Linux slab allocator should be used to make the most
+ * efficient use of the memory. However, large objects are not supported by
+ * the Linux slab and therefore the SPL implementation is preferred. A cutoff
+- * of 16K was determined to be optimal for architectures using 4K pages.
++ * of 16K was determined to be optimal for architectures using 4K pages and
++ * to also work well on architecutres using larger 64K page sizes.
+ */
+-#if PAGE_SIZE == 4096
+ unsigned int spl_kmem_cache_slab_limit = 16384;
+-#else
+-unsigned int spl_kmem_cache_slab_limit = 0;
+-#endif
+ module_param(spl_kmem_cache_slab_limit, uint, 0644);
+ MODULE_PARM_DESC(spl_kmem_cache_slab_limit,
+ "Objects less than N bytes use the Linux slab");
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_stream_resume.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_stream_resume.patch
new file mode 100644
index 00000000000..196fab65f4a
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-8.0.4_stream_resume.patch
@@ -0,0 +1,33 @@
+From ee2a9d2c771657168652e058477b81389c662b5e Mon Sep 17 00:00:00 2001
+From: Paul Zuchowski <31706010+PaulZ-98@users.noreply.github.com>
+Date: Fri, 14 May 2021 00:46:14 -0400
+Subject: [PATCH] Fix dmu_recv_stream test for resumable
+
+Use dsl_dataset_has_resume_receive_state()
+not dsl_dataset_is_zapified() to check if
+stream is resumable.
+
+Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
+Reviewed-by: Alek Pinchuk <apinchuk@axcient.com>
+Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
+Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
+Closes #12034
+---
+ module/zfs/dmu_recv.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/module/zfs/dmu_recv.c b/module/zfs/dmu_recv.c
+index b5414749f7f..f44b397853f 100644
+--- a/module/zfs/dmu_recv.c
++++ b/module/zfs/dmu_recv.c
+@@ -2878,8 +2878,8 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, offset_t *voffp)
+ int err = 0;
+ struct receive_writer_arg *rwa = kmem_zalloc(sizeof (*rwa), KM_SLEEP);
+
+- if (dsl_dataset_is_zapified(drc->drc_ds)) {
+- uint64_t bytes;
++ if (dsl_dataset_has_resume_receive_state(drc->drc_ds)) {
++ uint64_t bytes = 0;
+ (void) zap_lookup(drc->drc_ds->ds_dir->dd_pool->dp_meta_objset,
+ drc->drc_ds->ds_object, DS_FIELD_RESUME_BYTES,
+ sizeof (bytes), 1, &bytes);
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild
new file mode 100644
index 00000000000..505ae6384ef
--- /dev/null
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild
@@ -0,0 +1,186 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
+
+DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
+HOMEPAGE="https://github.com/openzfs/zfs"
+
+if [[ ${PV} == "9999" ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
+else
+ MY_PV="${PV/_rc/-rc}"
+ SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
+ KEYWORDS="~amd64 ~arm64 ~ppc64"
+ S="${WORKDIR}/zfs-${PV%_rc?}"
+ ZFS_KERNEL_COMPAT="5.12"
+fi
+
+LICENSE="CDDL MIT debug? ( GPL-2+ )"
+SLOT="0"
+IUSE="custom-cflags debug +rootfs"
+
+DEPEND=""
+
+RDEPEND="${DEPEND}
+ !sys-kernel/spl
+"
+
+BDEPEND="
+ dev-lang/perl
+ virtual/awk
+"
+
+RESTRICT="debug? ( strip ) test"
+
+DOCS=( AUTHORS COPYRIGHT META README.md )
+
+PATCHES=(
+ "${FILESDIR}"/zfs-8.0.4_5.12_compat_idmapped_mounts.patch
+ "${FILESDIR}"/zfs-8.0.4_5.12_compat_bio_max_segs.patch
+ "${FILESDIR}"/zfs-8.0.4_5.12_compat_tmpfile.patch
+ "${FILESDIR}"/zfs-8.0.4_5.12_compat_userns.patch
+ "${FILESDIR}"/zfs-8.0.4_5.12_compat_iov_iter_advance.patch
+ "${FILESDIR}"/zfs-8.0.4_stream_resume.patch
+ "${FILESDIR}"/zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch
+)
+
+pkg_setup() {
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ EFI_PARTITION
+ MODULES
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !TRIM_UNUSED_KSYMS
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ use rootfs && \
+ CONFIG_CHECK="${CONFIG_CHECK}
+ BLK_DEV_INITRD
+ DEVTMPFS
+ "
+
+ kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
+
+ if [[ ${PV} != "9999" ]]; then
+ local kv_major_max kv_minor_max zcompat
+ zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ kv_major_max="${zcompat%%.*}"
+ zcompat="${zcompat#*.}"
+ kv_minor_max="${zcompat%%.*}"
+ kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
+ "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
+
+ fi
+
+ kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
+
+ linux-mod_pkg_setup
+}
+
+src_prepare() {
+ default
+ eautoreconf
+ # Set module revision number
+ sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
+}
+
+src_configure() {
+ set_arch_to_kernel
+
+ use custom-cflags || strip-flags
+
+ filter-ldflags -Wl,*
+
+ local myconf=(
+ CROSS_COMPILE="${CHOST}-"
+ HOSTCC="$(tc-getBUILD_CC)"
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=kernel
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ set_arch_to_kernel
+
+ myemakeargs=(
+ CROSS_COMPILE="${CHOST}-"
+ HOSTCC="$(tc-getBUILD_CC)"
+ V=1
+ )
+
+ emake "${myemakeargs[@]}"
+}
+
+src_install() {
+ set_arch_to_kernel
+
+ myemakeargs+=(
+ DEPMOD=:
+ DESTDIR="${D}"
+ INSTALL_MOD_PATH="${EPREFIX:-/}" # lib/modules/<kver> added by KBUILD
+ )
+
+ emake "${myemakeargs[@]}" install
+
+ einstalldocs
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ # Remove old modules
+ if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
+ ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
+ ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
+ ewarn "Automatically removing old modules to avoid problems."
+ rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
+ rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon"
+ fi
+
+ if [[ -z ${ROOT} ]] && use dist-kernel; then
+ set_arch_to_portage
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ fi
+
+ if use x86 || use arm; then
+ ewarn "32-bit kernels will likely require increasing vmalloc to"
+ ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
+ fi
+
+ ewarn "This version of OpenZFS includes support for new feature flags"
+ ewarn "that are incompatible with previous versions. GRUB2 support for"
+ ewarn "/boot with the new feature flags is not yet available."
+ ewarn "Do *NOT* upgrade root pools to use the new feature flags."
+ ewarn "Any new pools will be created with the new feature flags by default"
+ ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
+ ewarn "create a newpool that is backward compatible wih GRUB2, use "
+ ewarn
+ ewarn "zpool create -d -o feature@async_destroy=enabled "
+ ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
+ ewarn " -o feature@spacemap_histogram=enabled"
+ ewarn " -o feature@enabled_txg=enabled "
+ ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
+ ewarn " ..."
+ ewarn
+ ewarn "GRUB2 support will be updated as soon as either the GRUB2"
+ ewarn "developers do a tag or the Gentoo developers find time to backport"
+ ewarn "support from GRUB2 HEAD."
+}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2021-06-09 5:20 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2021-06-09 5:20 UTC (permalink / raw
To: gentoo-commits
commit: f432437d19a693b4ad7515335a87e61d87df60b2
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 9 01:18:10 2021 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Wed Jun 9 05:19:54 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f432437d
sys-fs/zfs-kmod: fix a patch that's too large
Package-Manager: Portage-3.0.19, Repoman-3.0.3
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 1 +
.../zfs-8.0.4_5.12_compat_idmapped_mounts.patch | 1231 --------------------
sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild | 5 +-
3 files changed, 4 insertions(+), 1233 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index 514e285239e..272fa8bfaa3 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -2,3 +2,4 @@ DIST zfs-0.8.6.tar.gz 9295260 BLAKE2B 45424d710aaf75a05f766ae523ae157a24b5cbdcef
DIST zfs-2.0.4.tar.gz 13123872 BLAKE2B 7e4780092c0a87d5d187cd5734ddc736574db80b500f155287640ef2230e09335cc9b6b26ec1b7d8ab1b7942673ea49a3007a81da372a6d2ac36f3908913045c SHA512 1dda92d424372bce7020f5215545485eae69211b6f0fb6bea3c7c22efac76c6a2662f0dd14a03f723b6a6fe73b1228ecca211a4034b86cf885bcadf38ba0dc6b
DIST zfs-2.1.0-rc6.tar.gz 34777294 BLAKE2B 0080b03a9cf9717ae2bc7674e340dffafd923467368d8941df9be5a21f081e88745297e1a8b2ac5059e9f346949bbeb759a5fc8bcdb60c3be49b0645389ec8b1 SHA512 696d525c1c738a508d04366f8ffd0142aebe4498efbf129c9d38fa7c67dbec83554f55a2c4a5d7647a03ca0df173c2720fe85edbc859195f4ca19e04d2adf143
DIST zfs-2.1.0-rc6.tar.gz.asc 195 BLAKE2B a1267b8faffc75ac70082e261c6053b2070cbad014c92051ebc82af56b21bbe2e72e01e44c0701ed255a3201330bb56b5e1a72e12c1ae9f15f72883b53c17ec6 SHA512 afc0eb839de6b0b21b3d781dd74dce9f6f668b7b9fc079ea764666e28d4d3228b8a80641b6d0084851bffedfc3406dc0f829242f6b4247d192f554ba45ce3a4c
+DIST zfs-8.0.4_5.12_compat_idmapped_mounts.patch 41410 BLAKE2B 49724351c5a8e6ffa66762d5aac84ad89a3d04022d086d9f37ccd616b3e8e95852197b5333bdeeeab54fc51516d8254d0138a4422cc66214bb602e5ed72bbabf SHA512 1554d74a7024c106a3f4814895a64914f2e3d627f7edff3c8f415b419c6a596454862f8c0984a6e2f96e340851f1a9222a4c472ebd6d5db7dc0aa108dc2dca6c
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_idmapped_mounts.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_idmapped_mounts.patch
deleted file mode 100644
index fd8b025a8fd..00000000000
--- a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_idmapped_mounts.patch
+++ /dev/null
@@ -1,1231 +0,0 @@
-From f315d9a3ff3cc0b81c99dd9be5878a55d2e98d8e Mon Sep 17 00:00:00 2001
-From: Coleman Kane <ckane@colemankane.org>
-Date: Sat, 20 Mar 2021 00:00:59 -0400
-Subject: [PATCH] Linux 5.12 compat: idmapped mounts
-
-In Linux 5.12, the filesystem API was modified to support ipmapped
-mounts by adding a "struct user_namespace *" parameter to a number
-functions and VFS handlers. This change adds the needed autoconf
-macros to detect the new interfaces and updates the code appropriately.
-This change does not add support for idmapped mounts, instead it
-preserves the existing behavior by passing the initial user namespace
-where needed. A subsequent commit will be required to add support
-for idmapped mounted.
-
-Reviewed-by: Tony Hutter <hutter2@llnl.gov>
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Coleman Kane <ckane@colemankane.org>
-Closes #11712
-(cherry picked from commit e2a8296131e94ad785f5564156ed2db1fdb2e080)
-Signed-off-by: Jonathon Fernyhough <jonathon@m2x.dev>
----
- config/kernel-generic_fillattr.m4 | 28 +++++++
- config/kernel-inode-create.m4 | 43 +++++++++--
- config/kernel-inode-getattr.m4 | 63 +++++++++++++---
- config/kernel-is_owner_or_cap.m4 | 23 +++++-
- config/kernel-mkdir-umode-t.m4 | 32 --------
- config/kernel-mkdir.m4 | 65 ++++++++++++++++
- config/kernel-mknod.m4 | 30 ++++++++
- config/kernel-rename.m4 | 50 ++++++++++---
- config/kernel-setattr-prepare.m4 | 45 ++++++++---
- config/kernel-symlink.m4 | 30 ++++++++
- config/kernel-xattr-handler.m4 | 78 +++++++++++++-------
- config/kernel.m4 | 18 +++--
- 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/zpl.h | 18 +++++
- module/os/linux/zfs/policy.c | 2 +-
- module/os/linux/zfs/zfs_vnops_os.c | 5 +-
- module/os/linux/zfs/zpl_ctldir.c | 51 ++++++++++++-
- module/os/linux/zfs/zpl_file.c | 2 +-
- module/os/linux/zfs/zpl_inode.c | 49 +++++++++++-
- module/os/linux/zfs/zpl_xattr.c | 4 +-
- 22 files changed, 557 insertions(+), 123 deletions(-)
- create mode 100644 config/kernel-generic_fillattr.m4
- delete mode 100644 config/kernel-mkdir-umode-t.m4
- create mode 100644 config/kernel-mkdir.m4
- create mode 100644 config/kernel-mknod.m4
- create mode 100644 config/kernel-symlink.m4
-
-diff --git a/config/kernel-generic_fillattr.m4 b/config/kernel-generic_fillattr.m4
-new file mode 100644
-index 00000000000..50c8031305b
---- /dev/null
-+++ b/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/config/kernel-inode-create.m4 b/config/kernel-inode-create.m4
-index 9f28bcbd4f7..a6ea11fb61b 100644
---- a/config/kernel-inode-create.m4
-+++ b/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/config/kernel-inode-getattr.m4 b/config/kernel-inode-getattr.m4
-index 48391d66f8b..f62e82f5230 100644
---- a/config/kernel-inode-getattr.m4
-+++ b/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/config/kernel-is_owner_or_cap.m4 b/config/kernel-is_owner_or_cap.m4
-index 3df6163da27..3c3c6ad2240 100644
---- a/config/kernel-is_owner_or_cap.m4
-+++ b/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/config/kernel-mkdir-umode-t.m4 b/config/kernel-mkdir-umode-t.m4
-deleted file mode 100644
-index 19599670df3..00000000000
---- a/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/config/kernel-mkdir.m4 b/config/kernel-mkdir.m4
-new file mode 100644
-index 00000000000..a162bcd880f
---- /dev/null
-+++ b/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/config/kernel-mknod.m4 b/config/kernel-mknod.m4
-new file mode 100644
-index 00000000000..ffe45106003
---- /dev/null
-+++ b/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/config/kernel-rename.m4 b/config/kernel-rename.m4
-index f707391539d..31d199f33bb 100644
---- a/config/kernel-rename.m4
-+++ b/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/config/kernel-setattr-prepare.m4 b/config/kernel-setattr-prepare.m4
-index 45408c45c69..24245aa5344 100644
---- a/config/kernel-setattr-prepare.m4
-+++ b/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/config/kernel-symlink.m4 b/config/kernel-symlink.m4
-new file mode 100644
-index 00000000000..d90366d04b7
---- /dev/null
-+++ b/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/config/kernel-xattr-handler.m4 b/config/kernel-xattr-handler.m4
-index 137bf4a8aff..00b1e74a9cc 100644
---- a/config/kernel-xattr-handler.m4
-+++ b/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/config/kernel.m4 b/config/kernel.m4
-index 55620b3daa8..51c7fb926ec 100644
---- a/config/kernel.m4
-+++ b/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
-@@ -124,6 +124,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
- ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES
- ZFS_AC_KERNEL_SRC_KSTRTOUL
- ZFS_AC_KERNEL_SRC_PERCPU
-+ ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS
-+ ZFS_AC_KERNEL_SRC_MKNOD
-+ ZFS_AC_KERNEL_SRC_SYMLINK
-
- AC_MSG_CHECKING([for available kernel interfaces])
- ZFS_LINUX_TEST_COMPILE_ALL([kabi])
-@@ -176,9 +179,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
-@@ -212,7 +215,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
-@@ -221,6 +224,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
- ZFS_AC_KERNEL_TOTALHIGH_PAGES
- ZFS_AC_KERNEL_KSTRTOUL
- ZFS_AC_KERNEL_PERCPU
-+ ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS
-+ ZFS_AC_KERNEL_MKNOD
-+ ZFS_AC_KERNEL_SYMLINK
- ])
-
- dnl #
-diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h
-index c35e80d31cd..91e908598fb 100644
---- a/include/os/linux/kernel/linux/vfs_compat.h
-+++ b/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/include/os/linux/kernel/linux/xattr_compat.h b/include/os/linux/kernel/linux/xattr_compat.h
-index 8348e99198a..54690727eab 100644
---- a/include/os/linux/kernel/linux/xattr_compat.h
-+++ b/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)); \
-+}
- /*
- * 4.7 API change,
- * The xattr_handler->set() callback was changed to take a both dentry and
- * inode, because the dentry might not be attached to an inode yet.
- */
--#if defined(HAVE_XATTR_SET_DENTRY_INODE)
-+#elif defined(HAVE_XATTR_SET_DENTRY_INODE)
- #define ZPL_XATTR_SET_WRAPPER(fn) \
- static int \
- fn(const struct xattr_handler *handler, struct dentry *dentry, \
-diff --git a/include/os/linux/zfs/sys/zfs_vnops_os.h b/include/os/linux/zfs/sys/zfs_vnops_os.h
-index 1c9cdf7bf8f..ba83f5dd83d 100644
---- a/include/os/linux/zfs/sys/zfs_vnops_os.h
-+++ b/include/os/linux/zfs/sys/zfs_vnops_os.h
-@@ -56,7 +56,8 @@ extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap,
- extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd,
- cred_t *cr, int flags);
- extern int zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr);
--extern int zfs_getattr_fast(struct inode *ip, struct kstat *sp);
-+extern int zfs_getattr_fast(struct user_namespace *, struct inode *ip,
-+ struct kstat *sp);
- extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr);
- extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp,
- char *tnm, cred_t *cr, int flags);
-diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h
-index b0bb9c29c0b..21825d1f378 100644
---- a/include/os/linux/zfs/sys/zpl.h
-+++ b/include/os/linux/zfs/sys/zpl.h
-@@ -171,4 +171,22 @@ zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
- timespec_trunc(ts, (ip)->i_sb->s_time_gran)
- #endif
-
-+#if defined(HAVE_INODE_OWNER_OR_CAPABLE)
-+#define zpl_inode_owner_or_capable(ns, ip) inode_owner_or_capable(ip)
-+#elif defined(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED)
-+#define zpl_inode_owner_or_capable(ns, ip) inode_owner_or_capable(ns, ip)
-+#else
-+#error "Unsupported kernel"
-+#endif
-+
-+#ifdef HAVE_SETATTR_PREPARE_USERNS
-+#define zpl_setattr_prepare(ns, dentry, ia) setattr_prepare(ns, dentry, ia)
-+#else
-+/*
-+ * Use kernel-provided version, or our own from
-+ * linux/vfs_compat.h
-+ */
-+#define zpl_setattr_prepare(ns, dentry, ia) setattr_prepare(dentry, ia)
-+#endif
-+
- #endif /* _SYS_ZPL_H */
-diff --git a/module/os/linux/zfs/policy.c b/module/os/linux/zfs/policy.c
-index 8780d7f6c70..bbccb2e572d 100644
---- a/module/os/linux/zfs/policy.c
-+++ b/module/os/linux/zfs/policy.c
-@@ -124,7 +124,7 @@ secpolicy_vnode_any_access(const cred_t *cr, struct inode *ip, uid_t owner)
- if (crgetfsuid(cr) == owner)
- return (0);
-
-- if (inode_owner_or_capable(ip))
-+ if (zpl_inode_owner_or_capable(kcred->user_ns, ip))
- return (0);
-
- #if defined(CONFIG_USER_NS)
-diff --git a/module/os/linux/zfs/zfs_vnops_os.c b/module/os/linux/zfs/zfs_vnops_os.c
-index 7484d651c1f..ce0701763fd 100644
---- a/module/os/linux/zfs/zfs_vnops_os.c
-+++ b/module/os/linux/zfs/zfs_vnops_os.c
-@@ -1907,7 +1907,8 @@ zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr)
- */
- /* ARGSUSED */
- int
--zfs_getattr_fast(struct inode *ip, struct kstat *sp)
-+zfs_getattr_fast(struct user_namespace *user_ns, struct inode *ip,
-+ struct kstat *sp)
- {
- znode_t *zp = ITOZ(ip);
- zfsvfs_t *zfsvfs = ITOZSB(ip);
-@@ -1919,7 +1920,7 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp)
-
- mutex_enter(&zp->z_lock);
-
-- generic_fillattr(ip, sp);
-+ zpl_generic_fillattr(user_ns, ip, sp);
- /*
- * +1 link count for root inode with visible '.zfs' directory.
- */
-diff --git a/module/os/linux/zfs/zpl_ctldir.c b/module/os/linux/zfs/zpl_ctldir.c
-index e6420f19ed8..9b526afd000 100644
---- a/module/os/linux/zfs/zpl_ctldir.c
-+++ b/module/os/linux/zfs/zpl_ctldir.c
-@@ -101,12 +101,22 @@ zpl_root_readdir(struct file *filp, void *dirent, filldir_t filldir)
- */
- /* ARGSUSED */
- static int
-+#ifdef HAVE_USERNS_IOPS_GETATTR
-+zpl_root_getattr_impl(struct user_namespace *user_ns,
-+ const struct path *path, struct kstat *stat, u32 request_mask,
-+ unsigned int query_flags)
-+#else
- zpl_root_getattr_impl(const struct path *path, struct kstat *stat,
- u32 request_mask, unsigned int query_flags)
-+#endif
- {
- struct inode *ip = path->dentry->d_inode;
-
-+#if defined(HAVE_GENERIC_FILLATTR_USERNS) && defined(HAVE_USERNS_IOPS_GETATTR)
-+ generic_fillattr(user_ns, ip, stat);
-+#else
- generic_fillattr(ip, stat);
-+#endif
- stat->atime = current_time(ip);
-
- return (0);
-@@ -290,8 +300,14 @@ zpl_snapdir_readdir(struct file *filp, void *dirent, filldir_t filldir)
- #endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
-
- static int
-+#ifdef HAVE_IOPS_RENAME_USERNS
-+zpl_snapdir_rename2(struct user_namespace *user_ns, struct inode *sdip,
-+ struct dentry *sdentry, struct inode *tdip, struct dentry *tdentry,
-+ unsigned int flags)
-+#else
- zpl_snapdir_rename2(struct inode *sdip, struct dentry *sdentry,
- struct inode *tdip, struct dentry *tdentry, unsigned int flags)
-+#endif
- {
- cred_t *cr = CRED();
- int error;
-@@ -309,7 +325,7 @@ zpl_snapdir_rename2(struct inode *sdip, struct dentry *sdentry,
- return (error);
- }
-
--#ifndef HAVE_RENAME_WANTS_FLAGS
-+#if !defined(HAVE_RENAME_WANTS_FLAGS) && !defined(HAVE_IOPS_RENAME_USERNS)
- static int
- zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry,
- struct inode *tdip, struct dentry *tdentry)
-@@ -333,7 +349,12 @@ zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry)
- }
-
- static int
-+#ifdef HAVE_IOPS_MKDIR_USERNS
-+zpl_snapdir_mkdir(struct user_namespace *user_ns, struct inode *dip,
-+ struct dentry *dentry, umode_t mode)
-+#else
- zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
-+#endif
- {
- cred_t *cr = CRED();
- vattr_t *vap;
-@@ -363,14 +384,24 @@ zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
- */
- /* ARGSUSED */
- static int
-+#ifdef HAVE_USERNS_IOPS_GETATTR
-+zpl_snapdir_getattr_impl(struct user_namespace *user_ns,
-+ const struct path *path, struct kstat *stat, u32 request_mask,
-+ unsigned int query_flags)
-+#else
- zpl_snapdir_getattr_impl(const struct path *path, struct kstat *stat,
- u32 request_mask, unsigned int query_flags)
-+#endif
- {
- struct inode *ip = path->dentry->d_inode;
- zfsvfs_t *zfsvfs = ITOZSB(ip);
-
- ZPL_ENTER(zfsvfs);
-+#if defined(HAVE_GENERIC_FILLATTR_USERNS) && defined(HAVE_USERNS_IOPS_GETATTR)
-+ generic_fillattr(user_ns, ip, stat);
-+#else
- generic_fillattr(ip, stat);
-+#endif
-
- stat->nlink = stat->size = 2;
- stat->ctime = stat->mtime = dmu_objset_snap_cmtime(zfsvfs->z_os);
-@@ -408,7 +439,7 @@ const struct file_operations zpl_fops_snapdir = {
- const struct inode_operations zpl_ops_snapdir = {
- .lookup = zpl_snapdir_lookup,
- .getattr = zpl_snapdir_getattr,
--#ifdef HAVE_RENAME_WANTS_FLAGS
-+#if defined(HAVE_RENAME_WANTS_FLAGS) || defined(HAVE_IOPS_RENAME_USERNS)
- .rename = zpl_snapdir_rename2,
- #else
- .rename = zpl_snapdir_rename,
-@@ -495,8 +526,14 @@ zpl_shares_readdir(struct file *filp, void *dirent, filldir_t filldir)
-
- /* ARGSUSED */
- static int
-+#ifdef HAVE_USERNS_IOPS_GETATTR
-+zpl_shares_getattr_impl(struct user_namespace *user_ns,
-+ const struct path *path, struct kstat *stat, u32 request_mask,
-+ unsigned int query_flags)
-+#else
- zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
- u32 request_mask, unsigned int query_flags)
-+#endif
- {
- struct inode *ip = path->dentry->d_inode;
- zfsvfs_t *zfsvfs = ITOZSB(ip);
-@@ -506,7 +543,11 @@ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
- ZPL_ENTER(zfsvfs);
-
- if (zfsvfs->z_shares_dir == 0) {
-+#if defined(HAVE_GENERIC_FILLATTR_USERNS) && defined(HAVE_USERNS_IOPS_GETATTR)
-+ generic_fillattr(user_ns, path->dentry->d_inode, stat);
-+#else
- generic_fillattr(path->dentry->d_inode, stat);
-+#endif
- stat->nlink = stat->size = 2;
- stat->atime = current_time(ip);
- ZPL_EXIT(zfsvfs);
-@@ -515,7 +556,11 @@ zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
-
- error = -zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp);
- if (error == 0) {
-- error = -zfs_getattr_fast(ZTOI(dzp), stat);
-+#if defined(HAVE_GENERIC_FILLATTR_USERNS) && defined(HAVE_USERNS_IOPS_GETATTR)
-+ error = -zfs_getattr_fast(user_ns, ZTOI(dzp), stat);
-+#else
-+ error = -zfs_getattr_fast(kcred->user_ns, ZTOI(dzp), stat);
-+#endif
- iput(ZTOI(dzp));
- }
-
-diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c
-index 80762f9669b..08bf97ff338 100644
---- a/module/os/linux/zfs/zpl_file.c
-+++ b/module/os/linux/zfs/zpl_file.c
-@@ -869,7 +869,7 @@ __zpl_ioctl_setflags(struct inode *ip, uint32_t ioctl_flags, xvattr_t *xva)
- !capable(CAP_LINUX_IMMUTABLE))
- return (-EACCES);
-
-- if (!inode_owner_or_capable(ip))
-+ if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
- return (-EACCES);
-
- xva_init(xva);
-diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c
-index f336fbb1272..364b9fbef24 100644
---- a/module/os/linux/zfs/zpl_inode.c
-+++ b/module/os/linux/zfs/zpl_inode.c
-@@ -128,7 +128,12 @@ zpl_vap_init(vattr_t *vap, struct inode *dir, umode_t mode, cred_t *cr)
- }
-
- static int
-+#ifdef HAVE_IOPS_CREATE_USERNS
-+zpl_create(struct user_namespace *user_ns, 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)
-+#endif
- {
- cred_t *cr = CRED();
- znode_t *zp;
-@@ -163,7 +168,12 @@ 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,
-+ struct dentry *dentry, umode_t mode,
-+#else
- zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
-+#endif
- dev_t rdev)
- {
- cred_t *cr = CRED();
-@@ -278,7 +288,12 @@ zpl_unlink(struct inode *dir, struct dentry *dentry)
- }
-
- static int
-+#ifdef HAVE_IOPS_MKDIR_USERNS
-+zpl_mkdir(struct user_namespace *user_ns, struct inode *dir,
-+ struct dentry *dentry, umode_t mode)
-+#else
- zpl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
-+#endif
- {
- cred_t *cr = CRED();
- vattr_t *vap;
-@@ -338,8 +353,14 @@ zpl_rmdir(struct inode *dir, struct dentry *dentry)
- }
-
- static int
-+#ifdef HAVE_USERNS_IOPS_GETATTR
-+zpl_getattr_impl(struct user_namespace *user_ns,
-+ const struct path *path, struct kstat *stat, u32 request_mask,
-+ unsigned int query_flags)
-+#else
- zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
- unsigned int query_flags)
-+#endif
- {
- int error;
- fstrans_cookie_t cookie;
-@@ -350,7 +371,11 @@ zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
- * XXX request_mask and query_flags currently ignored.
- */
-
-- error = -zfs_getattr_fast(path->dentry->d_inode, stat);
-+#ifdef HAVE_USERNS_IOPS_GETATTR
-+ error = -zfs_getattr_fast(user_ns, path->dentry->d_inode, stat);
-+#else
-+ error = -zfs_getattr_fast(kcred->user_ns, path->dentry->d_inode, stat);
-+#endif
- spl_fstrans_unmark(cookie);
- ASSERT3S(error, <=, 0);
-
-@@ -359,7 +384,12 @@ zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
- ZPL_GETATTR_WRAPPER(zpl_getattr);
-
- static int
-+#ifdef HAVE_SETATTR_PREPARE_USERNS
-+zpl_setattr(struct user_namespace *user_ns, struct dentry *dentry,
-+ struct iattr *ia)
-+#else
- zpl_setattr(struct dentry *dentry, struct iattr *ia)
-+#endif
- {
- struct inode *ip = dentry->d_inode;
- cred_t *cr = CRED();
-@@ -367,7 +397,7 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
- int error;
- fstrans_cookie_t cookie;
-
-- error = setattr_prepare(dentry, ia);
-+ error = zpl_setattr_prepare(kcred->user_ns, dentry, ia);
- if (error)
- return (error);
-
-@@ -399,8 +429,14 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
- }
-
- static int
-+#ifdef HAVE_IOPS_RENAME_USERNS
-+zpl_rename2(struct user_namespace *user_ns, struct inode *sdip,
-+ struct dentry *sdentry, struct inode *tdip, struct dentry *tdentry,
-+ unsigned int flags)
-+#else
- zpl_rename2(struct inode *sdip, struct dentry *sdentry,
- struct inode *tdip, struct dentry *tdentry, unsigned int flags)
-+#endif
- {
- cred_t *cr = CRED();
- int error;
-@@ -421,7 +457,7 @@ zpl_rename2(struct inode *sdip, struct dentry *sdentry,
- return (error);
- }
-
--#ifndef HAVE_RENAME_WANTS_FLAGS
-+#if !defined(HAVE_RENAME_WANTS_FLAGS) && !defined(HAVE_IOPS_RENAME_USERNS)
- static int
- zpl_rename(struct inode *sdip, struct dentry *sdentry,
- struct inode *tdip, struct dentry *tdentry)
-@@ -431,7 +467,12 @@ zpl_rename(struct inode *sdip, struct dentry *sdentry,
- #endif
-
- static int
-+#ifdef HAVE_IOPS_SYMLINK_USERNS
-+zpl_symlink(struct user_namespace *user_ns, struct inode *dir,
-+ struct dentry *dentry, const char *name)
-+#else
- zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
-+#endif
- {
- cred_t *cr = CRED();
- vattr_t *vap;
-@@ -677,7 +718,7 @@ const struct inode_operations zpl_dir_inode_operations = {
- .mkdir = zpl_mkdir,
- .rmdir = zpl_rmdir,
- .mknod = zpl_mknod,
--#ifdef HAVE_RENAME_WANTS_FLAGS
-+#if defined(HAVE_RENAME_WANTS_FLAGS) || defined(HAVE_IOPS_RENAME_USERNS)
- .rename = zpl_rename2,
- #else
- .rename = zpl_rename,
-diff --git a/module/os/linux/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c
-index 1ec3dae2bb8..5e35f90df85 100644
---- a/module/os/linux/zfs/zpl_xattr.c
-+++ b/module/os/linux/zfs/zpl_xattr.c
-@@ -1233,7 +1233,7 @@ __zpl_xattr_acl_set_access(struct inode *ip, const char *name,
- if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX)
- return (-EOPNOTSUPP);
-
-- if (!inode_owner_or_capable(ip))
-+ if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
- return (-EPERM);
-
- if (value) {
-@@ -1273,7 +1273,7 @@ __zpl_xattr_acl_set_default(struct inode *ip, const char *name,
- if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX)
- return (-EOPNOTSUPP);
-
-- if (!inode_owner_or_capable(ip))
-+ if (!zpl_inode_owner_or_capable(kcred->user_ns, ip))
- return (-EPERM);
-
- if (value) {
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild
index 636c4c76d07..18391c3ffa9 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild
@@ -13,7 +13,8 @@ if [[ ${PV} == "9999" ]]; then
EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
else
MY_PV="${PV/_rc/-rc}"
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
+ SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz
+ https://github.com/openzfs/zfs/commit/f315d9a3ff3cc0b81c99dd9be5878a55d2e98d8e.patch -> zfs-8.0.4_5.12_compat_idmapped_mounts.patch"
KEYWORDS="~amd64 ~arm64 ~ppc64"
S="${WORKDIR}/zfs-${PV%_rc?}"
ZFS_KERNEL_COMPAT="5.12"
@@ -54,7 +55,7 @@ pkg_pretend() {
}
PATCHES=(
- "${FILESDIR}"/zfs-8.0.4_5.12_compat_idmapped_mounts.patch
+ "${DISTDIR}"/zfs-8.0.4_5.12_compat_idmapped_mounts.patch
"${FILESDIR}"/zfs-8.0.4_5.12_compat_bio_max_segs.patch
"${FILESDIR}"/zfs-8.0.4_5.12_compat_tmpfile.patch
"${FILESDIR}"/zfs-8.0.4_5.12_compat_userns.patch
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2021-07-02 8:31 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2021-07-02 8:31 UTC (permalink / raw
To: gentoo-commits
commit: d423af2c1af587b69f8caed6a0047713f76c198b
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 2 08:30:01 2021 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Fri Jul 2 08:30:28 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d423af2c
sys-fs/zfs-kmod: drop 2.0.4-r1
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 2 -
.../files/zfs-8.0.4_5.12_compat_bio_max_segs.patch | 91 ----------
.../zfs-8.0.4_5.12_compat_iov_iter_advance.patch | 40 ----
.../files/zfs-8.0.4_5.12_compat_tmpfile.patch | 89 ---------
.../files/zfs-8.0.4_5.12_compat_userns.patch | 173 ------------------
.../zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch | 59 ------
.../zfs-kmod/files/zfs-8.0.4_stream_resume.patch | 33 ----
sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild | 202 ---------------------
8 files changed, 689 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index bf47582ff92..8cc26888798 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,7 +1,5 @@
DIST zfs-0.8.6.tar.gz 9295260 BLAKE2B 45424d710aaf75a05f766ae523ae157a24b5cbdcefe72a59e4cede81e42f7a92ae7f01150388437b78cd49f3d28b9664599f2a624516e6b3f1073497194a99f2 SHA512 626b172554f39a5c70f6ea5c599a92fae52534590d1b0273de2bbfc3676d29dff0eade8ca17e5f179a59870c12bc758fb53b7900f8a1fdbdef3a9161b93f9cce
-DIST zfs-2.0.4.tar.gz 13123872 BLAKE2B 7e4780092c0a87d5d187cd5734ddc736574db80b500f155287640ef2230e09335cc9b6b26ec1b7d8ab1b7942673ea49a3007a81da372a6d2ac36f3908913045c SHA512 1dda92d424372bce7020f5215545485eae69211b6f0fb6bea3c7c22efac76c6a2662f0dd14a03f723b6a6fe73b1228ecca211a4034b86cf885bcadf38ba0dc6b
DIST zfs-2.0.5.tar.gz 13166149 BLAKE2B 4505c43a3b9a6c2b925383d00bbd9f17505290ded83f9bd3f08211769fa39254742340bdda65efd53f87f1708138517f91f8a43c01f3ce4191de200c84c77754 SHA512 ee1b3f0347442ee649a7ee8a2bb08208e011eea994076d30dd08dcd51dab29df0ff369b0c6e709346fa7de69cb07e0ffdceb34f01edb93d414578d1ffc6051ba
DIST zfs-2.0.5.tar.gz.asc 836 BLAKE2B 6bc53160ce650f63c717b67116fb754c7a8196c9aa99bb6e43f0145bb30a0446a1ba5695b8207b085435da289fa0058643201ef2f8827e12b0803ab20b0df305 SHA512 91e73a8da45e4f49113fc1af684143902a23c9cf5e59f8cd2f3a1214aeff57af63a7fa05dbe3fa0465f002521b89a43d6086d765d03209d83a41761d56b358aa
DIST zfs-2.1.0-rc8.tar.gz 34830489 BLAKE2B c72c34888b6c0e1dff07483c8615296e5b917ae307fdcd510aeb3b6ba2cdc35df1abff523323b4f7f6b8b0b432c39f1e7e4e438c1eda365bee5791e56b82d852 SHA512 19617cf3c592d41585b0afb883a0d19cb7a1226f2e37590c6e4c8646422316d7ec9977b6d4844e88e676434452b9d437cd72b6da83fe0ccdac207d94b5c58a2b
DIST zfs-2.1.0-rc8.tar.gz.asc 195 BLAKE2B 46910365dec425edc72874ba8dd8e3138e35f0d1c32a5db38213d39ffa0645ed8e9044a182311db50c3cf3291efe00da32bb93b0d71a537e699a362ec3fbfb11 SHA512 3166a2a75d6c9253727663ebc52c6ab056d6a9b200616fd1dcdc0e0fa516aa90c6b5e1667852fc16186a202d866864efa70910291dd43665e667b57067df95ac
-DIST zfs-8.0.4_5.12_compat_idmapped_mounts.patch 41410 BLAKE2B 49724351c5a8e6ffa66762d5aac84ad89a3d04022d086d9f37ccd616b3e8e95852197b5333bdeeeab54fc51516d8254d0138a4422cc66214bb602e5ed72bbabf SHA512 1554d74a7024c106a3f4814895a64914f2e3d627f7edff3c8f415b419c6a596454862f8c0984a6e2f96e340851f1a9222a4c472ebd6d5db7dc0aa108dc2dca6c
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_bio_max_segs.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_bio_max_segs.patch
deleted file mode 100644
index 33f9a344e2f..00000000000
--- a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_bio_max_segs.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 77352db228c07ce8ba50478b9029820ca69c6c1b Mon Sep 17 00:00:00 2001
-From: Coleman Kane <ckane@colemankane.org>
-Date: Sat, 20 Mar 2021 01:33:42 -0400
-Subject: [PATCH] Linux 5.12 update: bio_max_segs() replaces BIO_MAX_PAGES
-
-The BIO_MAX_PAGES macro is being retired in favor of a bio_max_segs()
-function that implements the typical MIN(x,y) logic used throughout the
-kernel for bounding the allocation, and also the new implementation is
-intended to be signed-safe (which the former was not).
-
-Reviewed-by: Tony Hutter <hutter2@llnl.gov>
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Coleman Kane <ckane@colemankane.org>
-Closes #11765
-(cherry picked from commit ffd6978ef59cfe2773e984bf03de2f0b93b03f5c)
-Signed-off-by: Jonathon Fernyhough <jonathon@m2x.dev>
----
- config/kernel-bio_max_segs.m4 | 23 +++++++++++++++++++++++
- config/kernel.m4 | 2 ++
- module/os/linux/zfs/vdev_disk.c | 5 +++++
- 3 files changed, 30 insertions(+)
- create mode 100644 config/kernel-bio_max_segs.m4
-
-diff --git a/config/kernel-bio_max_segs.m4 b/config/kernel-bio_max_segs.m4
-new file mode 100644
-index 00000000000..a90d75455c1
---- /dev/null
-+++ b/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/config/kernel.m4 b/config/kernel.m4
-index 51c7fb926ec..b8d53490a4a 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -127,6 +127,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
- 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])
-@@ -227,6 +228,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
- ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS
- ZFS_AC_KERNEL_MKNOD
- ZFS_AC_KERNEL_SYMLINK
-+ ZFS_AC_KERNEL_BIO_MAX_SEGS
- ])
-
- dnl #
-diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c
-index 08c33313407..aaaf4105979 100644
---- a/module/os/linux/zfs/vdev_disk.c
-+++ b/module/os/linux/zfs/vdev_disk.c
-@@ -593,9 +593,14 @@ __vdev_disk_physio(struct block_device *bdev, zio_t *zio,
- }
-
- /* bio_alloc() with __GFP_WAIT never returns NULL */
-+#ifdef HAVE_BIO_MAX_SEGS
-+ dr->dr_bio[i] = bio_alloc(GFP_NOIO, bio_max_segs(
-+ abd_nr_pages_off(zio->io_abd, bio_size, abd_offset)));
-+#else
- dr->dr_bio[i] = bio_alloc(GFP_NOIO,
- MIN(abd_nr_pages_off(zio->io_abd, bio_size, abd_offset),
- BIO_MAX_PAGES));
-+#endif
- if (unlikely(dr->dr_bio[i] == NULL)) {
- vdev_disk_dio_free(dr);
- return (SET_ERROR(ENOMEM));
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_iov_iter_advance.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_iov_iter_advance.patch
deleted file mode 100644
index 95ecda34652..00000000000
--- a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_iov_iter_advance.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 3e0bc63e1b0ca03493b936e92e871ca7ae451a0a Mon Sep 17 00:00:00 2001
-From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
-Date: Tue, 1 Jun 2021 14:58:08 -0400
-Subject: [PATCH] Remove iov_iter_advance() for iter_write
-
-The additional iter advance is incorrect, as copy_from_iter() has
-already done the right thing. This will result in the following
-warning being printed to the console as of the 5.12 kernel.
-
- Attempted to advance past end of bvec iter
-
-This change should have been included with #11378 when a
-similar change was made on the read side.
-
-Suggested-by: @siebenmann
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
-Issue #11378
-Closes #12041
-Closes #12155
-(cherry picked from commit 3f81aba7668143c6ca6fc44983d4c880606dea8f)
-Signed-off-by: Jonathon Fernyhough <jonathon@m2x.dev>
----
- module/os/linux/zfs/zpl_file.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c
-index 08bf97ff338..e20c1dd413c 100644
---- a/module/os/linux/zfs/zpl_file.c
-+++ b/module/os/linux/zfs/zpl_file.c
-@@ -342,9 +342,6 @@ zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)
- ssize_t wrote = count - uio.uio_resid;
- kiocb->ki_pos += wrote;
-
-- if (wrote > 0)
-- iov_iter_advance(from, wrote);
--
- return (wrote);
- }
-
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_tmpfile.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_tmpfile.patch
deleted file mode 100644
index 08acee82148..00000000000
--- a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_tmpfile.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-From 6eced028dbbc2a44e32c4c0a76234ac2da9a365a Mon Sep 17 00:00:00 2001
-From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
-Date: Thu, 20 May 2021 19:02:36 -0400
-Subject: [PATCH] Update tmpfile() existence detection
-
-Linux changed the tmpfile() signature again in torvalds/linux@6521f89,
-which in turn broke our HAVE_TMPFILE detection in configure.
-
-Update that macro to include the new case, and change the signature of
-zpl_tmpfile as appropriate.
-
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
-Closes: #12060
-Closes: #12087
----
- config/kernel-tmpfile.m4 | 28 ++++++++++++++++++++++++----
- module/os/linux/zfs/zpl_inode.c | 5 +++++
- 2 files changed, 29 insertions(+), 4 deletions(-)
-
-diff --git a/config/kernel-tmpfile.m4 b/config/kernel-tmpfile.m4
-index f510bfe6ba0..45c2e6ceea5 100644
---- a/config/kernel-tmpfile.m4
-+++ b/config/kernel-tmpfile.m4
-@@ -3,23 +3,43 @@ dnl # 3.11 API change
- dnl # Add support for i_op->tmpfile
- dnl #
- AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
-- ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
-+ dnl #
-+ dnl # 5.11 API change
-+ dnl # add support for userns parameter to tmpfile
-+ dnl #
-+ ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_userns], [
- #include <linux/fs.h>
-- int tmpfile(struct inode *inode, struct dentry *dentry,
-+ int tmpfile(struct user_namespace *userns,
-+ struct inode *inode, struct dentry *dentry,
- umode_t mode) { return 0; }
- static struct inode_operations
- iops __attribute__ ((unused)) = {
- .tmpfile = tmpfile,
- };
- ],[])
-+ ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
-+ #include <linux/fs.h>
-+ int tmpfile(struct inode *inode, struct dentry *dentry,
-+ umode_t mode) { return 0; }
-+ static struct inode_operations
-+ iops __attribute__ ((unused)) = {
-+ .tmpfile = tmpfile,
-+ };
-+ ],[])
- ])
-
- AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
- AC_MSG_CHECKING([whether i_op->tmpfile() exists])
-- ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
-+ ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_userns], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
-+ AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
- ],[
-- AC_MSG_RESULT(no)
-+ ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
- ])
- ])
-diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c
-index 364b9fbef24..ab0373ef9ba 100644
---- a/module/os/linux/zfs/zpl_inode.c
-+++ b/module/os/linux/zfs/zpl_inode.c
-@@ -218,7 +218,12 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
-
- #ifdef HAVE_TMPFILE
- static int
-+#ifdef HAVE_TMPFILE_USERNS
-+zpl_tmpfile(struct user_namespace *userns, struct inode *dir,
-+ struct dentry *dentry, umode_t mode)
-+#else
- zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
-+#endif
- {
- cred_t *cr = CRED();
- struct inode *ip;
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_userns.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_userns.patch
deleted file mode 100644
index 1d8530ec8c6..00000000000
--- a/sys-fs/zfs-kmod/files/zfs-8.0.4_5.12_compat_userns.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From b3f8b103cb3a4bbb7ad41f6faf630be7baa4f585 Mon Sep 17 00:00:00 2001
-From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
-Date: Thu, 27 May 2021 11:55:49 -0400
-Subject: [PATCH] Bend zpl_set_acl to permit the new userns* parameter
-
-Just like #12087, the set_acl signature changed with all the bolted-on
-*userns parameters, which disabled set_acl usage, and caused #12076.
-
-Turn zpl_set_acl into zpl_set_acl and zpl_set_acl_impl, and add a
-new configure test for the new version.
-
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
-Closes #12076
-Closes #12093
----
- config/kernel-acl.m4 | 25 +++++++++++++++++++++--
- include/os/linux/zfs/sys/zpl.h | 5 +++++
- module/os/linux/zfs/zpl_xattr.c | 35 ++++++++++++++++++++++-----------
- 3 files changed, 51 insertions(+), 14 deletions(-)
-
-diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4
-index e02ce665323..c6da4df24eb 100644
---- a/config/kernel-acl.m4
-+++ b/config/kernel-acl.m4
-@@ -189,7 +189,22 @@ dnl #
- dnl # 3.14 API change,
- dnl # Check if inode_operations contains the function set_acl
- dnl #
-+dnl # 5.12 API change,
-+dnl # set_acl() added a user_namespace* parameter first
-+dnl #
- AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
-+ ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [
-+ #include <linux/fs.h>
-+
-+ int set_acl_fn(struct user_namespace *userns,
-+ struct inode *inode, struct posix_acl *acl,
-+ int type) { return 0; }
-+
-+ static const struct inode_operations
-+ iops __attribute__ ((unused)) = {
-+ .set_acl = set_acl_fn,
-+ };
-+ ],[])
- ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
- #include <linux/fs.h>
-
-@@ -205,11 +220,17 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
-
- AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
- AC_MSG_CHECKING([whether iops->set_acl() exists])
-- ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
-+ ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
-+ AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
- ],[
-- AC_MSG_RESULT(no)
-+ ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists, takes 3 args])
-+ ],[
-+ AC_MSG_RESULT(no)
-+ ])
- ])
- ])
-
-diff --git a/include/os/linux/zfs/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h
-index 21825d1f378..54f3fa0fdb0 100644
---- a/include/os/linux/zfs/sys/zpl.h
-+++ b/include/os/linux/zfs/sys/zpl.h
-@@ -63,7 +63,12 @@ extern int zpl_xattr_security_init(struct inode *ip, struct inode *dip,
- const struct qstr *qstr);
- #if defined(CONFIG_FS_POSIX_ACL)
- #if defined(HAVE_SET_ACL)
-+#if defined(HAVE_SET_ACL_USERNS)
-+extern int zpl_set_acl(struct user_namespace *userns, struct inode *ip,
-+ struct posix_acl *acl, int type);
-+#else
- extern int zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type);
-+#endif /* HAVE_SET_ACL_USERNS */
- #endif /* HAVE_SET_ACL */
- extern struct posix_acl *zpl_get_acl(struct inode *ip, int type);
- extern int zpl_init_acl(struct inode *ip, struct inode *dir);
-diff --git a/module/os/linux/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c
-index 5e35f90df85..89ba9de14f6 100644
---- a/module/os/linux/zfs/zpl_xattr.c
-+++ b/module/os/linux/zfs/zpl_xattr.c
-@@ -926,11 +926,8 @@ xattr_handler_t zpl_xattr_security_handler = {
- * attribute implemented by filesystems in the kernel." - xattr(7)
- */
- #ifdef CONFIG_FS_POSIX_ACL
--#ifndef HAVE_SET_ACL
--static
--#endif
--int
--zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type)
-+static int
-+zpl_set_acl_impl(struct inode *ip, struct posix_acl *acl, int type)
- {
- char *name, *value = NULL;
- int error = 0;
-@@ -1002,6 +999,19 @@ zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type)
- return (error);
- }
-
-+#ifdef HAVE_SET_ACL
-+int
-+#ifdef HAVE_SET_ACL_USERNS
-+zpl_set_acl(struct user_namespace *userns, struct inode *ip,
-+ struct posix_acl *acl, int type)
-+#else
-+zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type)
-+#endif /* HAVE_SET_ACL_USERNS */
-+{
-+ return (zpl_set_acl_impl(ip, acl, type));
-+}
-+#endif /* HAVE_SET_ACL */
-+
- struct posix_acl *
- zpl_get_acl(struct inode *ip, int type)
- {
-@@ -1083,7 +1093,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
- umode_t mode;
-
- if (S_ISDIR(ip->i_mode)) {
-- error = zpl_set_acl(ip, acl, ACL_TYPE_DEFAULT);
-+ error = zpl_set_acl_impl(ip, acl, ACL_TYPE_DEFAULT);
- if (error)
- goto out;
- }
-@@ -1093,8 +1103,10 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
- if (error >= 0) {
- ip->i_mode = mode;
- zfs_mark_inode_dirty(ip);
-- if (error > 0)
-- error = zpl_set_acl(ip, acl, ACL_TYPE_ACCESS);
-+ if (error > 0) {
-+ error = zpl_set_acl_impl(ip, acl,
-+ ACL_TYPE_ACCESS);
-+ }
- }
- }
- out:
-@@ -1121,7 +1133,7 @@ zpl_chmod_acl(struct inode *ip)
-
- error = __posix_acl_chmod(&acl, GFP_KERNEL, ip->i_mode);
- if (!error)
-- error = zpl_set_acl(ip, acl, ACL_TYPE_ACCESS);
-+ error = zpl_set_acl_impl(ip, acl, ACL_TYPE_ACCESS);
-
- zpl_posix_acl_release(acl);
-
-@@ -1250,8 +1262,7 @@ __zpl_xattr_acl_set_access(struct inode *ip, const char *name,
- } else {
- acl = NULL;
- }
--
-- error = zpl_set_acl(ip, acl, type);
-+ error = zpl_set_acl_impl(ip, acl, type);
- zpl_posix_acl_release(acl);
-
- return (error);
-@@ -1291,7 +1302,7 @@ __zpl_xattr_acl_set_default(struct inode *ip, const char *name,
- acl = NULL;
- }
-
-- error = zpl_set_acl(ip, acl, type);
-+ error = zpl_set_acl_impl(ip, acl, type);
- zpl_posix_acl_release(acl);
-
- return (error);
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch
deleted file mode 100644
index 3448f76a801..00000000000
--- a/sys-fs/zfs-kmod/files/zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 783784582225e8ddfbf07993d9fc278bf08025c5 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <behlendorf1@llnl.gov>
-Date: Thu, 3 Jun 2021 13:37:45 -0700
-Subject: [PATCH] Linux: Set spl_kmem_cache_slab_limit when page size !4K
-
-For small objects the kernel's slab implementation is very fast and
-space efficient. However, as the allocation size increases to
-require multiple pages performance suffers. The SPL kmem cache
-allocator was designed to better handle these large allocation
-sizes. Therefore, on Linux the kmem_cache_* compatibility wrappers
-prefer to use the kernel's slab allocator for small objects and
-the custom SPL kmem cache allocator for larger objects.
-
-This logic was effectively disabled for all architectures using
-a non-4K page size which caused all kmem caches to only use the
-SPL implementation. Functionally this is fine, but the SPL code
-which calculates the target number of objects per-slab does not
-take in to account that __vmalloc() always returns page-aligned
-memory. This can result in a massive amount of wasted space when
-allocating tiny objects on a platform using large pages (64k).
-
-To resolve this issue we set the spl_kmem_cache_slab_limit cutoff
-to 16K for all architectures.
-
-This particular change does not attempt to update the logic used
-to calculate the optimal number of pages per slab. This remains
-an issue which should be addressed in a future change.
-
-Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
-Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
-Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Closes #12152
-Closes #11429
-Closes #11574
-Closes #12150
----
- module/os/linux/spl/spl-kmem-cache.c | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
-
-diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c
-index 3699b6a159a..2151ef008fd 100644
---- a/module/os/linux/spl/spl-kmem-cache.c
-+++ b/module/os/linux/spl/spl-kmem-cache.c
-@@ -100,13 +100,10 @@ MODULE_PARM_DESC(spl_kmem_cache_max_size, "Maximum size of slab in MB");
- * For small objects the Linux slab allocator should be used to make the most
- * efficient use of the memory. However, large objects are not supported by
- * the Linux slab and therefore the SPL implementation is preferred. A cutoff
-- * of 16K was determined to be optimal for architectures using 4K pages.
-+ * of 16K was determined to be optimal for architectures using 4K pages and
-+ * to also work well on architecutres using larger 64K page sizes.
- */
--#if PAGE_SIZE == 4096
- unsigned int spl_kmem_cache_slab_limit = 16384;
--#else
--unsigned int spl_kmem_cache_slab_limit = 0;
--#endif
- module_param(spl_kmem_cache_slab_limit, uint, 0644);
- MODULE_PARM_DESC(spl_kmem_cache_slab_limit,
- "Objects less than N bytes use the Linux slab");
diff --git a/sys-fs/zfs-kmod/files/zfs-8.0.4_stream_resume.patch b/sys-fs/zfs-kmod/files/zfs-8.0.4_stream_resume.patch
deleted file mode 100644
index 196fab65f4a..00000000000
--- a/sys-fs/zfs-kmod/files/zfs-8.0.4_stream_resume.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From ee2a9d2c771657168652e058477b81389c662b5e Mon Sep 17 00:00:00 2001
-From: Paul Zuchowski <31706010+PaulZ-98@users.noreply.github.com>
-Date: Fri, 14 May 2021 00:46:14 -0400
-Subject: [PATCH] Fix dmu_recv_stream test for resumable
-
-Use dsl_dataset_has_resume_receive_state()
-not dsl_dataset_is_zapified() to check if
-stream is resumable.
-
-Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
-Reviewed-by: Alek Pinchuk <apinchuk@axcient.com>
-Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
-Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
-Closes #12034
----
- module/zfs/dmu_recv.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/module/zfs/dmu_recv.c b/module/zfs/dmu_recv.c
-index b5414749f7f..f44b397853f 100644
---- a/module/zfs/dmu_recv.c
-+++ b/module/zfs/dmu_recv.c
-@@ -2878,8 +2878,8 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, offset_t *voffp)
- int err = 0;
- struct receive_writer_arg *rwa = kmem_zalloc(sizeof (*rwa), KM_SLEEP);
-
-- if (dsl_dataset_is_zapified(drc->drc_ds)) {
-- uint64_t bytes;
-+ if (dsl_dataset_has_resume_receive_state(drc->drc_ds)) {
-+ uint64_t bytes = 0;
- (void) zap_lookup(drc->drc_ds->ds_dir->dd_pool->dp_meta_objset,
- drc->drc_ds->ds_object, DS_FIELD_RESUME_BYTES,
- sizeof (bytes), 1, &bytes);
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild
deleted file mode 100644
index 18391c3ffa9..00000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.0.4-r1.ebuild
+++ /dev/null
@@ -1,202 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-if [[ ${PV} == "9999" ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
-else
- MY_PV="${PV/_rc/-rc}"
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz
- https://github.com/openzfs/zfs/commit/f315d9a3ff3cc0b81c99dd9be5878a55d2e98d8e.patch -> zfs-8.0.4_5.12_compat_idmapped_mounts.patch"
- KEYWORDS="~amd64 ~arm64 ~ppc64"
- S="${WORKDIR}/zfs-${PV%_rc?}"
- ZFS_KERNEL_COMPAT="5.12"
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-
-DEPEND=""
-
-RDEPEND="${DEPEND}
- !sys-kernel/spl
-"
-
-BDEPEND="
- dev-lang/perl
- virtual/awk
-"
-
-# PDEPEND in this form is needed to trick portage suggest
-# enabling dist-kernel if only 1 package have it set
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-RESTRICT="debug? ( strip ) test"
-
-DOCS=( AUTHORS COPYRIGHT META README.md )
-
-pkg_pretend() {
- use rootfs || return 0
-
- if has_version virtual/dist-kernel && ! use dist-kernel; then
- ewarn "You have virtual/dist-kernel installed, but"
- ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
- ewarn "It's recommended to globally enable dist-kernel USE flag"
- ewarn "to auto-trigger initrd rebuilds with kernel updates"
- fi
-}
-
-PATCHES=(
- "${DISTDIR}"/zfs-8.0.4_5.12_compat_idmapped_mounts.patch
- "${FILESDIR}"/zfs-8.0.4_5.12_compat_bio_max_segs.patch
- "${FILESDIR}"/zfs-8.0.4_5.12_compat_tmpfile.patch
- "${FILESDIR}"/zfs-8.0.4_5.12_compat_userns.patch
- "${FILESDIR}"/zfs-8.0.4_5.12_compat_iov_iter_advance.patch
- "${FILESDIR}"/zfs-8.0.4_stream_resume.patch
- "${FILESDIR}"/zfs-8.0.4_spl_kmem_cache_slab_limit_16K.patch
-)
-
-pkg_setup() {
- CONFIG_CHECK="
- !DEBUG_LOCK_ALLOC
- EFI_PARTITION
- MODULES
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- !TRIM_UNUSED_KSYMS
- ZLIB_DEFLATE
- ZLIB_INFLATE
- "
-
- use debug && CONFIG_CHECK="${CONFIG_CHECK}
- FRAME_POINTER
- DEBUG_INFO
- !DEBUG_INFO_REDUCED
- "
-
- use rootfs && \
- CONFIG_CHECK="${CONFIG_CHECK}
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
-
- if [[ ${PV} != "9999" ]]; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
-
- fi
-
- kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
-
- linux-mod_pkg_setup
-}
-
-src_prepare() {
- default
- eautoreconf
- # Set module revision number
- sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
-}
-
-src_configure() {
- set_arch_to_kernel
-
- use custom-cflags || strip-flags
-
- filter-ldflags -Wl,*
-
- local myconf=(
- CROSS_COMPILE="${CHOST}-"
- HOSTCC="$(tc-getBUILD_CC)"
- --bindir="${EPREFIX}/bin"
- --sbindir="${EPREFIX}/sbin"
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- set_arch_to_kernel
-
- myemakeargs=(
- CROSS_COMPILE="${CHOST}-"
- HOSTCC="$(tc-getBUILD_CC)"
- V=1
- )
-
- emake "${myemakeargs[@]}"
-}
-
-src_install() {
- set_arch_to_kernel
-
- myemakeargs+=(
- DEPMOD=:
- DESTDIR="${D}"
- INSTALL_MOD_PATH="${EPREFIX:-/}" # lib/modules/<kver> added by KBUILD
- )
-
- emake "${myemakeargs[@]}" install
-
- einstalldocs
-}
-
-pkg_postinst() {
- linux-mod_pkg_postinst
-
- # Remove old modules
- if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
- ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
- ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
- ewarn "Automatically removing old modules to avoid problems."
- rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
- rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon"
- fi
-
- if [[ -z ${ROOT} ]] && use dist-kernel; then
- set_arch_to_portage
- dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
- fi
-
- if use x86 || use arm; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
- ewarn "create a newpool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -d -o feature@async_destroy=enabled "
- ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
- ewarn " -o feature@spacemap_histogram=enabled"
- ewarn " -o feature@enabled_txg=enabled "
- ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
- ewarn " ..."
- ewarn
- ewarn "GRUB2 support will be updated as soon as either the GRUB2"
- ewarn "developers do a tag or the Gentoo developers find time to backport"
- ewarn "support from GRUB2 HEAD."
-}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2021-11-07 23:59 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2021-11-07 23:59 UTC (permalink / raw
To: gentoo-commits
commit: 8e5626dc90e4e6166c2e296371b6ff5a9d13a8c4
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 7 22:59:41 2021 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sun Nov 7 23:57:33 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e5626dc
sys-fs/zfs-kmod: revbump, add HOLE patch and dist-kernel version limit
https://github.com/openzfs/zfs/pull/12724
https://github.com/openzfs/zfs/issues/11900
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/files/2.1.1-fix-lseek-mmap.patch | 594 +++++++++++++++++++++++
sys-fs/zfs-kmod/zfs-kmod-2.1.1-r1.ebuild | 207 ++++++++
2 files changed, 801 insertions(+)
diff --git a/sys-fs/zfs-kmod/files/2.1.1-fix-lseek-mmap.patch b/sys-fs/zfs-kmod/files/2.1.1-fix-lseek-mmap.patch
new file mode 100644
index 00000000000..2c3a66a97bf
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/2.1.1-fix-lseek-mmap.patch
@@ -0,0 +1,594 @@
+From de198f2d9507b6dcf3d0d8f037ba33940208733e Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Sun, 7 Nov 2021 13:27:44 -0800
+Subject: [PATCH] Fix lseek(SEEK_DATA/SEEK_HOLE) mmap consistency
+
+When using lseek(2) to report data/holes memory mapped regions of
+the file were ignored. This could result in incorrect results.
+To handle this zfs_holey_common() was updated to asynchronously
+writeback any dirty mmap(2) regions prior to reporting holes.
+
+Additionally, while not strictly required, the dn_struct_rwlock is
+now held over the dirty check to prevent the dnode structure from
+changing. This ensures that a clean dnode can't be dirtied before
+the data/hole is located. The range lock is now also taken to
+ensure the call cannot race with zfs_write().
+
+Furthermore, the code was refactored to provide a dnode_is_dirty()
+helper function which checks the dnode for any dirty records to
+determine its dirtiness.
+
+Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
+Reviewed-by: Tony Hutter <hutter2@llnl.gov>
+Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Issue #11900
+Closes #12724
+---
+ configure.ac | 1 +
+ include/os/freebsd/spl/sys/vnode.h | 18 +++
+ include/os/freebsd/zfs/sys/zfs_znode_impl.h | 3 +-
+ include/os/linux/zfs/sys/zfs_znode_impl.h | 1 +
+ include/sys/dnode.h | 1 +
+ man/man4/zfs.4 | 2 +-
+ module/zfs/dmu.c | 53 ++++---
+ module/zfs/dnode.c | 20 +++
+ module/zfs/zfs_vnops.c | 9 +-
+ tests/runfiles/common.run | 2 +-
+ tests/zfs-tests/cmd/Makefile.am | 1 +
+ tests/zfs-tests/cmd/mmap_seek/.gitignore | 1 +
+ tests/zfs-tests/cmd/mmap_seek/Makefile.am | 6 +
+ tests/zfs-tests/cmd/mmap_seek/mmap_seek.c | 147 ++++++++++++++++++
+ tests/zfs-tests/include/commands.cfg | 1 +
+ tests/zfs-tests/include/tunables.cfg | 1 +
+ .../tests/functional/mmap/Makefile.am | 3 +-
+ .../functional/mmap/mmap_seek_001_pos.ksh | 67 ++++++++
+ 18 files changed, 305 insertions(+), 32 deletions(-)
+ create mode 100644 tests/zfs-tests/cmd/mmap_seek/.gitignore
+ create mode 100644 tests/zfs-tests/cmd/mmap_seek/Makefile.am
+ create mode 100644 tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
+ create mode 100755 tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
+
+diff --git a/configure.ac b/configure.ac
+index 6f34b210d2b..ebc7b276a64 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -221,6 +221,7 @@ AC_CONFIG_FILES([
+ tests/zfs-tests/cmd/mktree/Makefile
+ tests/zfs-tests/cmd/mmap_exec/Makefile
+ tests/zfs-tests/cmd/mmap_libaio/Makefile
++ tests/zfs-tests/cmd/mmap_seek/Makefile
+ tests/zfs-tests/cmd/mmapwrite/Makefile
+ tests/zfs-tests/cmd/nvlist_to_lua/Makefile
+ tests/zfs-tests/cmd/randfree_file/Makefile
+diff --git a/include/os/freebsd/spl/sys/vnode.h b/include/os/freebsd/spl/sys/vnode.h
+index 3670712a045..3bc8a18eeb7 100644
+--- a/include/os/freebsd/spl/sys/vnode.h
++++ b/include/os/freebsd/spl/sys/vnode.h
+@@ -59,6 +59,8 @@ enum symfollow { NO_FOLLOW = NOFOLLOW };
+ #include <sys/file.h>
+ #include <sys/filedesc.h>
+ #include <sys/syscallsubr.h>
++#include <sys/vm.h>
++#include <vm/vm_object.h>
+
+ typedef struct vop_vector vnodeops_t;
+ #define VOP_FID VOP_VPTOFH
+@@ -83,6 +85,22 @@ vn_is_readonly(vnode_t *vp)
+ #define vn_has_cached_data(vp) \
+ ((vp)->v_object != NULL && \
+ (vp)->v_object->resident_page_count > 0)
++
++static __inline void
++vn_flush_cached_data(vnode_t *vp, boolean_t sync)
++{
++#if __FreeBSD_version > 1300054
++ if (vm_object_mightbedirty(vp->v_object)) {
++#else
++ if (vp->v_object->flags & OBJ_MIGHTBEDIRTY) {
++#endif
++ int flags = sync ? OBJPC_SYNC : 0;
++ zfs_vmobject_wlock(vp->v_object);
++ vm_object_page_clean(vp->v_object, 0, 0, flags);
++ zfs_vmobject_wunlock(vp->v_object);
++ }
++}
++
+ #define vn_exists(vp) do { } while (0)
+ #define vn_invalid(vp) do { } while (0)
+ #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0)
+diff --git a/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/include/os/freebsd/zfs/sys/zfs_znode_impl.h
+index 7d28bddbf51..4456046e6e4 100644
+--- a/include/os/freebsd/zfs/sys/zfs_znode_impl.h
++++ b/include/os/freebsd/zfs/sys/zfs_znode_impl.h
+@@ -116,7 +116,8 @@ typedef struct zfs_soft_state {
+ #define Z_ISLNK(type) ((type) == VLNK)
+ #define Z_ISDIR(type) ((type) == VDIR)
+
+-#define zn_has_cached_data(zp) vn_has_cached_data(ZTOV(zp))
++#define zn_has_cached_data(zp) vn_has_cached_data(ZTOV(zp))
++#define zn_flush_cached_data(zp, sync) vn_flush_cached_data(ZTOV(zp), sync)
+ #define zn_rlimit_fsize(zp, uio) \
+ vn_rlimit_fsize(ZTOV(zp), GET_UIO_STRUCT(uio), zfs_uio_td(uio))
+
+diff --git a/include/os/linux/zfs/sys/zfs_znode_impl.h b/include/os/linux/zfs/sys/zfs_znode_impl.h
+index 0a6273442b7..de46fc8f2bd 100644
+--- a/include/os/linux/zfs/sys/zfs_znode_impl.h
++++ b/include/os/linux/zfs/sys/zfs_znode_impl.h
+@@ -71,6 +71,7 @@ extern "C" {
+ #define Z_ISDIR(type) S_ISDIR(type)
+
+ #define zn_has_cached_data(zp) ((zp)->z_is_mapped)
++#define zn_flush_cached_data(zp, sync) write_inode_now(ZTOI(zp), sync)
+ #define zn_rlimit_fsize(zp, uio) (0)
+
+ /*
+diff --git a/include/sys/dnode.h b/include/sys/dnode.h
+index e7cccd044ab..3f5fcc958c3 100644
+--- a/include/sys/dnode.h
++++ b/include/sys/dnode.h
+@@ -425,6 +425,7 @@ boolean_t dnode_add_ref(dnode_t *dn, void *ref);
+ void dnode_rele(dnode_t *dn, void *ref);
+ void dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting);
+ int dnode_try_claim(objset_t *os, uint64_t object, int slots);
++boolean_t dnode_is_dirty(dnode_t *dn);
+ void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx);
+ void dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, void *tag);
+ void dnode_sync(dnode_t *dn, dmu_tx_t *tx);
+diff --git a/man/man4/zfs.4 b/man/man4/zfs.4
+index d7fc31bfde1..a136690c76e 100644
+--- a/man/man4/zfs.4
++++ b/man/man4/zfs.4
+@@ -1586,7 +1586,7 @@ Allow no-operation writes.
+ The occurrence of nopwrites will further depend on other pool properties
+ .Pq i.a. the checksumming and compression algorithms .
+ .
+-.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | ns 1 Pq int
++.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | Ns 1 Pq int
+ Enable forcing TXG sync to find holes.
+ When enabled forces ZFS to act like prior versions when
+ .Sy SEEK_HOLE No or Sy SEEK_DATA
+diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
+index b29d82fd793..f12c5eda8b5 100644
+--- a/module/zfs/dmu.c
++++ b/module/zfs/dmu.c
+@@ -2093,42 +2093,41 @@ int
+ dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off)
+ {
+ dnode_t *dn;
+- int i, err;
+- boolean_t clean = B_TRUE;
++ int err;
+
++restart:
+ err = dnode_hold(os, object, FTAG, &dn);
+ if (err)
+ return (err);
+
+- /*
+- * Check if dnode is dirty
+- */
+- for (i = 0; i < TXG_SIZE; i++) {
+- if (multilist_link_active(&dn->dn_dirty_link[i])) {
+- clean = B_FALSE;
+- break;
+- }
+- }
++ rw_enter(&dn->dn_struct_rwlock, RW_READER);
+
+- /*
+- * If compatibility option is on, sync any current changes before
+- * we go trundling through the block pointers.
+- */
+- if (!clean && zfs_dmu_offset_next_sync) {
+- clean = B_TRUE;
+- dnode_rele(dn, FTAG);
+- txg_wait_synced(dmu_objset_pool(os), 0);
+- err = dnode_hold(os, object, FTAG, &dn);
+- if (err)
+- return (err);
+- }
++ if (dnode_is_dirty(dn)) {
++ /*
++ * If the zfs_dmu_offset_next_sync module option is enabled
++ * then strict hole reporting has been requested. Dirty
++ * dnodes must be synced to disk to accurately report all
++ * holes. When disabled (the default) dirty dnodes are
++ * reported to not have any holes which is always safe.
++ *
++ * When called by zfs_holey_common() the zp->z_rangelock
++ * is held to prevent zfs_write() and mmap writeback from
++ * re-dirtying the dnode after txg_wait_synced().
++ */
++ if (zfs_dmu_offset_next_sync) {
++ rw_exit(&dn->dn_struct_rwlock);
++ dnode_rele(dn, FTAG);
++ txg_wait_synced(dmu_objset_pool(os), 0);
++ goto restart;
++ }
+
+- if (clean)
+- err = dnode_next_offset(dn,
+- (hole ? DNODE_FIND_HOLE : 0), off, 1, 1, 0);
+- else
+ err = SET_ERROR(EBUSY);
++ } else {
++ err = dnode_next_offset(dn, DNODE_FIND_HAVELOCK |
++ (hole ? DNODE_FIND_HOLE : 0), off, 1, 1, 0);
++ }
+
++ rw_exit(&dn->dn_struct_rwlock);
+ dnode_rele(dn, FTAG);
+
+ return (err);
+diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
+index 900240479c7..6f87f49f89f 100644
+--- a/module/zfs/dnode.c
++++ b/module/zfs/dnode.c
+@@ -1648,6 +1648,26 @@ dnode_try_claim(objset_t *os, uint64_t object, int slots)
+ slots, NULL, NULL));
+ }
+
++/*
++ * Checks if the dnode contains any uncommitted dirty records.
++ */
++boolean_t
++dnode_is_dirty(dnode_t *dn)
++{
++ mutex_enter(&dn->dn_mtx);
++
++ for (int i = 0; i < TXG_SIZE; i++) {
++ if (list_head(&dn->dn_dirty_records[i]) != NULL) {
++ mutex_exit(&dn->dn_mtx);
++ return (B_TRUE);
++ }
++ }
++
++ mutex_exit(&dn->dn_mtx);
++
++ return (B_FALSE);
++}
++
+ void
+ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx)
+ {
+diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
+index a83f0b02ab5..7cbb70f499a 100644
+--- a/module/zfs/zfs_vnops.c
++++ b/module/zfs/zfs_vnops.c
+@@ -85,6 +85,7 @@ zfs_fsync(znode_t *zp, int syncflag, cred_t *cr)
+ static int
+ zfs_holey_common(znode_t *zp, ulong_t cmd, loff_t *off)
+ {
++ zfs_locked_range_t *lr;
+ uint64_t noff = (uint64_t)*off; /* new offset */
+ uint64_t file_sz;
+ int error;
+@@ -100,12 +101,18 @@ zfs_holey_common(znode_t *zp, ulong_t cmd, loff_t *off)
+ else
+ hole = B_FALSE;
+
++ /* Flush any mmap()'d data to disk */
++ if (zn_has_cached_data(zp))
++ zn_flush_cached_data(zp, B_FALSE);
++
++ lr = zfs_rangelock_enter(&zp->z_rangelock, 0, file_sz, RL_READER);
+ error = dmu_offset_next(ZTOZSB(zp)->z_os, zp->z_id, hole, &noff);
++ zfs_rangelock_exit(lr);
+
+ if (error == ESRCH)
+ return (SET_ERROR(ENXIO));
+
+- /* file was dirty, so fall back to using generic logic */
++ /* File was dirty, so fall back to using generic logic */
+ if (error == EBUSY) {
+ if (hole)
+ *off = file_sz;
+diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run
+index 7f7d161be35..9f181b53e15 100644
+--- a/tests/runfiles/common.run
++++ b/tests/runfiles/common.run
+@@ -675,7 +675,7 @@ tests = ['migration_001_pos', 'migration_002_pos', 'migration_003_pos',
+ tags = ['functional', 'migration']
+
+ [tests/functional/mmap]
+-tests = ['mmap_write_001_pos', 'mmap_read_001_pos']
++tests = ['mmap_write_001_pos', 'mmap_read_001_pos', 'mmap_seek_001_pos']
+ tags = ['functional', 'mmap']
+
+ [tests/functional/mount]
+diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am
+index 2b965ca7000..d1c29fcd1c6 100644
+--- a/tests/zfs-tests/cmd/Makefile.am
++++ b/tests/zfs-tests/cmd/Makefile.am
+@@ -19,6 +19,7 @@ SUBDIRS = \
+ mktree \
+ mmap_exec \
+ mmap_libaio \
++ mmap_seek \
+ mmapwrite \
+ nvlist_to_lua \
+ randwritecomp \
+diff --git a/tests/zfs-tests/cmd/mmap_seek/.gitignore b/tests/zfs-tests/cmd/mmap_seek/.gitignore
+new file mode 100644
+index 00000000000..6b05a791750
+--- /dev/null
++++ b/tests/zfs-tests/cmd/mmap_seek/.gitignore
+@@ -0,0 +1 @@
++/mmap_seek
+diff --git a/tests/zfs-tests/cmd/mmap_seek/Makefile.am b/tests/zfs-tests/cmd/mmap_seek/Makefile.am
+new file mode 100644
+index 00000000000..b938931125f
+--- /dev/null
++++ b/tests/zfs-tests/cmd/mmap_seek/Makefile.am
+@@ -0,0 +1,6 @@
++include $(top_srcdir)/config/Rules.am
++
++pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
++
++pkgexec_PROGRAMS = mmap_seek
++mmap_seek_SOURCES = mmap_seek.c
+diff --git a/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c b/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
+new file mode 100644
+index 00000000000..f476e1dba9a
+--- /dev/null
++++ b/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
+@@ -0,0 +1,147 @@
++/*
++ * CDDL HEADER START
++ *
++ * The contents of this file are subject to the terms of the
++ * Common Development and Distribution License (the "License").
++ * You may not use this file except in compliance with the License.
++ *
++ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++ * or http://www.opensolaris.org/os/licensing.
++ * See the License for the specific language governing permissions
++ * and limitations under the License.
++ *
++ * When distributing Covered Code, include this CDDL HEADER in each
++ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++ * If applicable, add the following below this CDDL HEADER, with the
++ * fields enclosed by brackets "[]" replaced with your own identifying
++ * information: Portions Copyright [yyyy] [name of copyright owner]
++ *
++ * CDDL HEADER END
++ */
++
++/*
++ * Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
++ */
++
++#include <unistd.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/mman.h>
++#include <errno.h>
++
++static void
++seek_data(int fd, off_t offset, off_t expected)
++{
++ off_t data_offset = lseek(fd, offset, SEEK_DATA);
++ if (data_offset != expected) {
++ fprintf(stderr, "lseek(fd, %d, SEEK_DATA) = %d (expected %d)\n",
++ (int)offset, (int)data_offset, (int)expected);
++ exit(2);
++ }
++}
++
++static void
++seek_hole(int fd, off_t offset, off_t expected)
++{
++ off_t hole_offset = lseek(fd, offset, SEEK_HOLE);
++ if (hole_offset != expected) {
++ fprintf(stderr, "lseek(fd, %d, SEEK_HOLE) = %d (expected %d)\n",
++ (int)offset, (int)hole_offset, (int)expected);
++ exit(2);
++ }
++}
++
++int
++main(int argc, char **argv)
++{
++ char *execname = argv[0];
++ char *file_path = argv[1];
++ char *buf = NULL;
++ int err;
++
++ if (argc != 4) {
++ (void) printf("usage: %s <file name> <file size> "
++ "<block size>\n", argv[0]);
++ exit(1);
++ }
++
++ int fd = open(file_path, O_RDWR | O_CREAT, 0666);
++ if (fd == -1) {
++ (void) fprintf(stderr, "%s: %s: ", execname, file_path);
++ perror("open");
++ exit(2);
++ }
++
++ off_t file_size = atoi(argv[2]);
++ off_t block_size = atoi(argv[3]);
++
++ if (block_size * 2 > file_size) {
++ (void) fprintf(stderr, "file size must be at least "
++ "double the block size\n");
++ exit(2);
++ }
++
++ err = ftruncate(fd, file_size);
++ if (err == -1) {
++ perror("ftruncate");
++ exit(2);
++ }
++
++ if ((buf = mmap(NULL, file_size, PROT_READ | PROT_WRITE,
++ MAP_SHARED, fd, 0)) == MAP_FAILED) {
++ perror("mmap");
++ exit(2);
++ }
++
++ /* Verify the file is sparse and reports no data. */
++ seek_data(fd, 0, -1);
++
++ /* Verify the file is reported as a hole. */
++ seek_hole(fd, 0, 0);
++
++ /* Verify search beyond end of file is an error. */
++ seek_data(fd, 2 * file_size, -1);
++ seek_hole(fd, 2 * file_size, -1);
++
++ /* Dirty the first byte. */
++ memset(buf, 'a', 1);
++ seek_data(fd, 0, 0);
++ seek_data(fd, block_size, -1);
++ seek_hole(fd, 0, block_size);
++ seek_hole(fd, block_size, block_size);
++
++ /* Dirty the first half of the file. */
++ memset(buf, 'b', file_size / 2);
++ seek_data(fd, 0, 0);
++ seek_data(fd, block_size, block_size);
++ seek_hole(fd, 0, P2ROUNDUP(file_size / 2, block_size));
++ seek_hole(fd, block_size, P2ROUNDUP(file_size / 2, block_size));
++
++ /* Dirty the whole file. */
++ memset(buf, 'c', file_size);
++ seek_data(fd, 0, 0);
++ seek_data(fd, file_size * 3 / 4,
++ P2ROUNDUP(file_size * 3 / 4, block_size));
++ seek_hole(fd, 0, file_size);
++ seek_hole(fd, file_size / 2, file_size);
++
++ /* Punch a hole (required compression be enabled). */
++ memset(buf + block_size, 0, block_size);
++ seek_data(fd, 0, 0);
++ seek_data(fd, block_size, 2 * block_size);
++ seek_hole(fd, 0, block_size);
++ seek_hole(fd, block_size, block_size);
++ seek_hole(fd, 2 * block_size, file_size);
++
++ err = munmap(buf, file_size);
++ if (err == -1) {
++ perror("munmap");
++ exit(2);
++ }
++
++ close(fd);
++
++ return (0);
++}
+diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg
+index 1ec73f25bae..4497a6248b4 100644
+--- a/tests/zfs-tests/include/commands.cfg
++++ b/tests/zfs-tests/include/commands.cfg
+@@ -209,6 +209,7 @@ export ZFSTEST_FILES='badsend
+ mktree
+ mmap_exec
+ mmap_libaio
++ mmap_seek
+ mmapwrite
+ nvlist_to_lua
+ randfree_file
+diff --git a/tests/zfs-tests/include/tunables.cfg b/tests/zfs-tests/include/tunables.cfg
+index 56d430a3987..fff43e46916 100644
+--- a/tests/zfs-tests/include/tunables.cfg
++++ b/tests/zfs-tests/include/tunables.cfg
+@@ -33,6 +33,7 @@ DEADMAN_FAILMODE deadman.failmode zfs_deadman_failmode
+ DEADMAN_SYNCTIME_MS deadman.synctime_ms zfs_deadman_synctime_ms
+ DEADMAN_ZIOTIME_MS deadman.ziotime_ms zfs_deadman_ziotime_ms
+ DISABLE_IVSET_GUID_CHECK disable_ivset_guid_check zfs_disable_ivset_guid_check
++DMU_OFFSET_NEXT_SYNC dmu_offset_next_sync zfs_dmu_offset_next_sync
+ INITIALIZE_CHUNK_SIZE initialize_chunk_size zfs_initialize_chunk_size
+ INITIALIZE_VALUE initialize_value zfs_initialize_value
+ KEEP_LOG_SPACEMAPS_AT_EXPORT keep_log_spacemaps_at_export zfs_keep_log_spacemaps_at_export
+diff --git a/tests/zfs-tests/tests/functional/mmap/Makefile.am b/tests/zfs-tests/tests/functional/mmap/Makefile.am
+index 2adc398b8c0..b26791ee7ce 100644
+--- a/tests/zfs-tests/tests/functional/mmap/Makefile.am
++++ b/tests/zfs-tests/tests/functional/mmap/Makefile.am
+@@ -4,7 +4,8 @@ dist_pkgdata_SCRIPTS = \
+ cleanup.ksh \
+ mmap_read_001_pos.ksh \
+ mmap_write_001_pos.ksh \
+- mmap_libaio_001_pos.ksh
++ mmap_libaio_001_pos.ksh \
++ mmap_seek_001_pos.ksh
+
+ dist_pkgdata_DATA = \
+ mmap.cfg
+diff --git a/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh b/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
+new file mode 100755
+index 00000000000..6188549ad8d
+--- /dev/null
++++ b/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
+@@ -0,0 +1,67 @@
++#!/bin/ksh -p
++#
++# CDDL HEADER START
++#
++# The contents of this file are subject to the terms of the
++# Common Development and Distribution License (the "License").
++# You may not use this file except in compliance with the License.
++#
++# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++# or http://www.opensolaris.org/os/licensing.
++# See the License for the specific language governing permissions
++# and limitations under the License.
++#
++# When distributing Covered Code, include this CDDL HEADER in each
++# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++# If applicable, add the following below this CDDL HEADER, with the
++# fields enclosed by brackets "[]" replaced with your own identifying
++# information: Portions Copyright [yyyy] [name of copyright owner]
++#
++# CDDL HEADER END
++#
++
++#
++# Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
++#
++
++. $STF_SUITE/include/libtest.shlib
++. $STF_SUITE/tests/functional/mmap/mmap.cfg
++
++#
++# DESCRIPTION:
++# lseek() data/holes for an mmap()'d file.
++#
++# STRATEGY:
++# 1. Enable compression and hole reporting for dirty files.
++# 2. Call mmap_seek binary test case for various record sizes.
++#
++
++verify_runnable "global"
++
++function cleanup
++{
++ log_must zfs set compression=off $TESTPOOL/$TESTFS
++ log_must zfs set recordsize=128k $TESTPOOL/$TESTFS
++ log_must rm -f $TESTDIR/test-mmap-file
++ log_must set_tunable64 DMU_OFFSET_NEXT_SYNC $dmu_offset_next_sync
++}
++
++log_assert "lseek() data/holes for an mmap()'d file."
++
++log_onexit cleanup
++
++# Enable hole reporting for dirty files.
++typeset dmu_offset_next_sync=$(get_tunable DMU_OFFSET_NEXT_SYNC)
++log_must set_tunable64 DMU_OFFSET_NEXT_SYNC 1
++
++# Compression must be enabled to convert zero'd blocks to holes.
++# This behavior is checked by the mmap_seek test.
++log_must zfs set compression=on $TESTPOOL/$TESTFS
++
++for bs in 4096 8192 16384 32768 65536 131072; do
++ log_must zfs set recordsize=$bs $TESTPOOL/$TESTFS
++ log_must mmap_seek $TESTDIR/test-mmap-file $((1024*1024)) $bs
++ log_must rm $TESTDIR/test-mmap-file
++done
++
++log_pass "lseek() data/holes for an mmap()'d file succeeded."
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r1.ebuild
new file mode 100644
index 00000000000..5939b99e648
--- /dev/null
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r1.ebuild
@@ -0,0 +1,207 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
+
+DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
+HOMEPAGE="https://github.com/openzfs/zfs"
+
+if [[ ${PV} == "9999" ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
+ inherit verify-sig
+
+ MY_PV="${PV/_rc/-rc}"
+ SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
+ SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
+ S="${WORKDIR}/zfs-${PV%_rc?}"
+ ZFS_KERNEL_COMPAT="5.14"
+
+ # increments minor eg 5.14 -> 5.15, and still supports override.
+ ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
+
+ if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv"
+ fi
+fi
+
+LICENSE="CDDL MIT debug? ( GPL-2+ )"
+SLOT="0/${PVR}"
+IUSE="custom-cflags debug +rootfs"
+
+RDEPEND="${DEPEND}
+ !sys-kernel/spl
+"
+
+BDEPEND="
+ dev-lang/perl
+ virtual/awk
+"
+
+# we want dist-kernel block in BDEPEND because of portage resolver.
+# since linux-mod.eclass already sets version-unbounded dep, portage
+# will pull new versions. So we set it in BDEPEND which takes priority.
+# and we don't need in in git ebuild.
+if [[ ${PV} != "9999" ]] ; then
+ BDEPEND+="
+ verify-sig? ( app-crypt/openpgp-keys-openzfs )
+ dist-kernel? ( <virtual/dist-kernel-${ZFS_KERNEL_DEP}:= )
+ "
+fi
+
+# PDEPEND in this form is needed to trick portage suggest
+# enabling dist-kernel if only 1 package have it set
+PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
+
+RESTRICT="debug? ( strip ) test"
+
+DOCS=( AUTHORS COPYRIGHT META README.md )
+
+PATCHES=( "${FILESDIR}/2.1.1-fix-lseek-mmap.patch" )
+
+pkg_pretend() {
+ use rootfs || return 0
+
+ if has_version virtual/dist-kernel && ! use dist-kernel; then
+ ewarn "You have virtual/dist-kernel installed, but"
+ ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
+ ewarn "It's recommended to globally enable dist-kernel USE flag"
+ ewarn "to auto-trigger initrd rebuilds with kernel updates"
+ fi
+}
+
+pkg_setup() {
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ EFI_PARTITION
+ MODULES
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !TRIM_UNUSED_KSYMS
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ use rootfs && \
+ CONFIG_CHECK="${CONFIG_CHECK}
+ BLK_DEV_INITRD
+ DEVTMPFS
+ "
+
+ kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
+
+ if [[ ${PV} != "9999" ]]; then
+ local kv_major_max kv_minor_max zcompat
+ zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ kv_major_max="${zcompat%%.*}"
+ zcompat="${zcompat#*.}"
+ kv_minor_max="${zcompat%%.*}"
+ kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
+ "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
+
+ fi
+
+ kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
+
+ linux-mod_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ # Run unconditionally (bug #792627)
+ eautoreconf
+
+ if [[ ${PV} != "9999" ]]; then
+ # Set module revision number
+ sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
+ fi
+}
+
+src_configure() {
+ set_arch_to_kernel
+
+ use custom-cflags || strip-flags
+
+ filter-ldflags -Wl,*
+
+ # Set CROSS_COMPILE in the environment.
+ # This allows the user to override it via make.conf or via a local Makefile.
+ # https://bugs.gentoo.org/811600
+ export CROSS_COMPILE=${CROSS_COMPILE-${CHOST}-}
+
+ local myconf=(
+ HOSTCC="$(tc-getBUILD_CC)"
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=kernel
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ set_arch_to_kernel
+
+ myemakeargs=(
+ HOSTCC="$(tc-getBUILD_CC)"
+ V=1
+ )
+
+ emake "${myemakeargs[@]}"
+}
+
+src_install() {
+ set_arch_to_kernel
+
+ myemakeargs+=(
+ DEPMOD=:
+ DESTDIR="${D}"
+ INSTALL_MOD_PATH="${EPREFIX:-/}" # lib/modules/<kver> added by KBUILD
+ )
+
+ emake "${myemakeargs[@]}" install
+
+ einstalldocs
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ if [[ -z ${ROOT} ]] && use dist-kernel; then
+ set_arch_to_portage
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ fi
+
+ if use x86 || use arm; then
+ ewarn "32-bit kernels will likely require increasing vmalloc to"
+ ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
+ fi
+
+ if has_version sys-boot/grub; then
+ ewarn "This version of OpenZFS includes support for new feature flags"
+ ewarn "that are incompatible with previous versions. GRUB2 support for"
+ ewarn "/boot with the new feature flags is not yet available."
+ ewarn "Do *NOT* upgrade root pools to use the new feature flags."
+ ewarn "Any new pools will be created with the new feature flags by default"
+ ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
+ ewarn "create a newpool that is backward compatible wih GRUB2, use "
+ ewarn
+ ewarn "zpool create -o compatibility=grub2 ..."
+ ewarn
+ ewarn "Refer to /etc/zfs/compatibility.d/grub2 for list of features."
+ fi
+}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2021-11-11 2:22 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2021-11-11 2:22 UTC (permalink / raw
To: gentoo-commits
commit: 95c250a3f3986b2bc2091dd3981ff1e1d3de0c73
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 11 02:03:18 2021 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Thu Nov 11 02:10:52 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95c250a3
sys-fs/zfs-kmod: revbump 2.1.1 with SEEK/mmap/dnode fixes
take two
Bug: https://bugs.gentoo.org/815469
https://github.com/openzfs/zfs/issues/11900
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
.../zfs-kmod/files/2.1.1-SEEK_DATA-SEEK_HOLE.patch | 594 +++++++++++++++++++++
.../files/2.1.1-restore-dirty-dnode-logic.patch | 31 ++
sys-fs/zfs-kmod/zfs-kmod-2.1.1-r3.ebuild | 210 ++++++++
3 files changed, 835 insertions(+)
diff --git a/sys-fs/zfs-kmod/files/2.1.1-SEEK_DATA-SEEK_HOLE.patch b/sys-fs/zfs-kmod/files/2.1.1-SEEK_DATA-SEEK_HOLE.patch
new file mode 100644
index 00000000000..458fe279ee2
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/2.1.1-SEEK_DATA-SEEK_HOLE.patch
@@ -0,0 +1,594 @@
+From 664d487a5dbd758216ac613934a4080fcc1de347 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Sun, 7 Nov 2021 13:27:44 -0800
+Subject: [PATCH] Fix lseek(SEEK_DATA/SEEK_HOLE) mmap consistency
+
+When using lseek(2) to report data/holes memory mapped regions of
+the file were ignored. This could result in incorrect results.
+To handle this zfs_holey_common() was updated to asynchronously
+writeback any dirty mmap(2) regions prior to reporting holes.
+
+Additionally, while not strictly required, the dn_struct_rwlock is
+now held over the dirty check to prevent the dnode structure from
+changing. This ensures that a clean dnode can't be dirtied before
+the data/hole is located. The range lock is now also taken to
+ensure the call cannot race with zfs_write().
+
+Furthermore, the code was refactored to provide a dnode_is_dirty()
+helper function which checks the dnode for any dirty records to
+determine its dirtiness.
+
+Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
+Reviewed-by: Tony Hutter <hutter2@llnl.gov>
+Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Issue #11900
+Closes #12724
+---
+ configure.ac | 1 +
+ include/os/freebsd/spl/sys/vnode.h | 18 +++
+ include/os/freebsd/zfs/sys/zfs_znode_impl.h | 3 +-
+ include/os/linux/zfs/sys/zfs_znode_impl.h | 1 +
+ include/sys/dnode.h | 1 +
+ man/man4/zfs.4 | 2 +-
+ module/zfs/dmu.c | 53 ++++---
+ module/zfs/dnode.c | 20 +++
+ module/zfs/zfs_vnops.c | 9 +-
+ tests/runfiles/common.run | 2 +-
+ tests/zfs-tests/cmd/Makefile.am | 1 +
+ tests/zfs-tests/cmd/mmap_seek/.gitignore | 1 +
+ tests/zfs-tests/cmd/mmap_seek/Makefile.am | 6 +
+ tests/zfs-tests/cmd/mmap_seek/mmap_seek.c | 147 ++++++++++++++++++
+ tests/zfs-tests/include/commands.cfg | 1 +
+ tests/zfs-tests/include/tunables.cfg | 1 +
+ .../tests/functional/mmap/Makefile.am | 3 +-
+ .../functional/mmap/mmap_seek_001_pos.ksh | 67 ++++++++
+ 18 files changed, 305 insertions(+), 32 deletions(-)
+ create mode 100644 tests/zfs-tests/cmd/mmap_seek/.gitignore
+ create mode 100644 tests/zfs-tests/cmd/mmap_seek/Makefile.am
+ create mode 100644 tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
+ create mode 100755 tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
+
+diff --git a/configure.ac b/configure.ac
+index 6f34b210d2b..ebc7b276a64 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -221,6 +221,7 @@ AC_CONFIG_FILES([
+ tests/zfs-tests/cmd/mktree/Makefile
+ tests/zfs-tests/cmd/mmap_exec/Makefile
+ tests/zfs-tests/cmd/mmap_libaio/Makefile
++ tests/zfs-tests/cmd/mmap_seek/Makefile
+ tests/zfs-tests/cmd/mmapwrite/Makefile
+ tests/zfs-tests/cmd/nvlist_to_lua/Makefile
+ tests/zfs-tests/cmd/randfree_file/Makefile
+diff --git a/include/os/freebsd/spl/sys/vnode.h b/include/os/freebsd/spl/sys/vnode.h
+index 3670712a045..3bc8a18eeb7 100644
+--- a/include/os/freebsd/spl/sys/vnode.h
++++ b/include/os/freebsd/spl/sys/vnode.h
+@@ -59,6 +59,8 @@ enum symfollow { NO_FOLLOW = NOFOLLOW };
+ #include <sys/file.h>
+ #include <sys/filedesc.h>
+ #include <sys/syscallsubr.h>
++#include <sys/vm.h>
++#include <vm/vm_object.h>
+
+ typedef struct vop_vector vnodeops_t;
+ #define VOP_FID VOP_VPTOFH
+@@ -83,6 +85,22 @@ vn_is_readonly(vnode_t *vp)
+ #define vn_has_cached_data(vp) \
+ ((vp)->v_object != NULL && \
+ (vp)->v_object->resident_page_count > 0)
++
++static __inline void
++vn_flush_cached_data(vnode_t *vp, boolean_t sync)
++{
++#if __FreeBSD_version > 1300054
++ if (vm_object_mightbedirty(vp->v_object)) {
++#else
++ if (vp->v_object->flags & OBJ_MIGHTBEDIRTY) {
++#endif
++ int flags = sync ? OBJPC_SYNC : 0;
++ zfs_vmobject_wlock(vp->v_object);
++ vm_object_page_clean(vp->v_object, 0, 0, flags);
++ zfs_vmobject_wunlock(vp->v_object);
++ }
++}
++
+ #define vn_exists(vp) do { } while (0)
+ #define vn_invalid(vp) do { } while (0)
+ #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0)
+diff --git a/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/include/os/freebsd/zfs/sys/zfs_znode_impl.h
+index e90008c70a8..edb28d041a0 100644
+--- a/include/os/freebsd/zfs/sys/zfs_znode_impl.h
++++ b/include/os/freebsd/zfs/sys/zfs_znode_impl.h
+@@ -118,7 +118,8 @@ extern minor_t zfsdev_minor_alloc(void);
+ #define Z_ISLNK(type) ((type) == VLNK)
+ #define Z_ISDIR(type) ((type) == VDIR)
+
+-#define zn_has_cached_data(zp) vn_has_cached_data(ZTOV(zp))
++#define zn_has_cached_data(zp) vn_has_cached_data(ZTOV(zp))
++#define zn_flush_cached_data(zp, sync) vn_flush_cached_data(ZTOV(zp), sync)
+ #define zn_rlimit_fsize(zp, uio) \
+ vn_rlimit_fsize(ZTOV(zp), GET_UIO_STRUCT(uio), zfs_uio_td(uio))
+
+diff --git a/include/os/linux/zfs/sys/zfs_znode_impl.h b/include/os/linux/zfs/sys/zfs_znode_impl.h
+index 0a6273442b7..de46fc8f2bd 100644
+--- a/include/os/linux/zfs/sys/zfs_znode_impl.h
++++ b/include/os/linux/zfs/sys/zfs_znode_impl.h
+@@ -71,6 +71,7 @@ extern "C" {
+ #define Z_ISDIR(type) S_ISDIR(type)
+
+ #define zn_has_cached_data(zp) ((zp)->z_is_mapped)
++#define zn_flush_cached_data(zp, sync) write_inode_now(ZTOI(zp), sync)
+ #define zn_rlimit_fsize(zp, uio) (0)
+
+ /*
+diff --git a/include/sys/dnode.h b/include/sys/dnode.h
+index 2cdc5b8798a..af8775b9ee0 100644
+--- a/include/sys/dnode.h
++++ b/include/sys/dnode.h
+@@ -425,6 +425,7 @@ boolean_t dnode_add_ref(dnode_t *dn, void *ref);
+ void dnode_rele(dnode_t *dn, void *ref);
+ void dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting);
+ int dnode_try_claim(objset_t *os, uint64_t object, int slots);
++boolean_t dnode_is_dirty(dnode_t *dn);
+ void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx);
+ void dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, void *tag);
+ void dnode_sync(dnode_t *dn, dmu_tx_t *tx);
+diff --git a/man/man4/zfs.4 b/man/man4/zfs.4
+index 2aed6895754..20b24d898d8 100644
+--- a/man/man4/zfs.4
++++ b/man/man4/zfs.4
+@@ -1574,7 +1574,7 @@ Allow no-operation writes.
+ The occurrence of nopwrites will further depend on other pool properties
+ .Pq i.a. the checksumming and compression algorithms .
+ .
+-.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | ns 1 Pq int
++.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | Ns 1 Pq int
+ Enable forcing TXG sync to find holes.
+ When enabled forces ZFS to act like prior versions when
+ .Sy SEEK_HOLE No or Sy SEEK_DATA
+diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
+index 1c47430953b..8302d506146 100644
+--- a/module/zfs/dmu.c
++++ b/module/zfs/dmu.c
+@@ -2095,42 +2095,41 @@ int
+ dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off)
+ {
+ dnode_t *dn;
+- int i, err;
+- boolean_t clean = B_TRUE;
++ int err;
+
++restart:
+ err = dnode_hold(os, object, FTAG, &dn);
+ if (err)
+ return (err);
+
+- /*
+- * Check if dnode is dirty
+- */
+- for (i = 0; i < TXG_SIZE; i++) {
+- if (multilist_link_active(&dn->dn_dirty_link[i])) {
+- clean = B_FALSE;
+- break;
+- }
+- }
++ rw_enter(&dn->dn_struct_rwlock, RW_READER);
+
+- /*
+- * If compatibility option is on, sync any current changes before
+- * we go trundling through the block pointers.
+- */
+- if (!clean && zfs_dmu_offset_next_sync) {
+- clean = B_TRUE;
+- dnode_rele(dn, FTAG);
+- txg_wait_synced(dmu_objset_pool(os), 0);
+- err = dnode_hold(os, object, FTAG, &dn);
+- if (err)
+- return (err);
+- }
++ if (dnode_is_dirty(dn)) {
++ /*
++ * If the zfs_dmu_offset_next_sync module option is enabled
++ * then strict hole reporting has been requested. Dirty
++ * dnodes must be synced to disk to accurately report all
++ * holes. When disabled (the default) dirty dnodes are
++ * reported to not have any holes which is always safe.
++ *
++ * When called by zfs_holey_common() the zp->z_rangelock
++ * is held to prevent zfs_write() and mmap writeback from
++ * re-dirtying the dnode after txg_wait_synced().
++ */
++ if (zfs_dmu_offset_next_sync) {
++ rw_exit(&dn->dn_struct_rwlock);
++ dnode_rele(dn, FTAG);
++ txg_wait_synced(dmu_objset_pool(os), 0);
++ goto restart;
++ }
+
+- if (clean)
+- err = dnode_next_offset(dn,
+- (hole ? DNODE_FIND_HOLE : 0), off, 1, 1, 0);
+- else
+ err = SET_ERROR(EBUSY);
++ } else {
++ err = dnode_next_offset(dn, DNODE_FIND_HAVELOCK |
++ (hole ? DNODE_FIND_HOLE : 0), off, 1, 1, 0);
++ }
+
++ rw_exit(&dn->dn_struct_rwlock);
+ dnode_rele(dn, FTAG);
+
+ return (err);
+diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
+index 7f741542ce0..572d88ec2bf 100644
+--- a/module/zfs/dnode.c
++++ b/module/zfs/dnode.c
+@@ -1648,6 +1648,26 @@ dnode_try_claim(objset_t *os, uint64_t object, int slots)
+ slots, NULL, NULL));
+ }
+
++/*
++ * Checks if the dnode contains any uncommitted dirty records.
++ */
++boolean_t
++dnode_is_dirty(dnode_t *dn)
++{
++ mutex_enter(&dn->dn_mtx);
++
++ for (int i = 0; i < TXG_SIZE; i++) {
++ if (list_head(&dn->dn_dirty_records[i]) != NULL) {
++ mutex_exit(&dn->dn_mtx);
++ return (B_TRUE);
++ }
++ }
++
++ mutex_exit(&dn->dn_mtx);
++
++ return (B_FALSE);
++}
++
+ void
+ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx)
+ {
+diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
+index 8229bc9a93e..170e392abe9 100644
+--- a/module/zfs/zfs_vnops.c
++++ b/module/zfs/zfs_vnops.c
+@@ -85,6 +85,7 @@ zfs_fsync(znode_t *zp, int syncflag, cred_t *cr)
+ static int
+ zfs_holey_common(znode_t *zp, ulong_t cmd, loff_t *off)
+ {
++ zfs_locked_range_t *lr;
+ uint64_t noff = (uint64_t)*off; /* new offset */
+ uint64_t file_sz;
+ int error;
+@@ -100,12 +101,18 @@ zfs_holey_common(znode_t *zp, ulong_t cmd, loff_t *off)
+ else
+ hole = B_FALSE;
+
++ /* Flush any mmap()'d data to disk */
++ if (zn_has_cached_data(zp))
++ zn_flush_cached_data(zp, B_FALSE);
++
++ lr = zfs_rangelock_enter(&zp->z_rangelock, 0, file_sz, RL_READER);
+ error = dmu_offset_next(ZTOZSB(zp)->z_os, zp->z_id, hole, &noff);
++ zfs_rangelock_exit(lr);
+
+ if (error == ESRCH)
+ return (SET_ERROR(ENXIO));
+
+- /* file was dirty, so fall back to using generic logic */
++ /* File was dirty, so fall back to using generic logic */
+ if (error == EBUSY) {
+ if (hole)
+ *off = file_sz;
+diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run
+index a62cd6ad39f..97ee7b8ae24 100644
+--- a/tests/runfiles/common.run
++++ b/tests/runfiles/common.run
+@@ -669,7 +669,7 @@ tests = ['migration_001_pos', 'migration_002_pos', 'migration_003_pos',
+ tags = ['functional', 'migration']
+
+ [tests/functional/mmap]
+-tests = ['mmap_write_001_pos', 'mmap_read_001_pos']
++tests = ['mmap_write_001_pos', 'mmap_read_001_pos', 'mmap_seek_001_pos']
+ tags = ['functional', 'mmap']
+
+ [tests/functional/mount]
+diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am
+index 2b965ca7000..d1c29fcd1c6 100644
+--- a/tests/zfs-tests/cmd/Makefile.am
++++ b/tests/zfs-tests/cmd/Makefile.am
+@@ -19,6 +19,7 @@ SUBDIRS = \
+ mktree \
+ mmap_exec \
+ mmap_libaio \
++ mmap_seek \
+ mmapwrite \
+ nvlist_to_lua \
+ randwritecomp \
+diff --git a/tests/zfs-tests/cmd/mmap_seek/.gitignore b/tests/zfs-tests/cmd/mmap_seek/.gitignore
+new file mode 100644
+index 00000000000..6b05a791750
+--- /dev/null
++++ b/tests/zfs-tests/cmd/mmap_seek/.gitignore
+@@ -0,0 +1 @@
++/mmap_seek
+diff --git a/tests/zfs-tests/cmd/mmap_seek/Makefile.am b/tests/zfs-tests/cmd/mmap_seek/Makefile.am
+new file mode 100644
+index 00000000000..b938931125f
+--- /dev/null
++++ b/tests/zfs-tests/cmd/mmap_seek/Makefile.am
+@@ -0,0 +1,6 @@
++include $(top_srcdir)/config/Rules.am
++
++pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
++
++pkgexec_PROGRAMS = mmap_seek
++mmap_seek_SOURCES = mmap_seek.c
+diff --git a/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c b/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
+new file mode 100644
+index 00000000000..f476e1dba9a
+--- /dev/null
++++ b/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
+@@ -0,0 +1,147 @@
++/*
++ * CDDL HEADER START
++ *
++ * The contents of this file are subject to the terms of the
++ * Common Development and Distribution License (the "License").
++ * You may not use this file except in compliance with the License.
++ *
++ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++ * or http://www.opensolaris.org/os/licensing.
++ * See the License for the specific language governing permissions
++ * and limitations under the License.
++ *
++ * When distributing Covered Code, include this CDDL HEADER in each
++ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++ * If applicable, add the following below this CDDL HEADER, with the
++ * fields enclosed by brackets "[]" replaced with your own identifying
++ * information: Portions Copyright [yyyy] [name of copyright owner]
++ *
++ * CDDL HEADER END
++ */
++
++/*
++ * Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
++ */
++
++#include <unistd.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/mman.h>
++#include <errno.h>
++
++static void
++seek_data(int fd, off_t offset, off_t expected)
++{
++ off_t data_offset = lseek(fd, offset, SEEK_DATA);
++ if (data_offset != expected) {
++ fprintf(stderr, "lseek(fd, %d, SEEK_DATA) = %d (expected %d)\n",
++ (int)offset, (int)data_offset, (int)expected);
++ exit(2);
++ }
++}
++
++static void
++seek_hole(int fd, off_t offset, off_t expected)
++{
++ off_t hole_offset = lseek(fd, offset, SEEK_HOLE);
++ if (hole_offset != expected) {
++ fprintf(stderr, "lseek(fd, %d, SEEK_HOLE) = %d (expected %d)\n",
++ (int)offset, (int)hole_offset, (int)expected);
++ exit(2);
++ }
++}
++
++int
++main(int argc, char **argv)
++{
++ char *execname = argv[0];
++ char *file_path = argv[1];
++ char *buf = NULL;
++ int err;
++
++ if (argc != 4) {
++ (void) printf("usage: %s <file name> <file size> "
++ "<block size>\n", argv[0]);
++ exit(1);
++ }
++
++ int fd = open(file_path, O_RDWR | O_CREAT, 0666);
++ if (fd == -1) {
++ (void) fprintf(stderr, "%s: %s: ", execname, file_path);
++ perror("open");
++ exit(2);
++ }
++
++ off_t file_size = atoi(argv[2]);
++ off_t block_size = atoi(argv[3]);
++
++ if (block_size * 2 > file_size) {
++ (void) fprintf(stderr, "file size must be at least "
++ "double the block size\n");
++ exit(2);
++ }
++
++ err = ftruncate(fd, file_size);
++ if (err == -1) {
++ perror("ftruncate");
++ exit(2);
++ }
++
++ if ((buf = mmap(NULL, file_size, PROT_READ | PROT_WRITE,
++ MAP_SHARED, fd, 0)) == MAP_FAILED) {
++ perror("mmap");
++ exit(2);
++ }
++
++ /* Verify the file is sparse and reports no data. */
++ seek_data(fd, 0, -1);
++
++ /* Verify the file is reported as a hole. */
++ seek_hole(fd, 0, 0);
++
++ /* Verify search beyond end of file is an error. */
++ seek_data(fd, 2 * file_size, -1);
++ seek_hole(fd, 2 * file_size, -1);
++
++ /* Dirty the first byte. */
++ memset(buf, 'a', 1);
++ seek_data(fd, 0, 0);
++ seek_data(fd, block_size, -1);
++ seek_hole(fd, 0, block_size);
++ seek_hole(fd, block_size, block_size);
++
++ /* Dirty the first half of the file. */
++ memset(buf, 'b', file_size / 2);
++ seek_data(fd, 0, 0);
++ seek_data(fd, block_size, block_size);
++ seek_hole(fd, 0, P2ROUNDUP(file_size / 2, block_size));
++ seek_hole(fd, block_size, P2ROUNDUP(file_size / 2, block_size));
++
++ /* Dirty the whole file. */
++ memset(buf, 'c', file_size);
++ seek_data(fd, 0, 0);
++ seek_data(fd, file_size * 3 / 4,
++ P2ROUNDUP(file_size * 3 / 4, block_size));
++ seek_hole(fd, 0, file_size);
++ seek_hole(fd, file_size / 2, file_size);
++
++ /* Punch a hole (required compression be enabled). */
++ memset(buf + block_size, 0, block_size);
++ seek_data(fd, 0, 0);
++ seek_data(fd, block_size, 2 * block_size);
++ seek_hole(fd, 0, block_size);
++ seek_hole(fd, block_size, block_size);
++ seek_hole(fd, 2 * block_size, file_size);
++
++ err = munmap(buf, file_size);
++ if (err == -1) {
++ perror("munmap");
++ exit(2);
++ }
++
++ close(fd);
++
++ return (0);
++}
+diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg
+index 1ec73f25bae..4497a6248b4 100644
+--- a/tests/zfs-tests/include/commands.cfg
++++ b/tests/zfs-tests/include/commands.cfg
+@@ -209,6 +209,7 @@ export ZFSTEST_FILES='badsend
+ mktree
+ mmap_exec
+ mmap_libaio
++ mmap_seek
+ mmapwrite
+ nvlist_to_lua
+ randfree_file
+diff --git a/tests/zfs-tests/include/tunables.cfg b/tests/zfs-tests/include/tunables.cfg
+index 56d430a3987..fff43e46916 100644
+--- a/tests/zfs-tests/include/tunables.cfg
++++ b/tests/zfs-tests/include/tunables.cfg
+@@ -33,6 +33,7 @@ DEADMAN_FAILMODE deadman.failmode zfs_deadman_failmode
+ DEADMAN_SYNCTIME_MS deadman.synctime_ms zfs_deadman_synctime_ms
+ DEADMAN_ZIOTIME_MS deadman.ziotime_ms zfs_deadman_ziotime_ms
+ DISABLE_IVSET_GUID_CHECK disable_ivset_guid_check zfs_disable_ivset_guid_check
++DMU_OFFSET_NEXT_SYNC dmu_offset_next_sync zfs_dmu_offset_next_sync
+ INITIALIZE_CHUNK_SIZE initialize_chunk_size zfs_initialize_chunk_size
+ INITIALIZE_VALUE initialize_value zfs_initialize_value
+ KEEP_LOG_SPACEMAPS_AT_EXPORT keep_log_spacemaps_at_export zfs_keep_log_spacemaps_at_export
+diff --git a/tests/zfs-tests/tests/functional/mmap/Makefile.am b/tests/zfs-tests/tests/functional/mmap/Makefile.am
+index 2adc398b8c0..b26791ee7ce 100644
+--- a/tests/zfs-tests/tests/functional/mmap/Makefile.am
++++ b/tests/zfs-tests/tests/functional/mmap/Makefile.am
+@@ -4,7 +4,8 @@ dist_pkgdata_SCRIPTS = \
+ cleanup.ksh \
+ mmap_read_001_pos.ksh \
+ mmap_write_001_pos.ksh \
+- mmap_libaio_001_pos.ksh
++ mmap_libaio_001_pos.ksh \
++ mmap_seek_001_pos.ksh
+
+ dist_pkgdata_DATA = \
+ mmap.cfg
+diff --git a/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh b/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
+new file mode 100755
+index 00000000000..6188549ad8d
+--- /dev/null
++++ b/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
+@@ -0,0 +1,67 @@
++#!/bin/ksh -p
++#
++# CDDL HEADER START
++#
++# The contents of this file are subject to the terms of the
++# Common Development and Distribution License (the "License").
++# You may not use this file except in compliance with the License.
++#
++# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++# or http://www.opensolaris.org/os/licensing.
++# See the License for the specific language governing permissions
++# and limitations under the License.
++#
++# When distributing Covered Code, include this CDDL HEADER in each
++# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++# If applicable, add the following below this CDDL HEADER, with the
++# fields enclosed by brackets "[]" replaced with your own identifying
++# information: Portions Copyright [yyyy] [name of copyright owner]
++#
++# CDDL HEADER END
++#
++
++#
++# Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
++#
++
++. $STF_SUITE/include/libtest.shlib
++. $STF_SUITE/tests/functional/mmap/mmap.cfg
++
++#
++# DESCRIPTION:
++# lseek() data/holes for an mmap()'d file.
++#
++# STRATEGY:
++# 1. Enable compression and hole reporting for dirty files.
++# 2. Call mmap_seek binary test case for various record sizes.
++#
++
++verify_runnable "global"
++
++function cleanup
++{
++ log_must zfs set compression=off $TESTPOOL/$TESTFS
++ log_must zfs set recordsize=128k $TESTPOOL/$TESTFS
++ log_must rm -f $TESTDIR/test-mmap-file
++ log_must set_tunable64 DMU_OFFSET_NEXT_SYNC $dmu_offset_next_sync
++}
++
++log_assert "lseek() data/holes for an mmap()'d file."
++
++log_onexit cleanup
++
++# Enable hole reporting for dirty files.
++typeset dmu_offset_next_sync=$(get_tunable DMU_OFFSET_NEXT_SYNC)
++log_must set_tunable64 DMU_OFFSET_NEXT_SYNC 1
++
++# Compression must be enabled to convert zero'd blocks to holes.
++# This behavior is checked by the mmap_seek test.
++log_must zfs set compression=on $TESTPOOL/$TESTFS
++
++for bs in 4096 8192 16384 32768 65536 131072; do
++ log_must zfs set recordsize=$bs $TESTPOOL/$TESTFS
++ log_must mmap_seek $TESTDIR/test-mmap-file $((1024*1024)) $bs
++ log_must rm $TESTDIR/test-mmap-file
++done
++
++log_pass "lseek() data/holes for an mmap()'d file succeeded."
diff --git a/sys-fs/zfs-kmod/files/2.1.1-restore-dirty-dnode-logic.patch b/sys-fs/zfs-kmod/files/2.1.1-restore-dirty-dnode-logic.patch
new file mode 100644
index 00000000000..d33735ff9ff
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/2.1.1-restore-dirty-dnode-logic.patch
@@ -0,0 +1,31 @@
+From d7e640cf95f72deeca501d34afed59a0bc9d7940 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Date: Wed, 10 Nov 2021 16:14:32 -0800
+Subject: [PATCH] Restore dirty dnode detection logic
+
+In addition to flushing memory mapped regions when checking holes,
+commit de198f2d95 modified the dirty dnode detection logic to check
+the dn->dn_dirty_records instead of the dn->dn_dirty_link. Relying
+on the dirty record has not be reliable, switch back to the previous
+method.
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Issue #11900
+Closes #12745
+---
+ module/zfs/dnode.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
+index 572d88ec2bf..7044c1fc634 100644
+--- a/module/zfs/dnode.c
++++ b/module/zfs/dnode.c
+@@ -1657,7 +1657,7 @@ dnode_is_dirty(dnode_t *dn)
+ mutex_enter(&dn->dn_mtx);
+
+ for (int i = 0; i < TXG_SIZE; i++) {
+- if (list_head(&dn->dn_dirty_records[i]) != NULL) {
++ if (multilist_link_active(&dn->dn_dirty_link[i])) {
+ mutex_exit(&dn->dn_mtx);
+ return (B_TRUE);
+ }
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r3.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r3.ebuild
new file mode 100644
index 00000000000..3ab2b6a4572
--- /dev/null
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r3.ebuild
@@ -0,0 +1,210 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
+
+DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
+HOMEPAGE="https://github.com/openzfs/zfs"
+
+if [[ ${PV} == "9999" ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
+ inherit verify-sig
+
+ MY_PV="${PV/_rc/-rc}"
+ SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
+ SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
+ S="${WORKDIR}/zfs-${PV%_rc?}"
+ ZFS_KERNEL_COMPAT="5.14"
+
+ # increments minor eg 5.14 -> 5.15, and still supports override.
+ ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
+
+ if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv"
+ fi
+fi
+
+LICENSE="CDDL MIT debug? ( GPL-2+ )"
+SLOT="0/${PVR}"
+IUSE="custom-cflags debug +rootfs"
+
+RDEPEND="${DEPEND}
+ !sys-kernel/spl
+"
+
+BDEPEND="
+ dev-lang/perl
+ virtual/awk
+"
+
+# we want dist-kernel block in BDEPEND because of portage resolver.
+# since linux-mod.eclass already sets version-unbounded dep, portage
+# will pull new versions. So we set it in BDEPEND which takes priority.
+# and we don't need in in git ebuild.
+if [[ ${PV} != "9999" ]] ; then
+ BDEPEND+="
+ verify-sig? ( app-crypt/openpgp-keys-openzfs )
+ dist-kernel? ( <virtual/dist-kernel-${ZFS_KERNEL_DEP}:= )
+ "
+fi
+
+# PDEPEND in this form is needed to trick portage suggest
+# enabling dist-kernel if only 1 package have it set
+PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
+
+RESTRICT="debug? ( strip ) test"
+
+DOCS=( AUTHORS COPYRIGHT META README.md )
+
+PATCHES=(
+ "${FILESDIR}/2.1.1-SEEK_DATA-SEEK_HOLE.patch"
+ "${FILESDIR}/2.1.1-restore-dirty-dnode-logic.patch"
+)
+
+pkg_pretend() {
+ use rootfs || return 0
+
+ if has_version virtual/dist-kernel && ! use dist-kernel; then
+ ewarn "You have virtual/dist-kernel installed, but"
+ ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
+ ewarn "It's recommended to globally enable dist-kernel USE flag"
+ ewarn "to auto-trigger initrd rebuilds with kernel updates"
+ fi
+}
+
+pkg_setup() {
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ EFI_PARTITION
+ MODULES
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !TRIM_UNUSED_KSYMS
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ use rootfs && \
+ CONFIG_CHECK="${CONFIG_CHECK}
+ BLK_DEV_INITRD
+ DEVTMPFS
+ "
+
+ kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
+
+ if [[ ${PV} != "9999" ]]; then
+ local kv_major_max kv_minor_max zcompat
+ zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ kv_major_max="${zcompat%%.*}"
+ zcompat="${zcompat#*.}"
+ kv_minor_max="${zcompat%%.*}"
+ kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
+ "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
+
+ fi
+
+ kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
+
+ linux-mod_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ # Run unconditionally (bug #792627)
+ eautoreconf
+
+ if [[ ${PV} != "9999" ]]; then
+ # Set module revision number
+ sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
+ fi
+}
+
+src_configure() {
+ set_arch_to_kernel
+
+ use custom-cflags || strip-flags
+
+ filter-ldflags -Wl,*
+
+ # Set CROSS_COMPILE in the environment.
+ # This allows the user to override it via make.conf or via a local Makefile.
+ # https://bugs.gentoo.org/811600
+ export CROSS_COMPILE=${CROSS_COMPILE-${CHOST}-}
+
+ local myconf=(
+ HOSTCC="$(tc-getBUILD_CC)"
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=kernel
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ set_arch_to_kernel
+
+ myemakeargs=(
+ HOSTCC="$(tc-getBUILD_CC)"
+ V=1
+ )
+
+ emake "${myemakeargs[@]}"
+}
+
+src_install() {
+ set_arch_to_kernel
+
+ myemakeargs+=(
+ DEPMOD=:
+ DESTDIR="${D}"
+ INSTALL_MOD_PATH="${EPREFIX:-/}" # lib/modules/<kver> added by KBUILD
+ )
+
+ emake "${myemakeargs[@]}" install
+
+ einstalldocs
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+
+ if [[ -z ${ROOT} ]] && use dist-kernel; then
+ set_arch_to_portage
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ fi
+
+ if use x86 || use arm; then
+ ewarn "32-bit kernels will likely require increasing vmalloc to"
+ ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
+ fi
+
+ if has_version sys-boot/grub; then
+ ewarn "This version of OpenZFS includes support for new feature flags"
+ ewarn "that are incompatible with previous versions. GRUB2 support for"
+ ewarn "/boot with the new feature flags is not yet available."
+ ewarn "Do *NOT* upgrade root pools to use the new feature flags."
+ ewarn "Any new pools will be created with the new feature flags by default"
+ ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
+ ewarn "create a newpool that is backward compatible wih GRUB2, use "
+ ewarn
+ ewarn "zpool create -o compatibility=grub2 ..."
+ ewarn
+ ewarn "Refer to /etc/zfs/compatibility.d/grub2 for list of features."
+ fi
+}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2021-12-20 5:19 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2021-12-20 5:19 UTC (permalink / raw
To: gentoo-commits
commit: a5378d5b744c916714e60bd896c3fa87a1bd50e6
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 20 05:17:02 2021 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Mon Dec 20 05:17:02 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a5378d5b
sys-fs/zfs-kmod: drop 2.1.1-r4
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 2 -
.../zfs-kmod/files/2.1.1-SEEK_DATA-SEEK_HOLE.patch | 594 ---------------------
.../files/2.1.1-restore-dirty-dnode-logic.patch | 31 --
sys-fs/zfs-kmod/zfs-kmod-2.1.1-r4.ebuild | 216 --------
4 files changed, 843 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index e5cc220e8b89..1d9cb77a48f7 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,7 +1,5 @@
DIST zfs-0.8.6.tar.gz 9295260 BLAKE2B 45424d710aaf75a05f766ae523ae157a24b5cbdcefe72a59e4cede81e42f7a92ae7f01150388437b78cd49f3d28b9664599f2a624516e6b3f1073497194a99f2 SHA512 626b172554f39a5c70f6ea5c599a92fae52534590d1b0273de2bbfc3676d29dff0eade8ca17e5f179a59870c12bc758fb53b7900f8a1fdbdef3a9161b93f9cce
DIST zfs-2.0.6.tar.gz 13192941 BLAKE2B 3a83303b016ec4259c286af8a9ceb281829d26508d411df91dd94193bca8c3155ef0ba63604e95f6add5f0c6cf6d100b0f567efc33b6c484c9ff811924da6ccd SHA512 52a5576eed21868b2a3d63d05d3d8c35b5e59ee88c7ddab1dc070644539f9acd56bde43ba5e965ad951a6d50a014fb429a7977d2ab1a2bfcadd92ea78dd57bf8
DIST zfs-2.0.6.tar.gz.asc 836 BLAKE2B 065eba3361ef4234acc67df0236ab9a6737ba9fe5a706be98b55dd64d10360160ca787d8873f27451a2107225ae657dc4cab20a7c2a268cd2de64c8d82d0327a SHA512 123569ecfcee22ac462160acf61b120144c774bc5c0d46a50d2b7312f7565da1a9d780e1a6207dba5834917c66d5b852763e4a3162378d5c9bb90b0dfde35c5c
-DIST zfs-2.1.1.tar.gz 34836374 BLAKE2B 09ee6bd30e8266342bd975454086049c3fd9142e7dacfe52166575c20e3c92688f9b457d75b2a2068fc281e65f78e1d47450545504cdf8bc31e23663545d7800 SHA512 b69ce764a9f7438ec2c90f86be02abfd684c67cd38de876374e3e6f4b2f82a75d86fa70205def2ba454ad27e52ec8d955ebc4ba456e91d397129a54ea849c19c
-DIST zfs-2.1.1.tar.gz.asc 195 BLAKE2B d886e7dc74270228f98dfc5ca85bbbe897d5a87a5ae8bbfde28e2af1b36218227bc9f1b5902e97beebe160a298857d6e4673829d87cd8039332dc1858cfcffc0 SHA512 d76956b5c1bd547a319e70dd33d50beae39f65fca54532731426d2ef209385a556c51b3936051f75bc3800623c42da5b8d279c51f501a896f5fdfb7b4ed7fb94
DIST zfs-2.1.2.tar.gz 34829045 BLAKE2B ab4e2d85200438373c7eeeaa5256a712dbfb2862b85de1fb7554ad0cc2b9f8e1255ab4564bca62f65a81a823adb8c112957e6e8771b8e5e6944c3731bc894584 SHA512 3e3932259da2a27f1c4cca8da62b909edc43bf51ab0229d2d5d0234d9a7eaa7b63b67c06a98cbe2d29ba1eb5cbcaab16e5062c2a2bc8e84cab770be10ebf2102
DIST zfs-2.1.2.tar.gz.asc 836 BLAKE2B 8f5666f5c3d7016a4d79191f42d0a220fe8c654a0d64e3da3b575644fe52c83dcb9f9ef49ba0553771a127bba44e2802f1d366a7a38f670e73612deef76755c3 SHA512 da6bfccd19a249a6891f5e1de6c4b332e98ce4f125f638c046b9cedac3fd79c56a99dd9a620105a40741e5f04b382f5d5996b56cbe576fb268b31e57e0fed6eb
diff --git a/sys-fs/zfs-kmod/files/2.1.1-SEEK_DATA-SEEK_HOLE.patch b/sys-fs/zfs-kmod/files/2.1.1-SEEK_DATA-SEEK_HOLE.patch
deleted file mode 100644
index 458fe279ee23..000000000000
--- a/sys-fs/zfs-kmod/files/2.1.1-SEEK_DATA-SEEK_HOLE.patch
+++ /dev/null
@@ -1,594 +0,0 @@
-From 664d487a5dbd758216ac613934a4080fcc1de347 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <behlendorf1@llnl.gov>
-Date: Sun, 7 Nov 2021 13:27:44 -0800
-Subject: [PATCH] Fix lseek(SEEK_DATA/SEEK_HOLE) mmap consistency
-
-When using lseek(2) to report data/holes memory mapped regions of
-the file were ignored. This could result in incorrect results.
-To handle this zfs_holey_common() was updated to asynchronously
-writeback any dirty mmap(2) regions prior to reporting holes.
-
-Additionally, while not strictly required, the dn_struct_rwlock is
-now held over the dirty check to prevent the dnode structure from
-changing. This ensures that a clean dnode can't be dirtied before
-the data/hole is located. The range lock is now also taken to
-ensure the call cannot race with zfs_write().
-
-Furthermore, the code was refactored to provide a dnode_is_dirty()
-helper function which checks the dnode for any dirty records to
-determine its dirtiness.
-
-Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
-Reviewed-by: Tony Hutter <hutter2@llnl.gov>
-Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
-Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Issue #11900
-Closes #12724
----
- configure.ac | 1 +
- include/os/freebsd/spl/sys/vnode.h | 18 +++
- include/os/freebsd/zfs/sys/zfs_znode_impl.h | 3 +-
- include/os/linux/zfs/sys/zfs_znode_impl.h | 1 +
- include/sys/dnode.h | 1 +
- man/man4/zfs.4 | 2 +-
- module/zfs/dmu.c | 53 ++++---
- module/zfs/dnode.c | 20 +++
- module/zfs/zfs_vnops.c | 9 +-
- tests/runfiles/common.run | 2 +-
- tests/zfs-tests/cmd/Makefile.am | 1 +
- tests/zfs-tests/cmd/mmap_seek/.gitignore | 1 +
- tests/zfs-tests/cmd/mmap_seek/Makefile.am | 6 +
- tests/zfs-tests/cmd/mmap_seek/mmap_seek.c | 147 ++++++++++++++++++
- tests/zfs-tests/include/commands.cfg | 1 +
- tests/zfs-tests/include/tunables.cfg | 1 +
- .../tests/functional/mmap/Makefile.am | 3 +-
- .../functional/mmap/mmap_seek_001_pos.ksh | 67 ++++++++
- 18 files changed, 305 insertions(+), 32 deletions(-)
- create mode 100644 tests/zfs-tests/cmd/mmap_seek/.gitignore
- create mode 100644 tests/zfs-tests/cmd/mmap_seek/Makefile.am
- create mode 100644 tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
- create mode 100755 tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
-
-diff --git a/configure.ac b/configure.ac
-index 6f34b210d2b..ebc7b276a64 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -221,6 +221,7 @@ AC_CONFIG_FILES([
- tests/zfs-tests/cmd/mktree/Makefile
- tests/zfs-tests/cmd/mmap_exec/Makefile
- tests/zfs-tests/cmd/mmap_libaio/Makefile
-+ tests/zfs-tests/cmd/mmap_seek/Makefile
- tests/zfs-tests/cmd/mmapwrite/Makefile
- tests/zfs-tests/cmd/nvlist_to_lua/Makefile
- tests/zfs-tests/cmd/randfree_file/Makefile
-diff --git a/include/os/freebsd/spl/sys/vnode.h b/include/os/freebsd/spl/sys/vnode.h
-index 3670712a045..3bc8a18eeb7 100644
---- a/include/os/freebsd/spl/sys/vnode.h
-+++ b/include/os/freebsd/spl/sys/vnode.h
-@@ -59,6 +59,8 @@ enum symfollow { NO_FOLLOW = NOFOLLOW };
- #include <sys/file.h>
- #include <sys/filedesc.h>
- #include <sys/syscallsubr.h>
-+#include <sys/vm.h>
-+#include <vm/vm_object.h>
-
- typedef struct vop_vector vnodeops_t;
- #define VOP_FID VOP_VPTOFH
-@@ -83,6 +85,22 @@ vn_is_readonly(vnode_t *vp)
- #define vn_has_cached_data(vp) \
- ((vp)->v_object != NULL && \
- (vp)->v_object->resident_page_count > 0)
-+
-+static __inline void
-+vn_flush_cached_data(vnode_t *vp, boolean_t sync)
-+{
-+#if __FreeBSD_version > 1300054
-+ if (vm_object_mightbedirty(vp->v_object)) {
-+#else
-+ if (vp->v_object->flags & OBJ_MIGHTBEDIRTY) {
-+#endif
-+ int flags = sync ? OBJPC_SYNC : 0;
-+ zfs_vmobject_wlock(vp->v_object);
-+ vm_object_page_clean(vp->v_object, 0, 0, flags);
-+ zfs_vmobject_wunlock(vp->v_object);
-+ }
-+}
-+
- #define vn_exists(vp) do { } while (0)
- #define vn_invalid(vp) do { } while (0)
- #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0)
-diff --git a/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/include/os/freebsd/zfs/sys/zfs_znode_impl.h
-index e90008c70a8..edb28d041a0 100644
---- a/include/os/freebsd/zfs/sys/zfs_znode_impl.h
-+++ b/include/os/freebsd/zfs/sys/zfs_znode_impl.h
-@@ -118,7 +118,8 @@ extern minor_t zfsdev_minor_alloc(void);
- #define Z_ISLNK(type) ((type) == VLNK)
- #define Z_ISDIR(type) ((type) == VDIR)
-
--#define zn_has_cached_data(zp) vn_has_cached_data(ZTOV(zp))
-+#define zn_has_cached_data(zp) vn_has_cached_data(ZTOV(zp))
-+#define zn_flush_cached_data(zp, sync) vn_flush_cached_data(ZTOV(zp), sync)
- #define zn_rlimit_fsize(zp, uio) \
- vn_rlimit_fsize(ZTOV(zp), GET_UIO_STRUCT(uio), zfs_uio_td(uio))
-
-diff --git a/include/os/linux/zfs/sys/zfs_znode_impl.h b/include/os/linux/zfs/sys/zfs_znode_impl.h
-index 0a6273442b7..de46fc8f2bd 100644
---- a/include/os/linux/zfs/sys/zfs_znode_impl.h
-+++ b/include/os/linux/zfs/sys/zfs_znode_impl.h
-@@ -71,6 +71,7 @@ extern "C" {
- #define Z_ISDIR(type) S_ISDIR(type)
-
- #define zn_has_cached_data(zp) ((zp)->z_is_mapped)
-+#define zn_flush_cached_data(zp, sync) write_inode_now(ZTOI(zp), sync)
- #define zn_rlimit_fsize(zp, uio) (0)
-
- /*
-diff --git a/include/sys/dnode.h b/include/sys/dnode.h
-index 2cdc5b8798a..af8775b9ee0 100644
---- a/include/sys/dnode.h
-+++ b/include/sys/dnode.h
-@@ -425,6 +425,7 @@ boolean_t dnode_add_ref(dnode_t *dn, void *ref);
- void dnode_rele(dnode_t *dn, void *ref);
- void dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting);
- int dnode_try_claim(objset_t *os, uint64_t object, int slots);
-+boolean_t dnode_is_dirty(dnode_t *dn);
- void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx);
- void dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, void *tag);
- void dnode_sync(dnode_t *dn, dmu_tx_t *tx);
-diff --git a/man/man4/zfs.4 b/man/man4/zfs.4
-index 2aed6895754..20b24d898d8 100644
---- a/man/man4/zfs.4
-+++ b/man/man4/zfs.4
-@@ -1574,7 +1574,7 @@ Allow no-operation writes.
- The occurrence of nopwrites will further depend on other pool properties
- .Pq i.a. the checksumming and compression algorithms .
- .
--.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | ns 1 Pq int
-+.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | Ns 1 Pq int
- Enable forcing TXG sync to find holes.
- When enabled forces ZFS to act like prior versions when
- .Sy SEEK_HOLE No or Sy SEEK_DATA
-diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
-index 1c47430953b..8302d506146 100644
---- a/module/zfs/dmu.c
-+++ b/module/zfs/dmu.c
-@@ -2095,42 +2095,41 @@ int
- dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off)
- {
- dnode_t *dn;
-- int i, err;
-- boolean_t clean = B_TRUE;
-+ int err;
-
-+restart:
- err = dnode_hold(os, object, FTAG, &dn);
- if (err)
- return (err);
-
-- /*
-- * Check if dnode is dirty
-- */
-- for (i = 0; i < TXG_SIZE; i++) {
-- if (multilist_link_active(&dn->dn_dirty_link[i])) {
-- clean = B_FALSE;
-- break;
-- }
-- }
-+ rw_enter(&dn->dn_struct_rwlock, RW_READER);
-
-- /*
-- * If compatibility option is on, sync any current changes before
-- * we go trundling through the block pointers.
-- */
-- if (!clean && zfs_dmu_offset_next_sync) {
-- clean = B_TRUE;
-- dnode_rele(dn, FTAG);
-- txg_wait_synced(dmu_objset_pool(os), 0);
-- err = dnode_hold(os, object, FTAG, &dn);
-- if (err)
-- return (err);
-- }
-+ if (dnode_is_dirty(dn)) {
-+ /*
-+ * If the zfs_dmu_offset_next_sync module option is enabled
-+ * then strict hole reporting has been requested. Dirty
-+ * dnodes must be synced to disk to accurately report all
-+ * holes. When disabled (the default) dirty dnodes are
-+ * reported to not have any holes which is always safe.
-+ *
-+ * When called by zfs_holey_common() the zp->z_rangelock
-+ * is held to prevent zfs_write() and mmap writeback from
-+ * re-dirtying the dnode after txg_wait_synced().
-+ */
-+ if (zfs_dmu_offset_next_sync) {
-+ rw_exit(&dn->dn_struct_rwlock);
-+ dnode_rele(dn, FTAG);
-+ txg_wait_synced(dmu_objset_pool(os), 0);
-+ goto restart;
-+ }
-
-- if (clean)
-- err = dnode_next_offset(dn,
-- (hole ? DNODE_FIND_HOLE : 0), off, 1, 1, 0);
-- else
- err = SET_ERROR(EBUSY);
-+ } else {
-+ err = dnode_next_offset(dn, DNODE_FIND_HAVELOCK |
-+ (hole ? DNODE_FIND_HOLE : 0), off, 1, 1, 0);
-+ }
-
-+ rw_exit(&dn->dn_struct_rwlock);
- dnode_rele(dn, FTAG);
-
- return (err);
-diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
-index 7f741542ce0..572d88ec2bf 100644
---- a/module/zfs/dnode.c
-+++ b/module/zfs/dnode.c
-@@ -1648,6 +1648,26 @@ dnode_try_claim(objset_t *os, uint64_t object, int slots)
- slots, NULL, NULL));
- }
-
-+/*
-+ * Checks if the dnode contains any uncommitted dirty records.
-+ */
-+boolean_t
-+dnode_is_dirty(dnode_t *dn)
-+{
-+ mutex_enter(&dn->dn_mtx);
-+
-+ for (int i = 0; i < TXG_SIZE; i++) {
-+ if (list_head(&dn->dn_dirty_records[i]) != NULL) {
-+ mutex_exit(&dn->dn_mtx);
-+ return (B_TRUE);
-+ }
-+ }
-+
-+ mutex_exit(&dn->dn_mtx);
-+
-+ return (B_FALSE);
-+}
-+
- void
- dnode_setdirty(dnode_t *dn, dmu_tx_t *tx)
- {
-diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
-index 8229bc9a93e..170e392abe9 100644
---- a/module/zfs/zfs_vnops.c
-+++ b/module/zfs/zfs_vnops.c
-@@ -85,6 +85,7 @@ zfs_fsync(znode_t *zp, int syncflag, cred_t *cr)
- static int
- zfs_holey_common(znode_t *zp, ulong_t cmd, loff_t *off)
- {
-+ zfs_locked_range_t *lr;
- uint64_t noff = (uint64_t)*off; /* new offset */
- uint64_t file_sz;
- int error;
-@@ -100,12 +101,18 @@ zfs_holey_common(znode_t *zp, ulong_t cmd, loff_t *off)
- else
- hole = B_FALSE;
-
-+ /* Flush any mmap()'d data to disk */
-+ if (zn_has_cached_data(zp))
-+ zn_flush_cached_data(zp, B_FALSE);
-+
-+ lr = zfs_rangelock_enter(&zp->z_rangelock, 0, file_sz, RL_READER);
- error = dmu_offset_next(ZTOZSB(zp)->z_os, zp->z_id, hole, &noff);
-+ zfs_rangelock_exit(lr);
-
- if (error == ESRCH)
- return (SET_ERROR(ENXIO));
-
-- /* file was dirty, so fall back to using generic logic */
-+ /* File was dirty, so fall back to using generic logic */
- if (error == EBUSY) {
- if (hole)
- *off = file_sz;
-diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run
-index a62cd6ad39f..97ee7b8ae24 100644
---- a/tests/runfiles/common.run
-+++ b/tests/runfiles/common.run
-@@ -669,7 +669,7 @@ tests = ['migration_001_pos', 'migration_002_pos', 'migration_003_pos',
- tags = ['functional', 'migration']
-
- [tests/functional/mmap]
--tests = ['mmap_write_001_pos', 'mmap_read_001_pos']
-+tests = ['mmap_write_001_pos', 'mmap_read_001_pos', 'mmap_seek_001_pos']
- tags = ['functional', 'mmap']
-
- [tests/functional/mount]
-diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am
-index 2b965ca7000..d1c29fcd1c6 100644
---- a/tests/zfs-tests/cmd/Makefile.am
-+++ b/tests/zfs-tests/cmd/Makefile.am
-@@ -19,6 +19,7 @@ SUBDIRS = \
- mktree \
- mmap_exec \
- mmap_libaio \
-+ mmap_seek \
- mmapwrite \
- nvlist_to_lua \
- randwritecomp \
-diff --git a/tests/zfs-tests/cmd/mmap_seek/.gitignore b/tests/zfs-tests/cmd/mmap_seek/.gitignore
-new file mode 100644
-index 00000000000..6b05a791750
---- /dev/null
-+++ b/tests/zfs-tests/cmd/mmap_seek/.gitignore
-@@ -0,0 +1 @@
-+/mmap_seek
-diff --git a/tests/zfs-tests/cmd/mmap_seek/Makefile.am b/tests/zfs-tests/cmd/mmap_seek/Makefile.am
-new file mode 100644
-index 00000000000..b938931125f
---- /dev/null
-+++ b/tests/zfs-tests/cmd/mmap_seek/Makefile.am
-@@ -0,0 +1,6 @@
-+include $(top_srcdir)/config/Rules.am
-+
-+pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
-+
-+pkgexec_PROGRAMS = mmap_seek
-+mmap_seek_SOURCES = mmap_seek.c
-diff --git a/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c b/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
-new file mode 100644
-index 00000000000..f476e1dba9a
---- /dev/null
-+++ b/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c
-@@ -0,0 +1,147 @@
-+/*
-+ * CDDL HEADER START
-+ *
-+ * The contents of this file are subject to the terms of the
-+ * Common Development and Distribution License (the "License").
-+ * You may not use this file except in compliance with the License.
-+ *
-+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+ * or http://www.opensolaris.org/os/licensing.
-+ * See the License for the specific language governing permissions
-+ * and limitations under the License.
-+ *
-+ * When distributing Covered Code, include this CDDL HEADER in each
-+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+ * If applicable, add the following below this CDDL HEADER, with the
-+ * fields enclosed by brackets "[]" replaced with your own identifying
-+ * information: Portions Copyright [yyyy] [name of copyright owner]
-+ *
-+ * CDDL HEADER END
-+ */
-+
-+/*
-+ * Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
-+ */
-+
-+#include <unistd.h>
-+#include <fcntl.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <sys/mman.h>
-+#include <errno.h>
-+
-+static void
-+seek_data(int fd, off_t offset, off_t expected)
-+{
-+ off_t data_offset = lseek(fd, offset, SEEK_DATA);
-+ if (data_offset != expected) {
-+ fprintf(stderr, "lseek(fd, %d, SEEK_DATA) = %d (expected %d)\n",
-+ (int)offset, (int)data_offset, (int)expected);
-+ exit(2);
-+ }
-+}
-+
-+static void
-+seek_hole(int fd, off_t offset, off_t expected)
-+{
-+ off_t hole_offset = lseek(fd, offset, SEEK_HOLE);
-+ if (hole_offset != expected) {
-+ fprintf(stderr, "lseek(fd, %d, SEEK_HOLE) = %d (expected %d)\n",
-+ (int)offset, (int)hole_offset, (int)expected);
-+ exit(2);
-+ }
-+}
-+
-+int
-+main(int argc, char **argv)
-+{
-+ char *execname = argv[0];
-+ char *file_path = argv[1];
-+ char *buf = NULL;
-+ int err;
-+
-+ if (argc != 4) {
-+ (void) printf("usage: %s <file name> <file size> "
-+ "<block size>\n", argv[0]);
-+ exit(1);
-+ }
-+
-+ int fd = open(file_path, O_RDWR | O_CREAT, 0666);
-+ if (fd == -1) {
-+ (void) fprintf(stderr, "%s: %s: ", execname, file_path);
-+ perror("open");
-+ exit(2);
-+ }
-+
-+ off_t file_size = atoi(argv[2]);
-+ off_t block_size = atoi(argv[3]);
-+
-+ if (block_size * 2 > file_size) {
-+ (void) fprintf(stderr, "file size must be at least "
-+ "double the block size\n");
-+ exit(2);
-+ }
-+
-+ err = ftruncate(fd, file_size);
-+ if (err == -1) {
-+ perror("ftruncate");
-+ exit(2);
-+ }
-+
-+ if ((buf = mmap(NULL, file_size, PROT_READ | PROT_WRITE,
-+ MAP_SHARED, fd, 0)) == MAP_FAILED) {
-+ perror("mmap");
-+ exit(2);
-+ }
-+
-+ /* Verify the file is sparse and reports no data. */
-+ seek_data(fd, 0, -1);
-+
-+ /* Verify the file is reported as a hole. */
-+ seek_hole(fd, 0, 0);
-+
-+ /* Verify search beyond end of file is an error. */
-+ seek_data(fd, 2 * file_size, -1);
-+ seek_hole(fd, 2 * file_size, -1);
-+
-+ /* Dirty the first byte. */
-+ memset(buf, 'a', 1);
-+ seek_data(fd, 0, 0);
-+ seek_data(fd, block_size, -1);
-+ seek_hole(fd, 0, block_size);
-+ seek_hole(fd, block_size, block_size);
-+
-+ /* Dirty the first half of the file. */
-+ memset(buf, 'b', file_size / 2);
-+ seek_data(fd, 0, 0);
-+ seek_data(fd, block_size, block_size);
-+ seek_hole(fd, 0, P2ROUNDUP(file_size / 2, block_size));
-+ seek_hole(fd, block_size, P2ROUNDUP(file_size / 2, block_size));
-+
-+ /* Dirty the whole file. */
-+ memset(buf, 'c', file_size);
-+ seek_data(fd, 0, 0);
-+ seek_data(fd, file_size * 3 / 4,
-+ P2ROUNDUP(file_size * 3 / 4, block_size));
-+ seek_hole(fd, 0, file_size);
-+ seek_hole(fd, file_size / 2, file_size);
-+
-+ /* Punch a hole (required compression be enabled). */
-+ memset(buf + block_size, 0, block_size);
-+ seek_data(fd, 0, 0);
-+ seek_data(fd, block_size, 2 * block_size);
-+ seek_hole(fd, 0, block_size);
-+ seek_hole(fd, block_size, block_size);
-+ seek_hole(fd, 2 * block_size, file_size);
-+
-+ err = munmap(buf, file_size);
-+ if (err == -1) {
-+ perror("munmap");
-+ exit(2);
-+ }
-+
-+ close(fd);
-+
-+ return (0);
-+}
-diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg
-index 1ec73f25bae..4497a6248b4 100644
---- a/tests/zfs-tests/include/commands.cfg
-+++ b/tests/zfs-tests/include/commands.cfg
-@@ -209,6 +209,7 @@ export ZFSTEST_FILES='badsend
- mktree
- mmap_exec
- mmap_libaio
-+ mmap_seek
- mmapwrite
- nvlist_to_lua
- randfree_file
-diff --git a/tests/zfs-tests/include/tunables.cfg b/tests/zfs-tests/include/tunables.cfg
-index 56d430a3987..fff43e46916 100644
---- a/tests/zfs-tests/include/tunables.cfg
-+++ b/tests/zfs-tests/include/tunables.cfg
-@@ -33,6 +33,7 @@ DEADMAN_FAILMODE deadman.failmode zfs_deadman_failmode
- DEADMAN_SYNCTIME_MS deadman.synctime_ms zfs_deadman_synctime_ms
- DEADMAN_ZIOTIME_MS deadman.ziotime_ms zfs_deadman_ziotime_ms
- DISABLE_IVSET_GUID_CHECK disable_ivset_guid_check zfs_disable_ivset_guid_check
-+DMU_OFFSET_NEXT_SYNC dmu_offset_next_sync zfs_dmu_offset_next_sync
- INITIALIZE_CHUNK_SIZE initialize_chunk_size zfs_initialize_chunk_size
- INITIALIZE_VALUE initialize_value zfs_initialize_value
- KEEP_LOG_SPACEMAPS_AT_EXPORT keep_log_spacemaps_at_export zfs_keep_log_spacemaps_at_export
-diff --git a/tests/zfs-tests/tests/functional/mmap/Makefile.am b/tests/zfs-tests/tests/functional/mmap/Makefile.am
-index 2adc398b8c0..b26791ee7ce 100644
---- a/tests/zfs-tests/tests/functional/mmap/Makefile.am
-+++ b/tests/zfs-tests/tests/functional/mmap/Makefile.am
-@@ -4,7 +4,8 @@ dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- mmap_read_001_pos.ksh \
- mmap_write_001_pos.ksh \
-- mmap_libaio_001_pos.ksh
-+ mmap_libaio_001_pos.ksh \
-+ mmap_seek_001_pos.ksh
-
- dist_pkgdata_DATA = \
- mmap.cfg
-diff --git a/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh b/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
-new file mode 100755
-index 00000000000..6188549ad8d
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/mmap/mmap_seek_001_pos.ksh
-@@ -0,0 +1,67 @@
-+#!/bin/ksh -p
-+#
-+# CDDL HEADER START
-+#
-+# The contents of this file are subject to the terms of the
-+# Common Development and Distribution License (the "License").
-+# You may not use this file except in compliance with the License.
-+#
-+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+# or http://www.opensolaris.org/os/licensing.
-+# See the License for the specific language governing permissions
-+# and limitations under the License.
-+#
-+# When distributing Covered Code, include this CDDL HEADER in each
-+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+# If applicable, add the following below this CDDL HEADER, with the
-+# fields enclosed by brackets "[]" replaced with your own identifying
-+# information: Portions Copyright [yyyy] [name of copyright owner]
-+#
-+# CDDL HEADER END
-+#
-+
-+#
-+# Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
-+#
-+
-+. $STF_SUITE/include/libtest.shlib
-+. $STF_SUITE/tests/functional/mmap/mmap.cfg
-+
-+#
-+# DESCRIPTION:
-+# lseek() data/holes for an mmap()'d file.
-+#
-+# STRATEGY:
-+# 1. Enable compression and hole reporting for dirty files.
-+# 2. Call mmap_seek binary test case for various record sizes.
-+#
-+
-+verify_runnable "global"
-+
-+function cleanup
-+{
-+ log_must zfs set compression=off $TESTPOOL/$TESTFS
-+ log_must zfs set recordsize=128k $TESTPOOL/$TESTFS
-+ log_must rm -f $TESTDIR/test-mmap-file
-+ log_must set_tunable64 DMU_OFFSET_NEXT_SYNC $dmu_offset_next_sync
-+}
-+
-+log_assert "lseek() data/holes for an mmap()'d file."
-+
-+log_onexit cleanup
-+
-+# Enable hole reporting for dirty files.
-+typeset dmu_offset_next_sync=$(get_tunable DMU_OFFSET_NEXT_SYNC)
-+log_must set_tunable64 DMU_OFFSET_NEXT_SYNC 1
-+
-+# Compression must be enabled to convert zero'd blocks to holes.
-+# This behavior is checked by the mmap_seek test.
-+log_must zfs set compression=on $TESTPOOL/$TESTFS
-+
-+for bs in 4096 8192 16384 32768 65536 131072; do
-+ log_must zfs set recordsize=$bs $TESTPOOL/$TESTFS
-+ log_must mmap_seek $TESTDIR/test-mmap-file $((1024*1024)) $bs
-+ log_must rm $TESTDIR/test-mmap-file
-+done
-+
-+log_pass "lseek() data/holes for an mmap()'d file succeeded."
diff --git a/sys-fs/zfs-kmod/files/2.1.1-restore-dirty-dnode-logic.patch b/sys-fs/zfs-kmod/files/2.1.1-restore-dirty-dnode-logic.patch
deleted file mode 100644
index d33735ff9ff6..000000000000
--- a/sys-fs/zfs-kmod/files/2.1.1-restore-dirty-dnode-logic.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From d7e640cf95f72deeca501d34afed59a0bc9d7940 Mon Sep 17 00:00:00 2001
-From: Brian Behlendorf <behlendorf1@llnl.gov>
-Date: Wed, 10 Nov 2021 16:14:32 -0800
-Subject: [PATCH] Restore dirty dnode detection logic
-
-In addition to flushing memory mapped regions when checking holes,
-commit de198f2d95 modified the dirty dnode detection logic to check
-the dn->dn_dirty_records instead of the dn->dn_dirty_link. Relying
-on the dirty record has not be reliable, switch back to the previous
-method.
-
-Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Issue #11900
-Closes #12745
----
- module/zfs/dnode.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
-index 572d88ec2bf..7044c1fc634 100644
---- a/module/zfs/dnode.c
-+++ b/module/zfs/dnode.c
-@@ -1657,7 +1657,7 @@ dnode_is_dirty(dnode_t *dn)
- mutex_enter(&dn->dn_mtx);
-
- for (int i = 0; i < TXG_SIZE; i++) {
-- if (list_head(&dn->dn_dirty_records[i]) != NULL) {
-+ if (multilist_link_active(&dn->dn_dirty_link[i])) {
- mutex_exit(&dn->dn_mtx);
- return (B_TRUE);
- }
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r4.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r4.ebuild
deleted file mode 100644
index e2b19d42914b..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.1.1-r4.ebuild
+++ /dev/null
@@ -1,216 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-if [[ ${PV} == "9999" ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV="${PV/_rc/-rc}"
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${PV%_rc?}"
- ZFS_KERNEL_COMPAT="5.15"
-
- # increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]]; then
- KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-
-RDEPEND="${DEPEND}
- !sys-kernel/spl
-"
-
-BDEPEND="
- dev-lang/perl
- virtual/awk
-"
-
-# we want dist-kernel block in BDEPEND because of portage resolver.
-# since linux-mod.eclass already sets version-unbounded dep, portage
-# will pull new versions. So we set it in BDEPEND which takes priority.
-# and we don't need in in git ebuild.
-if [[ ${PV} != "9999" ]] ; then
- BDEPEND+="
- verify-sig? ( sec-keys/openpgp-keys-openzfs )
- dist-kernel? ( <virtual/dist-kernel-${ZFS_KERNEL_DEP}:= )
- "
-fi
-
-# PDEPEND in this form is needed to trick portage suggest
-# enabling dist-kernel if only 1 package have it set
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-RESTRICT="debug? ( strip ) test"
-
-DOCS=( AUTHORS COPYRIGHT META README.md )
-
-PATCHES=(
- "${FILESDIR}/2.1.1-SEEK_DATA-SEEK_HOLE.patch"
- "${FILESDIR}/2.1.1-restore-dirty-dnode-logic.patch"
-)
-
-pkg_pretend() {
- use rootfs || return 0
-
- if has_version virtual/dist-kernel && ! use dist-kernel; then
- ewarn "You have virtual/dist-kernel installed, but"
- ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
- ewarn "It's recommended to globally enable dist-kernel USE flag"
- ewarn "to auto-trigger initrd rebuilds with kernel updates"
- fi
-}
-
-pkg_setup() {
- CONFIG_CHECK="
- !DEBUG_LOCK_ALLOC
- EFI_PARTITION
- MODULES
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- !TRIM_UNUSED_KSYMS
- ZLIB_DEFLATE
- ZLIB_INFLATE
- "
-
- use debug && CONFIG_CHECK="${CONFIG_CHECK}
- FRAME_POINTER
- DEBUG_INFO
- !DEBUG_INFO_REDUCED
- "
-
- use rootfs && \
- CONFIG_CHECK="${CONFIG_CHECK}
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
-
- if [[ ${PV} != "9999" ]]; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
-
- fi
-
- kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
-
- linux-mod_pkg_setup
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != "9999" ]]; then
- # Set module revision number
- sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
- fi
-}
-
-src_configure() {
- set_arch_to_kernel
-
- use custom-cflags || strip-flags
-
- filter-ldflags -Wl,*
-
- # Set CROSS_COMPILE in the environment.
- # This allows the user to override it via make.conf or via a local Makefile.
- # https://bugs.gentoo.org/811600
- export CROSS_COMPILE=${CROSS_COMPILE-${CHOST}-}
-
- local myconf=(
- HOSTCC="$(tc-getBUILD_CC)"
- --bindir="${EPREFIX}/bin"
- --sbindir="${EPREFIX}/sbin"
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- set_arch_to_kernel
-
- myemakeargs=(
- HOSTCC="$(tc-getBUILD_CC)"
- V=1
- )
-
- emake "${myemakeargs[@]}"
-}
-
-src_install() {
- set_arch_to_kernel
-
- myemakeargs+=(
- DEPMOD=:
- DESTDIR="${D}"
- INSTALL_MOD_PATH="${EPREFIX:-/}" # lib/modules/<kver> added by KBUILD
- )
-
- emake "${myemakeargs[@]}" install
-
- einstalldocs
-}
-
-pkg_postinst() {
- linux-mod_pkg_postinst
-
- if [[ -z ${ROOT} ]] && use dist-kernel; then
- set_arch_to_portage
- dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
- fi
-
- if use x86 || use arm; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
- ewarn "create a newpool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /etc/zfs/compatibility.d/grub2 for list of features."
- fi
-
- echo
- ewarn "This versions of ${PN} includes a very important fix for upstream bug"
- ewarn "https://github.com/openzfs/zfs/issues/11900"
- ewarn "Please reboot into kernel with ${P} as soon as possible"
- echo
-}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2022-03-22 18:01 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2022-03-22 18:01 UTC (permalink / raw
To: gentoo-commits
commit: 2f73f5b8ed0602bdf8a0d7fbfb9643cb3a9740bd
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 22 18:00:48 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar 22 18:01:09 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f73f5b8
sys-fs/zfs-kmod: fix -Werror issue
Closes: https://bugs.gentoo.org/835646
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-fs/zfs-kmod/files/2.1.3-werror.patch | 30 ++++++++++++++++++++++++++++++
sys-fs/zfs-kmod/zfs-kmod-2.1.3.ebuild | 4 ++++
2 files changed, 34 insertions(+)
diff --git a/sys-fs/zfs-kmod/files/2.1.3-werror.patch b/sys-fs/zfs-kmod/files/2.1.3-werror.patch
new file mode 100644
index 000000000000..b4aba47d8324
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/2.1.3-werror.patch
@@ -0,0 +1,30 @@
+https://bugs.gentoo.org/835646
+https://github.com/openzfs/zfs/commit/7b215d93bcc0a72d7020ccc050c64f39aa7f2be8.patch
+
+From: Ryan Moeller <freqlabs@FreeBSD.org>
+Date: Thu, 17 Mar 2022 13:18:23 -0400
+Subject: [PATCH] Fix module build with -Werror
+
+This is a direct commit to zfs-2.1-release to fix release builds that
+error out on an unused variable. The issue is avoided on master by a
+huge series of commits that change how the ASSERT macros work, but that
+is not feasible to backport.
+
+Reviewed-by: Tony Hutter <hutter2@llnl.gov>
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Reviewed-by: Igor Kozhukhov <igor@dilos.org>
+Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
+Closes #13194
+Closes #13196
+--- a/module/zfs/arc.c
++++ b/module/zfs/arc.c
+@@ -1205,7 +1205,7 @@ static void
+ hdr_l2only_dest(void *vbuf, void *unused)
+ {
+ (void) unused;
+- arc_buf_hdr_t *hdr = vbuf;
++ arc_buf_hdr_t *hdr __maybe_unused = vbuf;
+
+ ASSERT(HDR_EMPTY(hdr));
+ arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS);
+
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.1.3.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.3.ebuild
index 2c6ab28bcfde..39f9cc590a1a 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-2.1.3.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.1.3.ebuild
@@ -62,6 +62,10 @@ RESTRICT="debug? ( strip ) test"
DOCS=( AUTHORS COPYRIGHT META README.md )
+PATCHES=(
+ "${FILESDIR}"/${PV}-werror.patch
+)
+
pkg_pretend() {
use rootfs || return 0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2022-09-17 22:16 Georgy Yakovlev
0 siblings, 0 replies; 21+ messages in thread
From: Georgy Yakovlev @ 2022-09-17 22:16 UTC (permalink / raw
To: gentoo-commits
commit: 343037a0b292a176d153a7e188f259bb57162007
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 17 22:13:13 2022 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sat Sep 17 22:14:00 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=343037a0
sys-fs/zfs-kmod: drop 2.1.4-r1
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 2 -
sys-fs/zfs-kmod/files/2.1.4-ZERO_RANGE.patch | 304 ---------------------------
sys-fs/zfs-kmod/zfs-kmod-2.1.4-r1.ebuild | 209 ------------------
3 files changed, 515 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index e252f0fccc10..9e6e521d9fef 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,5 +1,3 @@
-DIST zfs-2.1.4.tar.gz 34896310 BLAKE2B be303f1181f604770536aa4aa61d5319ec408abbd04964cedadd15b3101a15deba6539bb5d833f4fed357f323d74f622d035305df699b213df41ae45bffdd200 SHA512 c7b57c43fc287b22905067ab022df4133d32e1a5dc335f7baf743b4ef88f64c2bf9d41318c2083230d077dd49e68f7d9e6172266e13d4b1eee29d359860f969e
-DIST zfs-2.1.4.tar.gz.asc 836 BLAKE2B b311730f72d534c87a782515f35a354bfbefba0513dc0cee5b0b497cf742590f13be6a49ff8a70d7d6503d0ba06b0266e7d290d718337add614812c3d1b0731a SHA512 53880cd5369f468551bab685eb83739ed76aa286886fdd2cbad4270755fe809da730082a91bba61011f59594fac297ce05645ae32c2c73b4a9aa835f2991a1ee
DIST zfs-2.1.5-patches.tar.xz 13324 BLAKE2B bfef8abd298cebd54491272b8c1deacace901d9a1acce67cb927bab6447eafd985352fd09f64336aa9d6611bab0e5c761d7973f0a65c408d77bb735a94c60253 SHA512 d2b009664f8eb4f2a8596693011fde578b6eae123c6169e5dfb70bd920c0f987f5177f7b1be008705a421574a8a9bc930f99823785c69e81573f18b0350cb9bd
DIST zfs-2.1.5.tar.gz 34951632 BLAKE2B c6e3efd9c0cda91654767eaad0eaaa05cd9a5daf1cb0384c9c78b30062f5c29142ac37ab9dbdaf96c91456d11c317d782d3524ade293f03fda983e5992b79e49 SHA512 d9ccf1049cefa9167d25f71fbdca70092cd02368b60f09341e6489fb68dc5f89e87b026b0191f4d81181a8851449124d824a1d959d0e2fb29c8a3d624edc4f03
DIST zfs-2.1.5.tar.gz.asc 836 BLAKE2B 4a81c266967540850a2cc824e79555ca9d05b2e17e45fa2723893cbd85b55e3d7d791986d6667b7ee1530e7692c03818f15e8b6798393b54989f90801b775786 SHA512 224b0dcf4982c63a8eff0a39d054537e7d023f7c35e154e4d20490b8daf184c076bc8e4de7d2c5af4059f8a802b747e637aad4479cd8d1330cf5b26da2f19c94
diff --git a/sys-fs/zfs-kmod/files/2.1.4-ZERO_RANGE.patch b/sys-fs/zfs-kmod/files/2.1.4-ZERO_RANGE.patch
deleted file mode 100644
index 338b14208dab..000000000000
--- a/sys-fs/zfs-kmod/files/2.1.4-ZERO_RANGE.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-https://github.com/openzfs/zfs/commit/c220771a47e4206fb43e6849957657c9504b1b14
-https://github.com/openzfs/zfs/issues/13329
-
-From c220771a47e4206fb43e6849957657c9504b1b14 Mon Sep 17 00:00:00 2001
-From: Rich Ercolani <214141+rincebrain@users.noreply.github.com>
-Date: Wed, 20 Apr 2022 19:07:03 -0400
-Subject: [PATCH] Corrected oversight in ZERO_RANGE behavior
-
-It turns out, no, in fact, ZERO_RANGE and PUNCH_HOLE do
-have differing semantics in some ways - in particular,
-one requires KEEP_SIZE, and the other does not.
-
-Also added a zero-range test to catch this, corrected a flaw
-that made the punch-hole test succeed vacuously, and a typo
-in file_write.
-
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
-Closes #13329
-Closes #13338
---- a/module/os/linux/zfs/zpl_file.c
-+++ b/module/os/linux/zfs/zpl_file.c
-@@ -781,11 +781,13 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
- if (mode & (test_mode)) {
- flock64_t bf;
-
-- if (offset > olen)
-- goto out_unmark;
-+ if (mode & FALLOC_FL_KEEP_SIZE) {
-+ if (offset > olen)
-+ goto out_unmark;
-
-- if (offset + len > olen)
-- len = olen - offset;
-+ if (offset + len > olen)
-+ len = olen - offset;
-+ }
- bf.l_type = F_WRLCK;
- bf.l_whence = SEEK_SET;
- bf.l_start = offset;
---- a/tests/runfiles/linux.run
-+++ b/tests/runfiles/linux.run
-@@ -94,7 +94,7 @@ tests = ['events_001_pos', 'events_002_pos', 'zed_rc_filter', 'zed_fd_spill']
- tags = ['functional', 'events']
-
- [tests/functional/fallocate:Linux]
--tests = ['fallocate_prealloc']
-+tests = ['fallocate_prealloc', 'fallocate_zero-range']
- tags = ['functional', 'fallocate']
-
- [tests/functional/fault:Linux]
---- a/tests/zfs-tests/cmd/file_write/file_write.c
-+++ b/tests/zfs-tests/cmd/file_write/file_write.c
-@@ -251,7 +251,7 @@ usage(char *prog)
- "\t[-s offset] [-c write_count] [-d data]\n\n"
- "Where [data] equal to zero causes chars "
- "0->%d to be repeated throughout, or [data]\n"
-- "equal to 'R' for psudorandom data.\n",
-+ "equal to 'R' for pseudorandom data.\n",
- prog, DATA_RANGE);
-
- exit(1);
---- a/tests/zfs-tests/include/libtest.shlib
-+++ b/tests/zfs-tests/include/libtest.shlib
-@@ -4236,6 +4236,22 @@ function punch_hole # offset length file
- esac
- }
-
-+function zero_range # offset length file
-+{
-+ typeset offset=$1
-+ typeset length=$2
-+ typeset file=$3
-+
-+ case "$UNAME" in
-+ Linux)
-+ fallocate --zero-range --offset $offset --length $length "$file"
-+ ;;
-+ *)
-+ false
-+ ;;
-+ esac
-+}
-+
- #
- # Wait for the specified arcstat to reach non-zero quiescence.
- # If echo is 1 echo the value after reaching quiescence, otherwise
---- a/tests/zfs-tests/tests/functional/fallocate/Makefile.am
-+++ b/tests/zfs-tests/tests/functional/fallocate/Makefile.am
-@@ -3,4 +3,5 @@ dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- fallocate_prealloc.ksh \
-- fallocate_punch-hole.ksh
-+ fallocate_punch-hole.ksh \
-+ fallocate_zero-range.ksh
---- a/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh
-+++ b/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh
-@@ -60,13 +60,17 @@ function cleanup
- [[ -e $TESTDIR ]] && log_must rm -f $FILE
- }
-
--function check_disk_size
-+function check_reported_size
- {
- typeset expected_size=$1
-
-- disk_size=$(du $TESTDIR/file | awk '{print $1}')
-- if [ $disk_size -ne $expected_size ]; then
-- log_fail "Incorrect size: $disk_size != $expected_size"
-+ if ! [ -e "${FILE}" ]; then
-+ log_fail "$FILE does not exist"
-+ fi
-+
-+ reported_size=$(du "${FILE}" | awk '{print $1}')
-+ if [ "$reported_size" != "$expected_size" ]; then
-+ log_fail "Incorrect reported size: $reported_size != $expected_size"
- fi
- }
-
-@@ -74,9 +78,9 @@ function check_apparent_size
- {
- typeset expected_size=$1
-
-- apparent_size=$(stat_size)
-- if [ $apparent_size -ne $expected_size ]; then
-- log_fail "Incorrect size: $apparent_size != $expected_size"
-+ apparent_size=$(stat_size "${FILE}")
-+ if [ "$apparent_size" != "$expected_size" ]; then
-+ log_fail "Incorrect apparent size: $apparent_size != $expected_size"
- fi
- }
-
-@@ -86,25 +90,30 @@ log_onexit cleanup
-
- # Create a dense file and check it is the correct size.
- log_must file_write -o create -f $FILE -b $BLKSZ -c 8
--log_must check_disk_size $((131072 * 8))
-+sync_pool $TESTPOOL
-+log_must check_reported_size 1027
-
- # Punch a hole for the first full block.
- log_must punch_hole 0 $BLKSZ $FILE
--log_must check_disk_size $((131072 * 7))
-+sync_pool $TESTPOOL
-+log_must check_reported_size 899
-
- # Partially punch a hole in the second block.
- log_must punch_hole $BLKSZ $((BLKSZ / 2)) $FILE
--log_must check_disk_size $((131072 * 7))
-+sync_pool $TESTPOOL
-+log_must check_reported_size 899
-
--# Punch a hole which overlaps the third and forth block.
-+# Punch a hole which overlaps the third and fourth block.
- log_must punch_hole $(((BLKSZ * 2) + (BLKSZ / 2))) $((BLKSZ)) $FILE
--log_must check_disk_size $((131072 * 7))
-+sync_pool $TESTPOOL
-+log_must check_reported_size 899
-
- # Punch a hole from the fifth block past the end of file. The apparent
- # file size should not change since --keep-size is implied.
- apparent_size=$(stat_size $FILE)
- log_must punch_hole $((BLKSZ * 4)) $((BLKSZ * 10)) $FILE
--log_must check_disk_size $((131072 * 4))
-+sync_pool $TESTPOOL
-+log_must check_reported_size 387
- log_must check_apparent_size $apparent_size
-
- log_pass "Ensure holes can be punched in files making them sparse"
---- /dev/null
-+++ b/tests/zfs-tests/tests/functional/fallocate/fallocate_zero-range.ksh
-@@ -0,0 +1,119 @@
-+#!/bin/ksh -p
-+#
-+# CDDL HEADER START
-+#
-+# The contents of this file are subject to the terms of the
-+# Common Development and Distribution License (the "License").
-+# You may not use this file except in compliance with the License.
-+#
-+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+# or http://www.opensolaris.org/os/licensing.
-+# See the License for the specific language governing permissions
-+# and limitations under the License.
-+#
-+# When distributing Covered Code, include this CDDL HEADER in each
-+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+# If applicable, add the following below this CDDL HEADER, with the
-+# fields enclosed by brackets "[]" replaced with your own identifying
-+# information: Portions Copyright [yyyy] [name of copyright owner]
-+#
-+# CDDL HEADER END
-+#
-+
-+#
-+# Copyright (c) 2020 by Lawrence Livermore National Security, LLC.
-+# Copyright (c) 2021 by The FreeBSD Foundation.
-+#
-+
-+. $STF_SUITE/include/libtest.shlib
-+
-+#
-+# DESCRIPTION:
-+# Test FALLOC_FL_ZERO_RANGE functionality
-+#
-+# STRATEGY:
-+# 1. Create a dense file
-+# 2. Zero various ranges in the file and verify the result.
-+#
-+
-+verify_runnable "global"
-+
-+if is_freebsd; then
-+ log_unsupported "FreeBSD does not implement an analogue to ZERO_RANGE."
-+fi
-+
-+FILE=$TESTDIR/$TESTFILE0
-+BLKSZ=$(get_prop recordsize $TESTPOOL)
-+
-+function cleanup
-+{
-+ [[ -e $TESTDIR ]] && log_must rm -f $FILE
-+}
-+
-+# Helpfully, this function expects kilobytes, and check_apparent_size expects bytes.
-+function check_reported_size
-+{
-+ typeset expected_size=$1
-+
-+ if ! [ -e "${FILE}" ]; then
-+ log_fail "$FILE does not exist"
-+ fi
-+
-+ reported_size=$(du "${FILE}" | awk '{print $1}')
-+ if [ "$reported_size" != "$expected_size" ]; then
-+ log_fail "Incorrect reported size: $reported_size != $expected_size"
-+ fi
-+}
-+
-+function check_apparent_size
-+{
-+ typeset expected_size=$1
-+
-+ apparent_size=$(stat_size "${FILE}")
-+ if [ "$apparent_size" != "$expected_size" ]; then
-+ log_fail "Incorrect apparent size: $apparent_size != $expected_size"
-+ fi
-+}
-+
-+log_assert "Ensure ranges can be zeroed in files"
-+
-+log_onexit cleanup
-+
-+# Create a dense file and check it is the correct size.
-+log_must file_write -o create -f $FILE -b $BLKSZ -c 8
-+sync_pool $TESTPOOL
-+log_must check_reported_size 1027
-+
-+# Zero a range covering the first full block.
-+log_must zero_range 0 $BLKSZ $FILE
-+sync_pool $TESTPOOL
-+log_must check_reported_size 899
-+
-+# Partially zero a range in the second block.
-+log_must zero_range $BLKSZ $((BLKSZ / 2)) $FILE
-+sync_pool $TESTPOOL
-+log_must check_reported_size 899
-+
-+# Zero range which overlaps the third and fourth block.
-+log_must zero_range $(((BLKSZ * 2) + (BLKSZ / 2))) $((BLKSZ)) $FILE
-+sync_pool $TESTPOOL
-+log_must check_reported_size 899
-+
-+# Zero range from the fifth block past the end of file, with --keep-size.
-+# The apparent file size must not change, since we did specify --keep-size.
-+apparent_size=$(stat_size $FILE)
-+log_must fallocate --keep-size --zero-range --offset $((BLKSZ * 4)) --length $((BLKSZ * 10)) "$FILE"
-+sync_pool $TESTPOOL
-+log_must check_reported_size 387
-+log_must check_apparent_size $apparent_size
-+
-+# Zero range from the fifth block past the end of file. The apparent
-+# file size should change since --keep-size is not implied, unlike
-+# with PUNCH_HOLE.
-+apparent_size=$(stat_size $FILE)
-+log_must zero_range $((BLKSZ * 4)) $((BLKSZ * 10)) $FILE
-+sync_pool $TESTPOOL
-+log_must check_reported_size 387
-+log_must check_apparent_size $((BLKSZ * 14))
-+
-+log_pass "Ensure ranges can be zeroed in files"
---- a/tests/zfs-tests/tests/functional/fallocate/setup.ksh
-+++ b/tests/zfs-tests/tests/functional/fallocate/setup.ksh
-@@ -26,4 +26,7 @@
- . $STF_SUITE/include/libtest.shlib
-
- DISK=${DISKS%% *}
--default_setup $DISK
-+default_setup_noexit $DISK
-+log_must zfs set compression=off $TESTPOOL
-+log_pass
-+
-
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.1.4-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.4-r1.ebuild
deleted file mode 100644
index 05b9754f0ef2..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.1.4-r1.ebuild
+++ /dev/null
@@ -1,209 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-if [[ ${PV} == "9999" ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV="${PV/_rc/-rc}"
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${PV%_rc?}"
- ZFS_KERNEL_COMPAT="5.17"
-
- # increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]]; then
- KEYWORDS="amd64 arm64 ppc64 ~riscv"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-
-RDEPEND="${DEPEND}
- !sys-kernel/spl
-"
-
-BDEPEND="
- dev-lang/perl
- virtual/awk
-"
-
-# we want dist-kernel block in BDEPEND because of portage resolver.
-# since linux-mod.eclass already sets version-unbounded dep, portage
-# will pull new versions. So we set it in BDEPEND which takes priority.
-# and we don't need in in git ebuild.
-if [[ ${PV} != "9999" ]] ; then
- BDEPEND+="
- verify-sig? ( sec-keys/openpgp-keys-openzfs )
- dist-kernel? ( <virtual/dist-kernel-${ZFS_KERNEL_DEP}:= )
- "
-fi
-
-# PDEPEND in this form is needed to trick portage suggest
-# enabling dist-kernel if only 1 package have it set
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-RESTRICT="debug? ( strip ) test"
-
-DOCS=( AUTHORS COPYRIGHT META README.md )
-
-PATCHES=(
- "${FILESDIR}"/${PV}-ZERO_RANGE.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-
- if has_version virtual/dist-kernel && ! use dist-kernel; then
- ewarn "You have virtual/dist-kernel installed, but"
- ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
- ewarn "It's recommended to globally enable dist-kernel USE flag"
- ewarn "to auto-trigger initrd rebuilds with kernel updates"
- fi
-}
-
-pkg_setup() {
- CONFIG_CHECK="
- !DEBUG_LOCK_ALLOC
- EFI_PARTITION
- MODULES
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- !TRIM_UNUSED_KSYMS
- ZLIB_DEFLATE
- ZLIB_INFLATE
- "
-
- use debug && CONFIG_CHECK="${CONFIG_CHECK}
- FRAME_POINTER
- DEBUG_INFO
- !DEBUG_INFO_REDUCED
- "
-
- use rootfs && \
- CONFIG_CHECK="${CONFIG_CHECK}
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
-
- if [[ ${PV} != "9999" ]]; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
-
- fi
-
- kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
-
- linux-mod_pkg_setup
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != "9999" ]]; then
- # Set module revision number
- sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
- fi
-}
-
-src_configure() {
- set_arch_to_kernel
-
- use custom-cflags || strip-flags
-
- filter-ldflags -Wl,*
-
- # Set CROSS_COMPILE in the environment.
- # This allows the user to override it via make.conf or via a local Makefile.
- # https://bugs.gentoo.org/811600
- export CROSS_COMPILE=${CROSS_COMPILE-${CHOST}-}
-
- local myconf=(
- HOSTCC="$(tc-getBUILD_CC)"
- --bindir="${EPREFIX}/bin"
- --sbindir="${EPREFIX}/sbin"
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- set_arch_to_kernel
-
- myemakeargs=(
- HOSTCC="$(tc-getBUILD_CC)"
- V=1
- )
-
- emake "${myemakeargs[@]}"
-}
-
-src_install() {
- set_arch_to_kernel
-
- myemakeargs+=(
- DEPMOD=:
- # INSTALL_MOD_PATH ?= $(DESTDIR) in module/Makefile
- DESTDIR="${D}"
- )
-
- emake "${myemakeargs[@]}" install
-
- einstalldocs
-}
-
-pkg_postinst() {
- linux-mod_pkg_postinst
-
- if [[ -z ${ROOT} ]] && use dist-kernel; then
- set_arch_to_pkgmgr
- dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
- fi
-
- if use x86 || use arm; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a newpool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2022-10-04 5:07 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2022-10-04 5:07 UTC (permalink / raw
To: gentoo-commits
commit: e2e26044c0dce9d993e280fc3e9cc81da0f828a3
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 4 05:02:35 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 4 05:06:48 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2e26044
sys-fs/zfs-kmod: add 2.1.6
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 2 +
sys-fs/zfs-kmod/files/zfs-kmod-2.1.6-fgrep.patch | 53 ++++++++++++++++++++++
...{zfs-kmod-9999.ebuild => zfs-kmod-2.1.6.ebuild} | 15 +++++-
sys-fs/zfs-kmod/zfs-kmod-9999.ebuild | 2 +-
4 files changed, 70 insertions(+), 2 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index 9e6e521d9fef..894b7751ea9b 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,3 +1,5 @@
DIST zfs-2.1.5-patches.tar.xz 13324 BLAKE2B bfef8abd298cebd54491272b8c1deacace901d9a1acce67cb927bab6447eafd985352fd09f64336aa9d6611bab0e5c761d7973f0a65c408d77bb735a94c60253 SHA512 d2b009664f8eb4f2a8596693011fde578b6eae123c6169e5dfb70bd920c0f987f5177f7b1be008705a421574a8a9bc930f99823785c69e81573f18b0350cb9bd
DIST zfs-2.1.5.tar.gz 34951632 BLAKE2B c6e3efd9c0cda91654767eaad0eaaa05cd9a5daf1cb0384c9c78b30062f5c29142ac37ab9dbdaf96c91456d11c317d782d3524ade293f03fda983e5992b79e49 SHA512 d9ccf1049cefa9167d25f71fbdca70092cd02368b60f09341e6489fb68dc5f89e87b026b0191f4d81181a8851449124d824a1d959d0e2fb29c8a3d624edc4f03
DIST zfs-2.1.5.tar.gz.asc 836 BLAKE2B 4a81c266967540850a2cc824e79555ca9d05b2e17e45fa2723893cbd85b55e3d7d791986d6667b7ee1530e7692c03818f15e8b6798393b54989f90801b775786 SHA512 224b0dcf4982c63a8eff0a39d054537e7d023f7c35e154e4d20490b8daf184c076bc8e4de7d2c5af4059f8a802b747e637aad4479cd8d1330cf5b26da2f19c94
+DIST zfs-2.1.6.tar.gz 34951282 BLAKE2B 615fe7a2128af77c6c855ea52b6503a78f0c992ea845b02875ac19aa9dd155c5d4110b668da91c463f96a54767ab92e67e5303572337352484c055c0a0ff9e46 SHA512 75639e4cecb281fe73a6e6bd116693f6609ace9b358385450297d175087b10938c2f489a08c657cf0a64250a8db995cbd19abc808a8523cb4c5344b3f76668d6
+DIST zfs-2.1.6.tar.gz.asc 836 BLAKE2B d85a79f8824a92c4d0a9682646f79c14871ebe27764289dc87cd9b0a773b7295538780401e70c492a9e4e7097ff2b3e459f7e0a7fdce2e2a59d3f467c41d88b3 SHA512 a83fcc00a8b35f1a1f9b94097d453019333a5351a3d78656dbd9ef732655ee817ccc88068c5ba11b5ff4a285e02250aee4169cc1450025edf547a2329fca7e15
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.1.6-fgrep.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.1.6-fgrep.patch
new file mode 100644
index 000000000000..2e47c5bcc093
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-kmod-2.1.6-fgrep.patch
@@ -0,0 +1,53 @@
+https://github.com/openzfs/zfs/commit/d30577c9dd811688f2609ad532b011b99bceb485
+
+From d30577c9dd811688f2609ad532b011b99bceb485 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczleweli@nabijaczleweli.xyz>
+Date: Sat, 12 Mar 2022 00:26:46 +0100
+Subject: [PATCH] fgrep -> grep -F
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Reviewed-by: John Kennedy <john.kennedy@delphix.com>
+Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
+Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
+Closes #13259
+--- a/config/kernel.m4
++++ b/config/kernel.m4
+@@ -394,11 +394,11 @@ AC_DEFUN([ZFS_AC_KERNEL], [
+ utsrelease1=$kernelbuild/include/linux/version.h
+ utsrelease2=$kernelbuild/include/linux/utsrelease.h
+ utsrelease3=$kernelbuild/include/generated/utsrelease.h
+- AS_IF([test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1], [
++ AS_IF([test -r $utsrelease1 && grep -qF UTS_RELEASE $utsrelease1], [
+ utsrelease=$utsrelease1
+- ], [test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2], [
++ ], [test -r $utsrelease2 && grep -qF UTS_RELEASE $utsrelease2], [
+ utsrelease=$utsrelease2
+- ], [test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3], [
++ ], [test -r $utsrelease3 && grep -qF UTS_RELEASE $utsrelease3], [
+ utsrelease=$utsrelease3
+ ])
+
+--- a/config/zfs-build.m4
++++ b/config/zfs-build.m4
+@@ -173,7 +173,7 @@ AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [
+ ])
+
+ AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], [
+- AS_IF([sysctl -n kern.conftxt | fgrep -qx $'options\tINVARIANTS'],
++ AS_IF([sysctl -n kern.conftxt | grep -Fqx $'options\tINVARIANTS'],
+ [enable_invariants="yes"],
+ [enable_invariants="no"])
+ ])
+--- a/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait.kshlib
++++ b/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait.kshlib
+@@ -120,5 +120,5 @@ function check_while_waiting
+ # Whether any vdev in the given pool is initializing
+ function is_vdev_initializing # pool
+ {
+- zpool status -i "$1" | grep 'initialized, started' >/dev/null
++ zpool status -i "$1" | grep -q 'initialized, started'
+ }
+
diff --git a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.6.ebuild
similarity index 95%
copy from sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
copy to sys-fs/zfs-kmod/zfs-kmod-2.1.6.ebuild
index c7623deb64c8..321ab809d1e2 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.1.6.ebuild
@@ -19,7 +19,7 @@ else
SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
S="${WORKDIR}/zfs-${PV%_rc?}"
- ZFS_KERNEL_COMPAT="5.18"
+ ZFS_KERNEL_COMPAT="5.19"
# increments minor eg 5.14 -> 5.15, and still supports override.
ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
@@ -60,6 +60,10 @@ RESTRICT="debug? ( strip ) test"
DOCS=( AUTHORS COPYRIGHT META README.md )
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.1.6-fgrep.patch
+)
+
pkg_pretend() {
use rootfs || return 0
@@ -112,6 +116,15 @@ pkg_setup() {
linux-mod_pkg_setup
}
+src_unpack() {
+ if use verify-sig ; then
+ # Needed for downloaded patch (which is unsigned, which is fine)
+ verify-sig_verify_detached "${DISTDIR}"/zfs-${MY_PV}.tar.gz{,.asc}
+ fi
+
+ default
+}
+
src_prepare() {
default
diff --git a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
index c7623deb64c8..e0888f5b3a45 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
@@ -19,7 +19,7 @@ else
SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
S="${WORKDIR}/zfs-${PV%_rc?}"
- ZFS_KERNEL_COMPAT="5.18"
+ ZFS_KERNEL_COMPAT="5.19"
# increments minor eg 5.14 -> 5.15, and still supports override.
ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2023-05-30 2:51 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2023-05-30 2:51 UTC (permalink / raw
To: gentoo-commits
commit: 7b66ebce8f979c5dfc190070c22745b7aa375cc3
Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed May 24 00:03:08 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 30 02:50:53 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b66ebce
sys-fs/zfs-kmod: migrate to linux-mod-r1
(sam: Taking ionen's PoC conversion and committing it after testing.)
Closes: https://bugs.gentoo.org/814194
Closes: https://bugs.gentoo.org/865157
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-fs/zfs-kmod/files/zfs-kmod-2.1.11-gentoo.patch | 24 +++
sys-fs/zfs-kmod/zfs-kmod-2.1.11-r1.ebuild | 197 +++++++++++++++++++++
2 files changed, 221 insertions(+)
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.1.11-gentoo.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.1.11-gentoo.patch
new file mode 100644
index 000000000000..53c5f27b3bed
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-kmod-2.1.11-gentoo.patch
@@ -0,0 +1,24 @@
+Hack to pass the full linux-mod-r1 toolchain to make during ./configure.
+Not needed at build time given can pass it normally then.
+
+Eclass has workarounds, compiler/version matching, and its own set of
+user variables which creates disparity between ebuilds if not used.
+
+For the (normal) alternative: KERNEL_{CC,LD} alone is insufficient,
+but combining with KERNEL_LLVM=1 when CC_IS_CLANG will allow it
+to work for *most* people (will likely still need KERNEL_LD from
+linux-mod-r1, or ThinLTO kernels may fail with sandbox violations).
+
+Note KERNEL_* also cause failure if they contain spaces.
+
+https://bugs.gentoo.org/865157
+--- a/config/kernel.m4
++++ b/config/kernel.m4
+@@ -646,6 +646,5 @@
+ AC_TRY_COMMAND([
+ KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6"
+- make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC}
+- ${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM}
++ make modules -k -j$TEST_JOBS '${GENTOO_MAKEARGS_EVAL}'
+ CONFIG_MODULES=y CFLAGS_MODULE=-DCONFIG_MODULES
+ -C $LINUX_OBJ $ARCH_UM M=$PWD/$1 >$1/build.log 2>&1])
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.1.11-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.11-r1.ebuild
new file mode 100644
index 000000000000..146556170e08
--- /dev/null
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.1.11-r1.ebuild
@@ -0,0 +1,197 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools dist-kernel-utils flag-o-matic linux-mod-r1 multiprocessing
+
+DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
+HOMEPAGE="https://github.com/openzfs/zfs"
+
+if [[ ${PV} == "9999" ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
+ inherit verify-sig
+
+ MY_PV="${PV/_rc/-rc}"
+ SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
+ SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
+ S="${WORKDIR}/zfs-${PV%_rc?}"
+ ZFS_KERNEL_COMPAT="6.2"
+
+ # increments minor eg 5.14 -> 5.15, and still supports override.
+ ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
+
+ if [[ ${PV} != *_rc* ]]; then
+ KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc"
+ fi
+fi
+
+LICENSE="CDDL MIT debug? ( GPL-2+ )"
+SLOT="0/${PVR}"
+IUSE="custom-cflags debug +rootfs"
+
+RDEPEND="${DEPEND}"
+
+BDEPEND="
+ dev-lang/perl
+ app-alternatives/awk
+"
+
+# we want dist-kernel block in BDEPEND because of portage resolver.
+# since linux-mod.eclass already sets version-unbounded dep, portage
+# will pull new versions. So we set it in BDEPEND which takes priority.
+# and we don't need in in git ebuild.
+if [[ ${PV} != "9999" ]] ; then
+ BDEPEND+="
+ verify-sig? ( sec-keys/openpgp-keys-openzfs )
+ dist-kernel? ( <virtual/dist-kernel-${ZFS_KERNEL_DEP}:= )
+ "
+fi
+
+# PDEPEND in this form is needed to trick portage suggest
+# enabling dist-kernel if only 1 package have it set
+PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
+
+RESTRICT="debug? ( strip ) test"
+
+DOCS=( AUTHORS COPYRIGHT META README.md )
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+)
+
+pkg_pretend() {
+ use rootfs || return 0
+
+ if has_version virtual/dist-kernel && ! use dist-kernel; then
+ ewarn "You have virtual/dist-kernel installed, but"
+ ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
+ ewarn "It's recommended to globally enable dist-kernel USE flag"
+ ewarn "to auto-trigger initrd rebuilds with kernel updates"
+ fi
+}
+
+pkg_setup() {
+ CONFIG_CHECK="
+ !DEBUG_LOCK_ALLOC
+ EFI_PARTITION
+ MODULES
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ !TRIM_UNUSED_KSYMS
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ "
+
+ use debug && CONFIG_CHECK="${CONFIG_CHECK}
+ FRAME_POINTER
+ DEBUG_INFO
+ !DEBUG_INFO_REDUCED
+ "
+
+ use rootfs && \
+ CONFIG_CHECK="${CONFIG_CHECK}
+ BLK_DEV_INITRD
+ DEVTMPFS
+ "
+
+ kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
+
+ if [[ ${PV} != "9999" ]]; then
+ local kv_major_max kv_minor_max zcompat
+ zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ kv_major_max="${zcompat%%.*}"
+ zcompat="${zcompat#*.}"
+ kv_minor_max="${zcompat%%.*}"
+ kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
+ "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
+
+ fi
+
+ kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
+
+ linux-mod-r1_pkg_setup
+}
+
+src_unpack() {
+ if use verify-sig ; then
+ # Needed for downloaded patch (which is unsigned, which is fine)
+ verify-sig_verify_detached "${DISTDIR}"/zfs-${MY_PV}.tar.gz{,.asc}
+ fi
+
+ default
+}
+
+src_prepare() {
+ default
+
+ # Run unconditionally (bug #792627)
+ eautoreconf
+
+ if [[ ${PV} != "9999" ]]; then
+ # Set module revision number
+ sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
+ fi
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+
+ filter-ldflags -Wl,*
+
+ local myconf=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=kernel
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+
+ # See gentoo.patch
+ GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
+ TEST_JOBS="$(makeopts_jobs)"
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ emake "${MODULES_MAKEARGS[@]}"
+}
+
+src_install() {
+ emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
+ modules_post_process
+
+ einstalldocs
+}
+
+pkg_postinst() {
+ linux-mod-r1_pkg_postinst
+
+ if [[ -z ${ROOT} ]] && use dist-kernel; then
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ fi
+
+ if use x86 || use arm; then
+ ewarn "32-bit kernels will likely require increasing vmalloc to"
+ ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
+ fi
+
+ if has_version sys-boot/grub; then
+ ewarn "This version of OpenZFS includes support for new feature flags"
+ ewarn "that are incompatible with previous versions. GRUB2 support for"
+ ewarn "/boot with the new feature flags is not yet available."
+ ewarn "Do *NOT* upgrade root pools to use the new feature flags."
+ ewarn "Any new pools will be created with the new feature flags by default"
+ ewarn "and will not be compatible with older versions of OpenZFS. To"
+ ewarn "create a new pool that is backward compatible wih GRUB2, use "
+ ewarn
+ ewarn "zpool create -o compatibility=grub2 ..."
+ ewarn
+ ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
+ fi
+}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2023-07-03 21:03 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2023-07-03 21:03 UTC (permalink / raw
To: gentoo-commits
commit: fc34e770d935ffee16256ea1d8b616dbd20bd1c6
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 3 21:01:36 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 3 21:01:36 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc34e770
sys-fs/zfs-kmod: drop 2.1.7, 2.1.10-r1
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 4 -
...IOC_COUNT_FILLED-does-unnecessary-txg_wai.patch | 67 -------
.../files/2.1.7-ppc64-ieee128-compat.patch | 217 --------------------
sys-fs/zfs-kmod/zfs-kmod-2.1.10-r1.ebuild | 217 --------------------
sys-fs/zfs-kmod/zfs-kmod-2.1.7.ebuild | 219 ---------------------
5 files changed, 724 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index c2835e7dc8d2..591c3082e3c1 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,11 +1,7 @@
-DIST zfs-2.1.10.tar.gz 35101856 BLAKE2B 5b1a17d192097f5eab1ef3192217fa34b276b6f344a5114a5411be43208616ac682ae2129ae9da15b4ba6207171ae82140f823041a8067441459d51d994df271 SHA512 3189c6f822c7b6caba650a43f321114ef0bd42b72f566c44ba2400005c61cc3d420149a72520aed5b94494c51c35629a6f645273941774d964f2b61c31c366b2
-DIST zfs-2.1.10.tar.gz.asc 836 BLAKE2B 5a6b408932cb4f39f5a226598527115aa4fa6c105c8b8ad9f236a5909a948150db712bb1f35e4e16a2b7fc7e434530f93c6a6cd2aab40d628b1ded9891694578 SHA512 a45bcce13e7261f90feda51a131fa0c86e2d3c2711286a462072fb120ccbc85719c2bbecb441147a057accffb841ca82df0ba65e1abc0ece9dea8a97cfa31af5
DIST zfs-2.1.11.tar.gz 35100716 BLAKE2B 991ac2347bcd452812e247358e2c44a04a88e700d25878b5b95f86939e6114e1205e7afabfd2a1ea9220947876511374d7224aa587d3d66184838d705f71a89a SHA512 335a543644d2dbba919213a28cc5922bf6a118fc19069db84562ce056449a2d6ca4ba827e54f304ab7d9be22260aa9b255134f1b12e2bc98890f757f35e48bd7
DIST zfs-2.1.11.tar.gz.asc 836 BLAKE2B 0b904d8e1de2dd08a377efc94e32862192d6b9ccb8628af058a71b3ea51f5e483e0cf527906cd222fe9b41b28ca0b30b0efa07d97c480e5546f6e2bed8cbcb01 SHA512 7329e62012ba64288345d8959611de82502ef1da4020e215462fbb2ed209413ec8638d211a31dd6e70be71c998f1da1d8a0d19e5df1f2778782ebb988c94aa41
DIST zfs-2.1.12.tar.gz 35155013 BLAKE2B 652780e6bf7b63f45909110726d53795fada034f6044c8393fa3980e30217ada6931e3c2bb57210719e3c78c16f973f69287b7e2b475601f4ce12d701d9d96ae SHA512 f48493a21883e441cda705fb085353bed033f1620a1d0f93069c345c76cf2c0759a2e6f7a80c47c9398e9878abfe1d90d931fe5ceaf2588770a71491a434631e
DIST zfs-2.1.12.tar.gz.asc 836 BLAKE2B 9215e732981a82254115cd17ec3c9810d4e9e5d5f7bb848778848f911478fc2e4bdbfc563e9835a2e876c26d9e0e8755724a0995baf9ad24e9265123e10cfddf SHA512 69c8b618947fd966eba0bba1c7326ddd463861f051a6cf1d06e23bd6d840fe7503f02adec2c3cbb203fa7b1cced51500f3689c224b653d13d227edd51b5a44f6
-DIST zfs-2.1.7.tar.gz 35092436 BLAKE2B 9c85c3eb72f3bb39bc4fd44aaa80338ca197a4e8183436fee73cd56705abfdaecfaf1b6fbe8dd508ccce707c8259c7ab6e1733b60b17757f0a7ff92d4e52bbad SHA512 6a31eb8fbee90ad1abcfedb9000991761aff7591b11362eb5ec6e0bb4b785a7004a251439409d7bd3f51fc995c859614da6313655337952f70bae07ac8ee0140
-DIST zfs-2.1.7.tar.gz.asc 836 BLAKE2B 648fb818860a1cecc2ec42f23102e0466c038bfe48f5feca1ab58afb9cb439a0fe51cb89941f63a05c14d3b6f95c64dd3910c9a06b9cac14c467b963c65c2948 SHA512 4d4fef707bdfc37a82eb79aa0a21c71e30779bcf2ac54fe2df45a03e3302e2a45cb9f4e4ff0122b892b1e608a9f09e86d1334e0c7d9bf681780505f6e1439f9f
DIST zfs-2.1.9.tar.gz 35106538 BLAKE2B d7553cc162687531b254089e29e2e15e2eb6b362cecd8e70c24bbb5dbffbde82036ad2d416f4caeceaa324bee8a2e59d9e3cd8a3bf55a2e3c0718c7af9562812 SHA512 a3c410abe911be7d3d66af8ad7023a810eb4ae3284001e544c3a34275eb17a4916a7c094936a2628a590007c007eea84673efa9f3201fd9f24c499fd5ed3ed75
DIST zfs-2.1.9.tar.gz.asc 836 BLAKE2B 1e76525eab338398dd6ff7539ea4e7d18847d0f40e9093d813ec93fce5fa4c16e09f91c0805ba01a29190f673d131f85442c13035166d6f2d007a7e42dc15486 SHA512 35e1213fcac0458e1243355beba021dfefef455df2b341fbc4b10047f9ed4747df84e319d10ffe4bbcd572fbf014019e0dec200eb4e7d3c116fb805369182cb0
DIST zfs-2.2.0-rc1.tar.gz 33656024 BLAKE2B 1157db51d2736905b787a2627e599d7ac527be281edc9a76da0f746ae39483df3b4b8b31e5af504b9b06cd99a3776cd16670a8774d0e68f50014b09971209437 SHA512 22285ea1b34d4dbed311e3855449cad51c6f6ddb29c906f106fa6f4816d8e478f073b29fbc4d9636bf783558e041b20d2f2c5c0c33f65153d3b21da6cd9b7689
diff --git a/sys-fs/zfs-kmod/files/2.1.10-Revert-ZFS_IOC_COUNT_FILLED-does-unnecessary-txg_wai.patch b/sys-fs/zfs-kmod/files/2.1.10-Revert-ZFS_IOC_COUNT_FILLED-does-unnecessary-txg_wai.patch
deleted file mode 100644
index 150d1b5145d9..000000000000
--- a/sys-fs/zfs-kmod/files/2.1.10-Revert-ZFS_IOC_COUNT_FILLED-does-unnecessary-txg_wai.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From ac6b8f40981cb9328c22a3485e1a4b060ea89b1e Mon Sep 17 00:00:00 2001
-From: Sam James <sam@gentoo.org>
-Date: Sun, 16 Apr 2023 04:49:04 +0100
-Subject: [PATCH] Revert "ZFS_IOC_COUNT_FILLED does unnecessary
- txg_wait_synced()"
-
-This reverts commit 4b3133e671b958fa2c915a4faf57812820124a7b.
-
-See #14753 - possible corruption again, very similar symptoms to the
-nightmare that was #11900 and same area of code.
-
-We can safely revert it as it's an optimisation rather than a bugfix
-in itself.
-
-Bug: https://github.com/openzfs/zfs/issues/14753
-Bug: https://github.com/openzfs/zfs/issues/11900
-Signed-off-by: Sam James <sam@gentoo.org>
---- a/module/zfs/dnode.c
-+++ b/module/zfs/dnode.c
-@@ -1773,29 +1773,20 @@ dnode_try_claim(objset_t *os, uint64_t object, int slots)
- }
-
- /*
-- * Checks if the dnode might contain any uncommitted changes to data blocks.
-- * Dirty metadata (e.g. bonus buffer) does not count.
-+ * Checks if the dnode contains any uncommitted dirty records.
- */
- boolean_t
- dnode_is_dirty(dnode_t *dn)
- {
- mutex_enter(&dn->dn_mtx);
-+
- for (int i = 0; i < TXG_SIZE; i++) {
-- list_t *list = &dn->dn_dirty_records[i];
-- for (dbuf_dirty_record_t *dr = list_head(list);
-- dr != NULL; dr = list_next(list, dr)) {
-- if (dr->dr_dbuf == NULL ||
-- (dr->dr_dbuf->db_blkid != DMU_BONUS_BLKID &&
-- dr->dr_dbuf->db_blkid != DMU_SPILL_BLKID)) {
-- mutex_exit(&dn->dn_mtx);
-- return (B_TRUE);
-- }
-- }
-- if (dn->dn_free_ranges[i] != NULL) {
-+ if (multilist_link_active(&dn->dn_dirty_link[i])) {
- mutex_exit(&dn->dn_mtx);
- return (B_TRUE);
- }
- }
-+
- mutex_exit(&dn->dn_mtx);
-
- return (B_FALSE);
-@@ -2667,9 +2658,7 @@ dnode_next_offset(dnode_t *dn, int flags, uint64_t *offset,
- rw_enter(&dn->dn_struct_rwlock, RW_READER);
-
- if (dn->dn_phys->dn_nlevels == 0) {
-- if (!(flags & DNODE_FIND_HOLE)) {
-- error = SET_ERROR(ESRCH);
-- }
-+ error = SET_ERROR(ESRCH);
- goto out;
- }
-
---
-2.40.0
-
diff --git a/sys-fs/zfs-kmod/files/2.1.7-ppc64-ieee128-compat.patch b/sys-fs/zfs-kmod/files/2.1.7-ppc64-ieee128-compat.patch
deleted file mode 100644
index 5613cb8ca9d1..000000000000
--- a/sys-fs/zfs-kmod/files/2.1.7-ppc64-ieee128-compat.patch
+++ /dev/null
@@ -1,217 +0,0 @@
-From 8324d738fdb3096bd97336476bb399e6c312289a Mon Sep 17 00:00:00 2001
-From: Richard Yao <richard.yao@alumni.stonybrook.edu>
-Date: Thu, 12 Jan 2023 11:06:57 -0500
-Subject: [PATCH] Linux ppc64le ieee128 compat: Do not redefine __asm on
- external headers
-
-There is an external assembly declaration extension in GNU C that glibc
-uses when building with ieee128 floating point support on ppc64le.
-Marking that as volatile makes no sense, so the build breaks.
-
-It does not make sense to only mark this as volatile on Linux, since if
-do not want the compiler reordering things on Linux, we do not want the
-compiler reordering things on any other platform, so we stop treating
-Linux specially and just manually inline the CPP macro so that we can
-eliminate it. This should fix the build on ppc64le.
-
-Closes openzfs/zfs#14308
-Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
----
- .../vdev_raidz_math_powerpc_altivec_common.h | 44 +++++++++----------
- 1 file changed, 20 insertions(+), 24 deletions(-)
-
-diff --git a/module/zfs/vdev_raidz_math_powerpc_altivec_common.h b/module/zfs/vdev_raidz_math_powerpc_altivec_common.h
-index 46d42c5e241..f76eb47a9c6 100644
---- a/module/zfs/vdev_raidz_math_powerpc_altivec_common.h
-+++ b/module/zfs/vdev_raidz_math_powerpc_altivec_common.h
-@@ -26,10 +26,6 @@
- #include <sys/types.h>
- #include <sys/simd.h>
-
--#ifdef __linux__
--#define __asm __asm__ __volatile__
--#endif
--
- #define _REG_CNT(_0, _1, _2, _3, _4, _5, _6, _7, N, ...) N
- #define REG_CNT(r...) _REG_CNT(r, 8, 7, 6, 5, 4, 3, 2, 1)
-
-@@ -142,7 +138,7 @@ typedef struct v {
- { \
- switch (REG_CNT(r)) { \
- case 8: \
-- __asm( \
-+ __asm__ __volatile__( \
- "lvx 21,0,%[SRC0]\n" \
- "lvx 20,0,%[SRC1]\n" \
- "lvx 19,0,%[SRC2]\n" \
-@@ -172,7 +168,7 @@ typedef struct v {
- : "v18", "v19", "v20", "v21"); \
- break; \
- case 4: \
-- __asm( \
-+ __asm__ __volatile__( \
- "lvx 21,0,%[SRC0]\n" \
- "lvx 20,0,%[SRC1]\n" \
- "lvx 19,0,%[SRC2]\n" \
-@@ -189,7 +185,7 @@ typedef struct v {
- : "v18", "v19", "v20", "v21"); \
- break; \
- case 2: \
-- __asm( \
-+ __asm__ __volatile__( \
- "lvx 21,0,%[SRC0]\n" \
- "lvx 20,0,%[SRC1]\n" \
- "vxor " VR0(r) "," VR0(r) ",21\n" \
-@@ -208,7 +204,7 @@ typedef struct v {
- { \
- switch (REG_CNT(r)) { \
- case 8: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vxor " VR4(r) "," VR4(r) "," VR0(r) "\n" \
- "vxor " VR5(r) "," VR5(r) "," VR1(r) "\n" \
- "vxor " VR6(r) "," VR6(r) "," VR2(r) "\n" \
-@@ -217,7 +213,7 @@ typedef struct v {
- : RVR0(r), RVR1(r), RVR2(r), RVR3(r)); \
- break; \
- case 4: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vxor " VR2(r) "," VR2(r) "," VR0(r) "\n" \
- "vxor " VR3(r) "," VR3(r) "," VR1(r) "\n" \
- : UVR2(r), UVR3(r) \
-@@ -232,7 +228,7 @@ typedef struct v {
- { \
- switch (REG_CNT(r)) { \
- case 8: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vxor " VR0(r) "," VR0(r) "," VR0(r) "\n" \
- "vxor " VR1(r) "," VR1(r) "," VR1(r) "\n" \
- "vxor " VR2(r) "," VR2(r) "," VR2(r) "\n" \
-@@ -245,7 +241,7 @@ typedef struct v {
- WVR4(r), WVR5(r), WVR6(r), WVR7(r)); \
- break; \
- case 4: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vxor " VR0(r) "," VR0(r) "," VR0(r) "\n" \
- "vxor " VR1(r) "," VR1(r) "," VR1(r) "\n" \
- "vxor " VR2(r) "," VR2(r) "," VR2(r) "\n" \
-@@ -253,7 +249,7 @@ typedef struct v {
- : WVR0(r), WVR1(r), WVR2(r), WVR3(r)); \
- break; \
- case 2: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vxor " VR0(r) "," VR0(r) "," VR0(r) "\n" \
- "vxor " VR1(r) "," VR1(r) "," VR1(r) "\n" \
- : WVR0(r), WVR1(r)); \
-@@ -267,7 +263,7 @@ typedef struct v {
- { \
- switch (REG_CNT(r)) { \
- case 8: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vor " VR4(r) "," VR0(r) "," VR0(r) "\n" \
- "vor " VR5(r) "," VR1(r) "," VR1(r) "\n" \
- "vor " VR6(r) "," VR2(r) "," VR2(r) "\n" \
-@@ -276,7 +272,7 @@ typedef struct v {
- : RVR0(r), RVR1(r), RVR2(r), RVR3(r)); \
- break; \
- case 4: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vor " VR2(r) "," VR0(r) "," VR0(r) "\n" \
- "vor " VR3(r) "," VR1(r) "," VR1(r) "\n" \
- : WVR2(r), WVR3(r) \
-@@ -291,7 +287,7 @@ typedef struct v {
- { \
- switch (REG_CNT(r)) { \
- case 8: \
-- __asm( \
-+ __asm__ __volatile__( \
- "lvx " VR0(r) " ,0,%[SRC0]\n" \
- "lvx " VR1(r) " ,0,%[SRC1]\n" \
- "lvx " VR2(r) " ,0,%[SRC2]\n" \
-@@ -312,7 +308,7 @@ typedef struct v {
- [SRC7] "r" ((OFFSET(src, 112)))); \
- break; \
- case 4: \
-- __asm( \
-+ __asm__ __volatile__( \
- "lvx " VR0(r) " ,0,%[SRC0]\n" \
- "lvx " VR1(r) " ,0,%[SRC1]\n" \
- "lvx " VR2(r) " ,0,%[SRC2]\n" \
-@@ -324,7 +320,7 @@ typedef struct v {
- [SRC3] "r" ((OFFSET(src, 48)))); \
- break; \
- case 2: \
-- __asm( \
-+ __asm__ __volatile__( \
- "lvx " VR0(r) " ,0,%[SRC0]\n" \
- "lvx " VR1(r) " ,0,%[SRC1]\n" \
- : WVR0(r), WVR1(r) \
-@@ -340,7 +336,7 @@ typedef struct v {
- { \
- switch (REG_CNT(r)) { \
- case 8: \
-- __asm( \
-+ __asm__ __volatile__( \
- "stvx " VR0(r) " ,0,%[DST0]\n" \
- "stvx " VR1(r) " ,0,%[DST1]\n" \
- "stvx " VR2(r) " ,0,%[DST2]\n" \
-@@ -362,7 +358,7 @@ typedef struct v {
- : "memory"); \
- break; \
- case 4: \
-- __asm( \
-+ __asm__ __volatile__( \
- "stvx " VR0(r) " ,0,%[DST0]\n" \
- "stvx " VR1(r) " ,0,%[DST1]\n" \
- "stvx " VR2(r) " ,0,%[DST2]\n" \
-@@ -375,7 +371,7 @@ typedef struct v {
- : "memory"); \
- break; \
- case 2: \
-- __asm( \
-+ __asm__ __volatile__( \
- "stvx " VR0(r) " ,0,%[DST0]\n" \
- "stvx " VR1(r) " ,0,%[DST1]\n" \
- : : [DST0] "r" ((OFFSET(dst, 0))), \
-@@ -400,7 +396,7 @@ typedef struct v {
-
- #define MUL2_SETUP() \
- { \
-- __asm( \
-+ __asm__ __volatile__( \
- "vspltisb " VR(16) ",14\n" \
- "vspltisb " VR(17) ",15\n" \
- "vaddubm " VR(16) "," VR(17) "," VR(16) "\n" \
-@@ -412,7 +408,7 @@ typedef struct v {
- { \
- switch (REG_CNT(r)) { \
- case 4: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vcmpgtsb 19," VR(17) "," VR0(r) "\n" \
- "vcmpgtsb 18," VR(17) "," VR1(r) "\n" \
- "vcmpgtsb 21," VR(17) "," VR2(r) "\n" \
-@@ -434,7 +430,7 @@ typedef struct v {
- : "v18", "v19", "v20", "v21"); \
- break; \
- case 2: \
-- __asm( \
-+ __asm__ __volatile__( \
- "vcmpgtsb 19," VR(17) "," VR0(r) "\n" \
- "vcmpgtsb 18," VR(17) "," VR1(r) "\n" \
- "vand 19,19," VR(16) "\n" \
-@@ -478,7 +474,7 @@ typedef struct v {
- { \
- switch (REG_CNT(r)) { \
- case 2: \
-- __asm( \
-+ __asm__ __volatile__( \
- /* lts for upper part */ \
- "vspltisb 15,15\n" \
- "lvx 10,0,%[lt0]\n" \
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.1.10-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.10-r1.ebuild
deleted file mode 100644
index bd0070f85ad1..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.1.10-r1.ebuild
+++ /dev/null
@@ -1,217 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-if [[ ${PV} == "9999" ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV="${PV/_rc/-rc}"
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${PV%_rc?}"
- ZFS_KERNEL_COMPAT="6.2"
-
- # increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]]; then
- KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-
-RDEPEND="${DEPEND}"
-
-BDEPEND="
- dev-lang/perl
- app-alternatives/awk
-"
-
-# we want dist-kernel block in BDEPEND because of portage resolver.
-# since linux-mod.eclass already sets version-unbounded dep, portage
-# will pull new versions. So we set it in BDEPEND which takes priority.
-# and we don't need in in git ebuild.
-if [[ ${PV} != "9999" ]] ; then
- BDEPEND+="
- verify-sig? ( sec-keys/openpgp-keys-openzfs )
- dist-kernel? ( <virtual/dist-kernel-${ZFS_KERNEL_DEP}:= )
- "
-fi
-
-# PDEPEND in this form is needed to trick portage suggest
-# enabling dist-kernel if only 1 package have it set
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-RESTRICT="debug? ( strip ) test"
-
-DOCS=( AUTHORS COPYRIGHT META README.md )
-
-PATCHES=(
- # https://github.com/openzfs/zfs/issues/14753
- "${FILESDIR}"/2.1.10-Revert-ZFS_IOC_COUNT_FILLED-does-unnecessary-txg_wai.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-
- if has_version virtual/dist-kernel && ! use dist-kernel; then
- ewarn "You have virtual/dist-kernel installed, but"
- ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
- ewarn "It's recommended to globally enable dist-kernel USE flag"
- ewarn "to auto-trigger initrd rebuilds with kernel updates"
- fi
-}
-
-pkg_setup() {
- CONFIG_CHECK="
- !DEBUG_LOCK_ALLOC
- EFI_PARTITION
- MODULES
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- !TRIM_UNUSED_KSYMS
- ZLIB_DEFLATE
- ZLIB_INFLATE
- "
-
- use debug && CONFIG_CHECK="${CONFIG_CHECK}
- FRAME_POINTER
- DEBUG_INFO
- !DEBUG_INFO_REDUCED
- "
-
- use rootfs && \
- CONFIG_CHECK="${CONFIG_CHECK}
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
-
- if [[ ${PV} != "9999" ]]; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
-
- fi
-
- kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
-
- linux-mod_pkg_setup
-}
-
-src_unpack() {
- if use verify-sig ; then
- # Needed for downloaded patch (which is unsigned, which is fine)
- verify-sig_verify_detached "${DISTDIR}"/zfs-${MY_PV}.tar.gz{,.asc}
- fi
-
- default
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != "9999" ]]; then
- # Set module revision number
- sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
- fi
-}
-
-src_configure() {
- set_arch_to_kernel
-
- use custom-cflags || strip-flags
-
- filter-ldflags -Wl,*
-
- # Set CROSS_COMPILE in the environment.
- # This allows the user to override it via make.conf or via a local Makefile.
- # https://bugs.gentoo.org/811600
- export CROSS_COMPILE=${CROSS_COMPILE-${CHOST}-}
-
- local myconf=(
- HOSTCC="$(tc-getBUILD_CC)"
- --bindir="${EPREFIX}/bin"
- --sbindir="${EPREFIX}/sbin"
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- set_arch_to_kernel
-
- myemakeargs=(
- HOSTCC="$(tc-getBUILD_CC)"
- V=1
- )
-
- emake "${myemakeargs[@]}"
-}
-
-src_install() {
- set_arch_to_kernel
-
- myemakeargs+=(
- DEPMOD=:
- # INSTALL_MOD_PATH ?= $(DESTDIR) in module/Makefile
- DESTDIR="${D}"
- )
-
- emake "${myemakeargs[@]}" install
-
- einstalldocs
-}
-
-pkg_postinst() {
- linux-mod_pkg_postinst
-
- if [[ -z ${ROOT} ]] && use dist-kernel; then
- set_arch_to_pkgmgr
- dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
- fi
-
- if use x86 || use arm; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a new pool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.1.7.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.7.ebuild
deleted file mode 100644
index 3f2082380eaf..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.1.7.ebuild
+++ /dev/null
@@ -1,219 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-if [[ ${PV} == "9999" ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV="${PV/_rc/-rc}"
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${PV%_rc?}"
- ZFS_KERNEL_COMPAT="6.0"
-
- # increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]]; then
- KEYWORDS="amd64 arm64 ppc64 ~riscv ~sparc"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-
-RDEPEND="${DEPEND}"
-
-BDEPEND="
- dev-lang/perl
- app-alternatives/awk
-"
-
-# we want dist-kernel block in BDEPEND because of portage resolver.
-# since linux-mod.eclass already sets version-unbounded dep, portage
-# will pull new versions. So we set it in BDEPEND which takes priority.
-# and we don't need in in git ebuild.
-if [[ ${PV} != "9999" ]] ; then
- BDEPEND+="
- verify-sig? ( sec-keys/openpgp-keys-openzfs )
- dist-kernel? ( <virtual/dist-kernel-${ZFS_KERNEL_DEP}:= )
- "
-fi
-
-# PDEPEND in this form is needed to trick portage suggest
-# enabling dist-kernel if only 1 package have it set
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-RESTRICT="debug? ( strip ) test"
-
-DOCS=( AUTHORS COPYRIGHT META README.md )
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.1.6-fgrep.patch
-
- # https://github.com/openzfs/zfs/issues/14308
- "${FILESDIR}"/2.1.7-ppc64-ieee128-compat.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-
- if has_version virtual/dist-kernel && ! use dist-kernel; then
- ewarn "You have virtual/dist-kernel installed, but"
- ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
- ewarn "It's recommended to globally enable dist-kernel USE flag"
- ewarn "to auto-trigger initrd rebuilds with kernel updates"
- fi
-}
-
-pkg_setup() {
- CONFIG_CHECK="
- !DEBUG_LOCK_ALLOC
- EFI_PARTITION
- MODULES
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- !TRIM_UNUSED_KSYMS
- ZLIB_DEFLATE
- ZLIB_INFLATE
- "
-
- use debug && CONFIG_CHECK="${CONFIG_CHECK}
- FRAME_POINTER
- DEBUG_INFO
- !DEBUG_INFO_REDUCED
- "
-
- use rootfs && \
- CONFIG_CHECK="${CONFIG_CHECK}
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
-
- if [[ ${PV} != "9999" ]]; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
-
- fi
-
- kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
-
- linux-mod_pkg_setup
-}
-
-src_unpack() {
- if use verify-sig ; then
- # Needed for downloaded patch (which is unsigned, which is fine)
- verify-sig_verify_detached "${DISTDIR}"/zfs-${MY_PV}.tar.gz{,.asc}
- fi
-
- default
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != "9999" ]]; then
- # Set module revision number
- sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
- fi
-}
-
-src_configure() {
- set_arch_to_kernel
-
- use custom-cflags || strip-flags
-
- filter-ldflags -Wl,*
-
- # Set CROSS_COMPILE in the environment.
- # This allows the user to override it via make.conf or via a local Makefile.
- # https://bugs.gentoo.org/811600
- export CROSS_COMPILE=${CROSS_COMPILE-${CHOST}-}
-
- local myconf=(
- HOSTCC="$(tc-getBUILD_CC)"
- --bindir="${EPREFIX}/bin"
- --sbindir="${EPREFIX}/sbin"
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- set_arch_to_kernel
-
- myemakeargs=(
- HOSTCC="$(tc-getBUILD_CC)"
- V=1
- )
-
- emake "${myemakeargs[@]}"
-}
-
-src_install() {
- set_arch_to_kernel
-
- myemakeargs+=(
- DEPMOD=:
- # INSTALL_MOD_PATH ?= $(DESTDIR) in module/Makefile
- DESTDIR="${D}"
- )
-
- emake "${myemakeargs[@]}" install
-
- einstalldocs
-}
-
-pkg_postinst() {
- linux-mod_pkg_postinst
-
- if [[ -z ${ROOT} ]] && use dist-kernel; then
- set_arch_to_pkgmgr
- dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
- fi
-
- if use x86 || use arm; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a new pool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2023-11-24 21:53 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2023-11-24 21:53 UTC (permalink / raw
To: gentoo-commits
commit: ea74809fc56791c2f45fc46815a7d5a8fd462961
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 24 21:48:39 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 24 21:51:35 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea74809f
sys-fs/zfs-kmod: disable zfs_dmu_offset_next_sync tunable by default
As a mitigation until more is understood and fixes are tested & reviewed, change
the default of zfs_dmu_offset_next_sync from 1 to 0, as it was before
05b3eb6d232009db247882a39d518e7282630753 upstream.
There are no reported cases of The Bug being hit with zfs_dmu_offset_next_sync=1:
that does not mean this is a cure or a real fix, but it _appears_ to be at least
effective in reducing the chances of it happening. By itself, it's a safe change
anyway, so it feels worth us doing while we wait.
Note that The Bug has been reproduced on 2.1.x as well, hence we do it for both
2.1.13 and 2.2.1.
Bug: https://github.com/openzfs/zfs/issues/11900
Bug: https://github.com/openzfs/zfs/issues/15526
Bug: https://bugs.gentoo.org/917224
Signed-off-by: Sam James <sam <AT> gentoo.org>
...s_dmu_offset_next_sync-tunable-by-default.patch | 40 ++++++++++++++++++
...s_dmu_offset_next_sync-tunable-by-default.patch | 43 ++++++++++++++++++++
...-kmod-9999.ebuild => zfs-kmod-2.1.13-r1.ebuild} | 47 ++--------------------
...s-kmod-9999.ebuild => zfs-kmod-2.2.1-r1.ebuild} | 1 +
sys-fs/zfs-kmod/zfs-kmod-9999.ebuild | 1 +
5 files changed, 89 insertions(+), 43 deletions(-)
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.1.13-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.1.13-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
new file mode 100644
index 000000000000..c03398450e48
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-kmod-2.1.13-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
@@ -0,0 +1,40 @@
+From 2b266bd36980caefe353411bd56b2487c44aeb6e Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Fri, 24 Nov 2023 21:38:06 +0000
+Subject: [PATCH] Disable zfs_dmu_offset_next_sync tunable by default
+
+As a mitigation until more is understood and fixes are tested & reviewed, change
+the default of zfs_dmu_offset_next_sync from 1 to 0, as it was before
+05b3eb6d232009db247882a39d518e7282630753.
+
+There are no reported cases of The Bug being hit with zfs_dmu_offset_next_sync=1:
+that does not mean this is a cure or a real fix, but it _appears_ to be at least
+effective in reducing the chances of it happening. By itself, it's a safe change
+anyway, so it feels worth us doing while we wait.
+
+Bug: https://github.com/openzfs/zfs/issues/11900
+Bug: https://github.com/openzfs/zfs/issues/15526
+Bug: https://bugs.gentoo.org/917224
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/man/man4/zfs.4
++++ b/man/man4/zfs.4
+@@ -1646,7 +1646,7 @@ Allow no-operation writes.
+ The occurrence of nopwrites will further depend on other pool properties
+ .Pq i.a. the checksumming and compression algorithms .
+ .
+-.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 1 Ns | Ns 0 Pq int
++.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | Ns 1 Pq int
+ Enable forcing TXG sync to find holes.
+ When enabled forces ZFS to sync data when
+ .Sy SEEK_HOLE No or Sy SEEK_DATA
+--- a/module/zfs/dmu.c
++++ b/module/zfs/dmu.c
+@@ -80,7 +80,7 @@ unsigned long zfs_per_txg_dirty_frees_percent = 30;
+ * Disabling this option will result in holes never being reported in dirty
+ * files which is always safe.
+ */
+-int zfs_dmu_offset_next_sync = 1;
++int zfs_dmu_offset_next_sync = 0;
+
+ /*
+ * Limit the amount we can prefetch with one call to this amount. This
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
new file mode 100644
index 000000000000..f49ab09adf7a
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
@@ -0,0 +1,43 @@
+From 2b266bd36980caefe353411bd56b2487c44aeb6e Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Fri, 24 Nov 2023 21:38:06 +0000
+Subject: [PATCH] Disable zfs_dmu_offset_next_sync tunable by default
+
+As a mitigation until more is understood and fixes are tested & reviewed, change
+the default of zfs_dmu_offset_next_sync from 1 to 0, as it was before
+05b3eb6d232009db247882a39d518e7282630753.
+
+There are no reported cases of The Bug being hit with zfs_dmu_offset_next_sync=1:
+that does not mean this is a cure or a real fix, but it _appears_ to be at least
+effective in reducing the chances of it happening. By itself, it's a safe change
+anyway, so it feels worth us doing while we wait.
+
+Bug: https://github.com/openzfs/zfs/issues/11900
+Bug: https://github.com/openzfs/zfs/issues/15526
+Bug: https://bugs.gentoo.org/917224
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/man/man4/zfs.4
++++ b/man/man4/zfs.4
+@@ -1677,7 +1677,7 @@ Allow no-operation writes.
+ The occurrence of nopwrites will further depend on other pool properties
+ .Pq i.a. the checksumming and compression algorithms .
+ .
+-.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 1 Ns | Ns 0 Pq int
++.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | Ns 1 Pq int
+ Enable forcing TXG sync to find holes.
+ When enabled forces ZFS to sync data when
+ .Sy SEEK_HOLE No or Sy SEEK_DATA
+--- a/module/zfs/dmu.c
++++ b/module/zfs/dmu.c
+@@ -82,7 +82,7 @@ static uint_t zfs_per_txg_dirty_frees_percent = 30;
+ * Disabling this option will result in holes never being reported in dirty
+ * files which is always safe.
+ */
+-static int zfs_dmu_offset_next_sync = 1;
++static int zfs_dmu_offset_next_sync = 0;
+
+ /*
+ * Limit the amount we can prefetch with one call to this amount. This
+--
+2.43.0
+
diff --git a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.1.13-r1.ebuild
similarity index 76%
copy from sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
copy to sys-fs/zfs-kmod/zfs-kmod-2.1.13-r1.ebuild
index 0b3c28a2134c..61dedf6ddd17 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.1.13-r1.ebuild
@@ -8,7 +8,7 @@ inherit autotools dist-kernel-utils flag-o-matic linux-mod-r1 multiprocessing
DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
HOMEPAGE="https://github.com/openzfs/zfs"
-MODULES_KERNEL_MAX=6.6
+MODULES_KERNEL_MAX=6.5
MODULES_KERNEL_MIN=3.10
if [[ ${PV} == 9999 ]] ; then
@@ -22,7 +22,7 @@ else
MY_PV=${PV/_rc/-rc}
SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${MY_PV}"
+ S="${WORKDIR}/zfs-${PV%_rc?}"
ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
# Increments minor eg 5.14 -> 5.15, and still supports override.
@@ -40,8 +40,8 @@ IUSE="custom-cflags debug +rootfs"
RESTRICT="test"
BDEPEND="
- app-alternatives/awk
dev-lang/perl
+ app-alternatives/awk
"
if [[ ${PV} != 9999 ]] ; then
@@ -60,6 +60,7 @@ PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
PATCHES=(
"${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+ "${FILESDIR}"/${PN}-2.1.13-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
)
pkg_pretend() {
@@ -149,47 +150,7 @@ src_install() {
dodoc AUTHORS COPYRIGHT META README.md
}
-_old_layout_cleanup() {
- # new files are just extra/{spl,zfs}.ko with no subdirs.
- local olddir=(
- avl/zavl
- icp/icp
- lua/zlua
- nvpair/znvpair
- spl/spl
- unicode/zunicode
- zcommon/zcommon
- zfs/zfs
- zstd/zzstd
- )
-
- # kernel/module/Kconfig contains possible compressed extentions.
- local kext kextfiles
- for kext in .ko{,.{gz,xz,zst}}; do
- kextfiles+=( "${olddir[@]/%/${kext}}" )
- done
-
- local oldfile oldpath
- for oldfile in "${kextfiles[@]}"; do
- oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
- if [[ -f "${oldpath}" ]]; then
- ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
- rm -rv "${oldpath}" || die
- # we do not remove non-empty directories just for safety in case there's something else.
- # also it may fail if there are both compressed and uncompressed modules installed.
- rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
- fi
- done
-}
-
pkg_postinst() {
- # Check for old module layout before doing anything else.
- # only attempt layout cleanup if new .ko location is used.
- local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
- # We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
- # if glob expanded -f will do correct file precense check.
- [[ -f ${newko[0]} ]] && _old_layout_cleanup
-
linux-mod-r1_pkg_postinst
if [[ -z ${ROOT} ]] && use dist-kernel ; then
diff --git a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.1-r1.ebuild
similarity index 98%
copy from sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
copy to sys-fs/zfs-kmod/zfs-kmod-2.2.1-r1.ebuild
index 0b3c28a2134c..6537bbc1a148 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.2.1-r1.ebuild
@@ -60,6 +60,7 @@ PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
PATCHES=(
"${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+ "${FILESDIR}"/${PN}-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
)
pkg_pretend() {
diff --git a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
index 0b3c28a2134c..6537bbc1a148 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
@@ -60,6 +60,7 @@ PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
PATCHES=(
"${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+ "${FILESDIR}"/${PN}-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
)
pkg_pretend() {
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2023-12-28 3:43 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2023-12-28 3:43 UTC (permalink / raw
To: gentoo-commits
commit: 0853ef3f0c5323c193a2825a756a5886fc762365
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 28 03:39:31 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 28 03:39:31 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0853ef3f
sys-fs/zfs-kmod: drop 2.2.1, 2.2.1-r1
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 2 -
...s_dmu_offset_next_sync-tunable-by-default.patch | 43 ----
sys-fs/zfs-kmod/zfs-kmod-2.2.1-r1.ebuild | 218 ---------------------
sys-fs/zfs-kmod/zfs-kmod-2.2.1.ebuild | 217 --------------------
4 files changed, 480 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index 8c893b1a1e3f..4591d964e4e4 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,6 +1,4 @@
DIST zfs-2.1.14.tar.gz 35167471 BLAKE2B a7b22eaf05e4fbf416ebe4d7b884c515942fc9375c1dd322cefa00c19c550b9318a4192d6a909d49d58523c8f1a6eaf00189dd58e6543fae17cf8cc35042f469 SHA512 4a65c8b7d5576fa2dcc14e7ccaa93191c1d3791479cf89bd02c2bd04434ff5e93709b328796d4f9ba93da19f12772e359df373f40919350a3e1e4c52758b47c8
DIST zfs-2.1.14.tar.gz.asc 836 BLAKE2B f01bc58bf6c3d367c494ed4ea9f3fb1141f3aafdbf4f913b9e0d60d31557076d5ae0e25ca93b013f5fd85e21ba5ae9f61e1a03af54bb0c743869c0ce3d5519df SHA512 be0f386cce952b4047dc2448e356078668e8d4392802dd3bb1a426741f15f4d9fb689cd1cb09972bdbc9fe2e4e782ec4b4754fe811c5657bc1f5308bd38e3926
-DIST zfs-2.2.1.tar.gz 33814243 BLAKE2B c3ff95c892024a11ee5c266b10e3354074606665a201fbab16e1ed12550340e0d991d98bd74f794331b68bd16cd6147a9e8937b8cda72d454abce72a22bafec6 SHA512 05e17046ac4f0ba923151be3e554e075db4783c8936c5dcee2d3b6d459fb386ba33f9eb38d15c185db58a1d26926147a66c3b3fe14e9de40987f0e95efa2bb31
-DIST zfs-2.2.1.tar.gz.asc 836 BLAKE2B 9d586d703d557df020f1d02e764f488f354f5c7105e7fa0f3dbf040881b63bdffa3310c9048ed102be05e9c851242b572cd0c6a22361e7e5a1cce50b1644a98d SHA512 78a13f42a71e39d346d43f3e1b271483b4b426ccdcda7f3709db8d89b0bcd54c79b7d17cfe3b49d2e6b8c7c41e30e69faade02e49e4bdddb3e472f2ceeb29cf2
DIST zfs-2.2.2.tar.gz 33816541 BLAKE2B f0619ae42d898d18077096217d0a9ddd7c7378424707aa51d3645661b2889a1459bc4a5e9fe42b6860b2d26e4600da35765b0e741725dafacc2ead2370cad866 SHA512 bba252cbf7986f2cce154dd18a34aa478cf98f70106337188dc894de2446d60a58fa643706927757d1787506b44d4ff404897a2d0e16aacb0a7bf27765703332
DIST zfs-2.2.2.tar.gz.asc 836 BLAKE2B bdc86492b2bf45d329e34e89ea7796f5cbf518d32ab114c909321b1d0d8040b9ce4e25b3b85fcbc5ea62ee10a2d716b5b27e37c2c005b307c0b593815c49d625 SHA512 110be1aa90f4749106717165a3cb5116379e2d170146a2b3d2601f04212450da9327e028d6e1e5de7f8a46c6bb7a15e2bcdd09e3e760590fbc695f9562f1440b
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
deleted file mode 100644
index f49ab09adf7a..000000000000
--- a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 2b266bd36980caefe353411bd56b2487c44aeb6e Mon Sep 17 00:00:00 2001
-From: Sam James <sam@gentoo.org>
-Date: Fri, 24 Nov 2023 21:38:06 +0000
-Subject: [PATCH] Disable zfs_dmu_offset_next_sync tunable by default
-
-As a mitigation until more is understood and fixes are tested & reviewed, change
-the default of zfs_dmu_offset_next_sync from 1 to 0, as it was before
-05b3eb6d232009db247882a39d518e7282630753.
-
-There are no reported cases of The Bug being hit with zfs_dmu_offset_next_sync=1:
-that does not mean this is a cure or a real fix, but it _appears_ to be at least
-effective in reducing the chances of it happening. By itself, it's a safe change
-anyway, so it feels worth us doing while we wait.
-
-Bug: https://github.com/openzfs/zfs/issues/11900
-Bug: https://github.com/openzfs/zfs/issues/15526
-Bug: https://bugs.gentoo.org/917224
-Signed-off-by: Sam James <sam@gentoo.org>
---- a/man/man4/zfs.4
-+++ b/man/man4/zfs.4
-@@ -1677,7 +1677,7 @@ Allow no-operation writes.
- The occurrence of nopwrites will further depend on other pool properties
- .Pq i.a. the checksumming and compression algorithms .
- .
--.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 1 Ns | Ns 0 Pq int
-+.It Sy zfs_dmu_offset_next_sync Ns = Ns Sy 0 Ns | Ns 1 Pq int
- Enable forcing TXG sync to find holes.
- When enabled forces ZFS to sync data when
- .Sy SEEK_HOLE No or Sy SEEK_DATA
---- a/module/zfs/dmu.c
-+++ b/module/zfs/dmu.c
-@@ -82,7 +82,7 @@ static uint_t zfs_per_txg_dirty_frees_percent = 30;
- * Disabling this option will result in holes never being reported in dirty
- * files which is always safe.
- */
--static int zfs_dmu_offset_next_sync = 1;
-+static int zfs_dmu_offset_next_sync = 0;
-
- /*
- * Limit the amount we can prefetch with one call to this amount. This
---
-2.43.0
-
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.2.1-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.1-r1.ebuild
deleted file mode 100644
index 6537bbc1a148..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.2.1-r1.ebuild
+++ /dev/null
@@ -1,218 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit autotools dist-kernel-utils flag-o-matic linux-mod-r1 multiprocessing
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-MODULES_KERNEL_MAX=6.6
-MODULES_KERNEL_MIN=3.10
-
-if [[ ${PV} == 9999 ]] ; then
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
- inherit git-r3
- unset MODULES_KERNEL_MAX
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV=${PV/_rc/-rc}
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${MY_PV}"
-
- ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
- # Increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]] ; then
- KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-RESTRICT="test"
-
-BDEPEND="
- app-alternatives/awk
- dev-lang/perl
-"
-
-if [[ ${PV} != 9999 ]] ; then
- BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
-
- IUSE+=" +dist-kernel-cap"
- RDEPEND="
- dist-kernel-cap? ( dist-kernel? (
- <virtual/dist-kernel-${ZFS_KERNEL_DEP}
- ) )
- "
-fi
-
-# Used to suggest matching USE, but without suggesting to disable
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
- "${FILESDIR}"/${PN}-2.2.1-Disable-zfs_dmu_offset_next_sync-tunable-by-default.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-
- if has_version virtual/dist-kernel && ! use dist-kernel; then
- ewarn "You have virtual/dist-kernel installed, but"
- ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
- ewarn "It's recommended to globally enable dist-kernel USE flag"
- ewarn "to auto-trigger initrd rebuilds with kernel updates"
- fi
-}
-
-pkg_setup() {
- local CONFIG_CHECK="
- EFI_PARTITION
- ZLIB_DEFLATE
- ZLIB_INFLATE
- !DEBUG_LOCK_ALLOC
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- "
- use debug && CONFIG_CHECK+="
- DEBUG_INFO
- FRAME_POINTER
- !DEBUG_INFO_REDUCED
- "
- use rootfs && CONFIG_CHECK+="
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
-
- if [[ ${PV} != 9999 ]] ; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
- fi
-
- linux-mod-r1_pkg_setup
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != 9999 ]] ; then
- # Set module revision number
- sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
- fi
-}
-
-src_configure() {
- use custom-cflags || strip-flags
- filter-ldflags -Wl,*
-
- local myconf=(
- --bindir="${EPREFIX}"/bin
- --sbindir="${EPREFIX}"/sbin
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
-
- # See gentoo.patch
- GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
- TEST_JOBS="$(makeopts_jobs)"
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- emake "${MODULES_MAKEARGS[@]}"
-}
-
-src_install() {
- emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
- modules_post_process
-
- dodoc AUTHORS COPYRIGHT META README.md
-}
-
-_old_layout_cleanup() {
- # new files are just extra/{spl,zfs}.ko with no subdirs.
- local olddir=(
- avl/zavl
- icp/icp
- lua/zlua
- nvpair/znvpair
- spl/spl
- unicode/zunicode
- zcommon/zcommon
- zfs/zfs
- zstd/zzstd
- )
-
- # kernel/module/Kconfig contains possible compressed extentions.
- local kext kextfiles
- for kext in .ko{,.{gz,xz,zst}}; do
- kextfiles+=( "${olddir[@]/%/${kext}}" )
- done
-
- local oldfile oldpath
- for oldfile in "${kextfiles[@]}"; do
- oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
- if [[ -f "${oldpath}" ]]; then
- ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
- rm -rv "${oldpath}" || die
- # we do not remove non-empty directories just for safety in case there's something else.
- # also it may fail if there are both compressed and uncompressed modules installed.
- rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
- fi
- done
-}
-
-pkg_postinst() {
- # Check for old module layout before doing anything else.
- # only attempt layout cleanup if new .ko location is used.
- local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
- # We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
- # if glob expanded -f will do correct file precense check.
- [[ -f ${newko[0]} ]] && _old_layout_cleanup
-
- linux-mod-r1_pkg_postinst
-
- if [[ -z ${ROOT} ]] && use dist-kernel ; then
- dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
- fi
-
- if use x86 || use arm ; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub ; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a new pool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.2.1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.1.ebuild
deleted file mode 100644
index 0b3c28a2134c..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.2.1.ebuild
+++ /dev/null
@@ -1,217 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit autotools dist-kernel-utils flag-o-matic linux-mod-r1 multiprocessing
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-MODULES_KERNEL_MAX=6.6
-MODULES_KERNEL_MIN=3.10
-
-if [[ ${PV} == 9999 ]] ; then
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
- inherit git-r3
- unset MODULES_KERNEL_MAX
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV=${PV/_rc/-rc}
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${MY_PV}"
-
- ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
- # Increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]] ; then
- KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-RESTRICT="test"
-
-BDEPEND="
- app-alternatives/awk
- dev-lang/perl
-"
-
-if [[ ${PV} != 9999 ]] ; then
- BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
-
- IUSE+=" +dist-kernel-cap"
- RDEPEND="
- dist-kernel-cap? ( dist-kernel? (
- <virtual/dist-kernel-${ZFS_KERNEL_DEP}
- ) )
- "
-fi
-
-# Used to suggest matching USE, but without suggesting to disable
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-
- if has_version virtual/dist-kernel && ! use dist-kernel; then
- ewarn "You have virtual/dist-kernel installed, but"
- ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
- ewarn "It's recommended to globally enable dist-kernel USE flag"
- ewarn "to auto-trigger initrd rebuilds with kernel updates"
- fi
-}
-
-pkg_setup() {
- local CONFIG_CHECK="
- EFI_PARTITION
- ZLIB_DEFLATE
- ZLIB_INFLATE
- !DEBUG_LOCK_ALLOC
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- "
- use debug && CONFIG_CHECK+="
- DEBUG_INFO
- FRAME_POINTER
- !DEBUG_INFO_REDUCED
- "
- use rootfs && CONFIG_CHECK+="
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
-
- if [[ ${PV} != 9999 ]] ; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
- fi
-
- linux-mod-r1_pkg_setup
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != 9999 ]] ; then
- # Set module revision number
- sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
- fi
-}
-
-src_configure() {
- use custom-cflags || strip-flags
- filter-ldflags -Wl,*
-
- local myconf=(
- --bindir="${EPREFIX}"/bin
- --sbindir="${EPREFIX}"/sbin
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
-
- # See gentoo.patch
- GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
- TEST_JOBS="$(makeopts_jobs)"
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- emake "${MODULES_MAKEARGS[@]}"
-}
-
-src_install() {
- emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
- modules_post_process
-
- dodoc AUTHORS COPYRIGHT META README.md
-}
-
-_old_layout_cleanup() {
- # new files are just extra/{spl,zfs}.ko with no subdirs.
- local olddir=(
- avl/zavl
- icp/icp
- lua/zlua
- nvpair/znvpair
- spl/spl
- unicode/zunicode
- zcommon/zcommon
- zfs/zfs
- zstd/zzstd
- )
-
- # kernel/module/Kconfig contains possible compressed extentions.
- local kext kextfiles
- for kext in .ko{,.{gz,xz,zst}}; do
- kextfiles+=( "${olddir[@]/%/${kext}}" )
- done
-
- local oldfile oldpath
- for oldfile in "${kextfiles[@]}"; do
- oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
- if [[ -f "${oldpath}" ]]; then
- ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
- rm -rv "${oldpath}" || die
- # we do not remove non-empty directories just for safety in case there's something else.
- # also it may fail if there are both compressed and uncompressed modules installed.
- rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
- fi
- done
-}
-
-pkg_postinst() {
- # Check for old module layout before doing anything else.
- # only attempt layout cleanup if new .ko location is used.
- local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
- # We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
- # if glob expanded -f will do correct file precense check.
- [[ -f ${newko[0]} ]] && _old_layout_cleanup
-
- linux-mod-r1_pkg_postinst
-
- if [[ -z ${ROOT} ]] && use dist-kernel ; then
- dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
- fi
-
- if use x86 || use arm ; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub ; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a new pool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2024-01-29 16:08 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2024-01-29 16:08 UTC (permalink / raw
To: gentoo-commits
commit: 1d106b3c4cc3d9d10e558558d4fbffbdf9c694ad
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 29 16:07:58 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 29 16:07:58 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d106b3c
sys-fs/zfs-kmod: fix arm64 neon compat w/ >=linux-6.2
Closes: https://bugs.gentoo.org/904657
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../zfs-kmod/files/zfs-kmod-2.2.2-arm64-neon.patch | 100 +++++++++++++++++++++
sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild | 3 +-
2 files changed, 102 insertions(+), 1 deletion(-)
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-arm64-neon.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-arm64-neon.patch
new file mode 100644
index 000000000000..54121adcdca3
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-arm64-neon.patch
@@ -0,0 +1,100 @@
+https://bugs.gentoo.org/904657
+https://github.com/openzfs/zfs/issues/14555
+https://github.com/openzfs/zfs/commit/976bf9b6a61919638d42ed79cd207132785d128a
+
+From 976bf9b6a61919638d42ed79cd207132785d128a Mon Sep 17 00:00:00 2001
+From: Shengqi Chen <harry-chen@outlook.com>
+Date: Tue, 9 Jan 2024 08:05:24 +0800
+Subject: [PATCH] Linux 6.2 compat: add check for kernel_neon_* availability
+
+This patch adds check for `kernel_neon_*` symbols on arm and arm64
+platforms to address the following issues:
+
+1. Linux 6.2+ on arm64 has exported them with `EXPORT_SYMBOL_GPL`, so
+ license compatibility must be checked before use.
+2. On both arm and arm64, the definitions of these symbols are guarded
+ by `CONFIG_KERNEL_MODE_NEON`, but their declarations are still
+ present. Checking in configuration phase only leads to MODPOST
+ errors (undefined references).
+
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
+Closes #15711
+Closes #14555
+Closes: #15401
+--- a/config/kernel-fpu.m4
++++ b/config/kernel-fpu.m4
+@@ -79,6 +79,12 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
+ __kernel_fpu_end();
+ ], [], [ZFS_META_LICENSE])
+
++ ZFS_LINUX_TEST_SRC([kernel_neon], [
++ #include <asm/neon.h>
++ ], [
++ kernel_neon_begin();
++ kernel_neon_end();
++ ], [], [ZFS_META_LICENSE])
+ ])
+
+ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
+@@ -105,9 +111,20 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
+ AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
+ [kernel exports FPU functions])
+ ],[
+- AC_MSG_RESULT(internal)
+- AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
+- [kernel fpu internal])
++ dnl #
++ dnl # ARM neon symbols (only on arm and arm64)
++ dnl # could be GPL-only on arm64 after Linux 6.2
++ dnl #
++ ZFS_LINUX_TEST_RESULT([kernel_neon_license],[
++ AC_MSG_RESULT(kernel_neon_*)
++ AC_DEFINE(HAVE_KERNEL_NEON, 1,
++ [kernel has kernel_neon_* functions])
++ ],[
++ # catch-all
++ AC_MSG_RESULT(internal)
++ AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
++ [kernel fpu internal])
++ ])
+ ])
+ ])
+ ])
+--- a/include/os/linux/kernel/linux/simd_aarch64.h
++++ b/include/os/linux/kernel/linux/simd_aarch64.h
+@@ -71,9 +71,15 @@
+ #define ID_AA64PFR0_EL1 sys_reg(3, 0, 0, 1, 0)
+ #define ID_AA64ISAR0_EL1 sys_reg(3, 0, 0, 6, 0)
+
++#if (defined(HAVE_KERNEL_NEON) && defined(CONFIG_KERNEL_MODE_NEON))
+ #define kfpu_allowed() 1
+ #define kfpu_begin() kernel_neon_begin()
+ #define kfpu_end() kernel_neon_end()
++#else
++#define kfpu_allowed() 0
++#define kfpu_begin() do {} while (0)
++#define kfpu_end() do {} while (0)
++#endif
+ #define kfpu_init() (0)
+ #define kfpu_fini() do {} while (0)
+
+--- a/include/os/linux/kernel/linux/simd_arm.h
++++ b/include/os/linux/kernel/linux/simd_arm.h
+@@ -53,9 +53,15 @@
+ #include <asm/elf.h>
+ #include <asm/hwcap.h>
+
++#if (defined(HAVE_KERNEL_NEON) && defined(CONFIG_KERNEL_MODE_NEON))
+ #define kfpu_allowed() 1
+ #define kfpu_begin() kernel_neon_begin()
+ #define kfpu_end() kernel_neon_end()
++#else
++#define kfpu_allowed() 0
++#define kfpu_begin() do {} while (0)
++#define kfpu_end() do {} while (0)
++#endif
+ #define kfpu_init() (0)
+ #define kfpu_fini() do {} while (0)
+
+
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild
index 18f9e126cc32..863395ebfef3 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild
@@ -60,6 +60,7 @@ PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
PATCHES=(
"${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+ "${FILESDIR}"/${PN}-2.2.2-arm64-neon.patch
)
pkg_pretend() {
@@ -103,7 +104,7 @@ pkg_setup() {
"Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
fi
- linux-mod-r1_pkg_setup
+ #linux-mod-r1_pkg_setup
}
src_prepare() {
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2024-02-06 1:50 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2024-02-06 1:50 UTC (permalink / raw
To: gentoo-commits
commit: 41c60e94beea46d932ae78fb7dd388ca6c9a3924
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 6 01:50:03 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Feb 6 01:50:03 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41c60e94
sys-fs/zfs-kmod: backport autotrim CPU fix
Closes: https://bugs.gentoo.org/923745
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../zfs-kmod/files/zfs-kmod-2.2.2-autotrim.patch | 31 +++
sys-fs/zfs-kmod/zfs-kmod-2.2.2-r1.ebuild | 219 +++++++++++++++++++++
2 files changed, 250 insertions(+)
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-autotrim.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-autotrim.patch
new file mode 100644
index 000000000000..6d72389fdb25
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-autotrim.patch
@@ -0,0 +1,31 @@
+https://bugs.gentoo.org/923745
+https://github.com/openzfs/zfs/issues/15453
+https://github.com/openzfs/zfs/pull/15781
+https://github.com/openzfs/zfs/pull/15789
+
+From a0aa7a2ee3b56d7b6d69c2081034ec8293a6d605 Mon Sep 17 00:00:00 2001
+From: Kevin Jin <33590050+jxdking@users.noreply.github.com>
+Date: Wed, 17 Jan 2024 12:03:58 -0500
+Subject: [PATCH] Autotrim High Load Average Fix
+
+Switch from cv_wait() to cv_wait_idle() in vdev_autotrim_wait_kick(),
+which should mitigate the high load average while waiting.
+
+Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Reviewed-by: Alexander Motin <mav@FreeBSD.org>
+Signed-off-by: jxdking <lostking2008@hotmail.com>
+Closes #15781
+--- a/module/zfs/vdev_trim.c
++++ b/module/zfs/vdev_trim.c
+@@ -194,7 +194,8 @@ vdev_autotrim_wait_kick(vdev_t *vd, int num_of_kick)
+ for (int i = 0; i < num_of_kick; i++) {
+ if (vd->vdev_autotrim_exit_wanted)
+ break;
+- cv_wait(&vd->vdev_autotrim_kick_cv, &vd->vdev_autotrim_lock);
++ cv_wait_idle(&vd->vdev_autotrim_kick_cv,
++ &vd->vdev_autotrim_lock);
+ }
+ boolean_t exit_wanted = vd->vdev_autotrim_exit_wanted;
+ mutex_exit(&vd->vdev_autotrim_lock);
+
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.2.2-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.2-r1.ebuild
new file mode 100644
index 000000000000..7b28bf3a94ab
--- /dev/null
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.2.2-r1.ebuild
@@ -0,0 +1,219 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools dist-kernel-utils flag-o-matic linux-mod-r1 multiprocessing
+
+DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
+HOMEPAGE="https://github.com/openzfs/zfs"
+
+MODULES_KERNEL_MAX=6.6
+MODULES_KERNEL_MIN=3.10
+
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
+ inherit git-r3
+ unset MODULES_KERNEL_MAX
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/openzfs.asc
+ inherit verify-sig
+
+ MY_PV=${PV/_rc/-rc}
+ SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
+ SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
+ S="${WORKDIR}/zfs-${MY_PV}"
+
+ ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
+ # Increments minor eg 5.14 -> 5.15, and still supports override.
+ ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
+
+ if [[ ${PV} != *_rc* ]] ; then
+ KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~sparc"
+ fi
+fi
+
+LICENSE="CDDL MIT debug? ( GPL-2+ )"
+SLOT="0/${PVR}"
+IUSE="custom-cflags debug +rootfs"
+RESTRICT="test"
+
+BDEPEND="
+ app-alternatives/awk
+ dev-lang/perl
+"
+
+if [[ ${PV} != 9999 ]] ; then
+ BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
+
+ IUSE+=" +dist-kernel-cap"
+ RDEPEND="
+ dist-kernel-cap? ( dist-kernel? (
+ <virtual/dist-kernel-${ZFS_KERNEL_DEP}
+ ) )
+ "
+fi
+
+# Used to suggest matching USE, but without suggesting to disable
+PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+ "${FILESDIR}"/${PN}-2.2.2-arm64-neon.patch
+ "${FILESDIR}"/${PN}-2.2.2-autotrim.patch
+)
+
+pkg_pretend() {
+ use rootfs || return 0
+
+ if has_version virtual/dist-kernel && ! use dist-kernel; then
+ ewarn "You have virtual/dist-kernel installed, but"
+ ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
+ ewarn "It's recommended to globally enable dist-kernel USE flag"
+ ewarn "to auto-trigger initrd rebuilds with kernel updates"
+ fi
+}
+
+pkg_setup() {
+ local CONFIG_CHECK="
+ EFI_PARTITION
+ ZLIB_DEFLATE
+ ZLIB_INFLATE
+ !DEBUG_LOCK_ALLOC
+ !PAX_KERNEXEC_PLUGIN_METHOD_OR
+ "
+ use debug && CONFIG_CHECK+="
+ DEBUG_INFO
+ FRAME_POINTER
+ !DEBUG_INFO_REDUCED
+ "
+ use rootfs && CONFIG_CHECK+="
+ BLK_DEV_INITRD
+ DEVTMPFS
+ "
+
+ kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
+
+ if [[ ${PV} != 9999 ]] ; then
+ local kv_major_max kv_minor_max zcompat
+ zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+ kv_major_max="${zcompat%%.*}"
+ zcompat="${zcompat#*.}"
+ kv_minor_max="${zcompat%%.*}"
+ kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
+ "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
+ fi
+
+ linux-mod-r1_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ # Run unconditionally (bug #792627)
+ eautoreconf
+
+ if [[ ${PV} != 9999 ]] ; then
+ # Set module revision number
+ sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
+ fi
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ filter-ldflags -Wl,*
+
+ local myconf=(
+ --bindir="${EPREFIX}"/bin
+ --sbindir="${EPREFIX}"/sbin
+ --with-config=kernel
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ $(use_enable debug)
+
+ # See gentoo.patch
+ GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
+ TEST_JOBS="$(makeopts_jobs)"
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ emake "${MODULES_MAKEARGS[@]}"
+}
+
+src_install() {
+ emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
+ modules_post_process
+
+ dodoc AUTHORS COPYRIGHT META README.md
+}
+
+_old_layout_cleanup() {
+ # new files are just extra/{spl,zfs}.ko with no subdirs.
+ local olddir=(
+ avl/zavl
+ icp/icp
+ lua/zlua
+ nvpair/znvpair
+ spl/spl
+ unicode/zunicode
+ zcommon/zcommon
+ zfs/zfs
+ zstd/zzstd
+ )
+
+ # kernel/module/Kconfig contains possible compressed extentions.
+ local kext kextfiles
+ for kext in .ko{,.{gz,xz,zst}}; do
+ kextfiles+=( "${olddir[@]/%/${kext}}" )
+ done
+
+ local oldfile oldpath
+ for oldfile in "${kextfiles[@]}"; do
+ oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
+ if [[ -f "${oldpath}" ]]; then
+ ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
+ rm -rv "${oldpath}" || die
+ # we do not remove non-empty directories just for safety in case there's something else.
+ # also it may fail if there are both compressed and uncompressed modules installed.
+ rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
+ fi
+ done
+}
+
+pkg_postinst() {
+ # Check for old module layout before doing anything else.
+ # only attempt layout cleanup if new .ko location is used.
+ local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
+ # We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
+ # if glob expanded -f will do correct file precense check.
+ [[ -f ${newko[0]} ]] && _old_layout_cleanup
+
+ linux-mod-r1_pkg_postinst
+
+ if [[ -z ${ROOT} ]] && use dist-kernel ; then
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ fi
+
+ if use x86 || use arm ; then
+ ewarn "32-bit kernels will likely require increasing vmalloc to"
+ ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
+ fi
+
+ if has_version sys-boot/grub ; then
+ ewarn "This version of OpenZFS includes support for new feature flags"
+ ewarn "that are incompatible with previous versions. GRUB2 support for"
+ ewarn "/boot with the new feature flags is not yet available."
+ ewarn "Do *NOT* upgrade root pools to use the new feature flags."
+ ewarn "Any new pools will be created with the new feature flags by default"
+ ewarn "and will not be compatible with older versions of OpenZFS. To"
+ ewarn "create a new pool that is backward compatible wih GRUB2, use "
+ ewarn
+ ewarn "zpool create -o compatibility=grub2 ..."
+ ewarn
+ ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
+ fi
+}
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
@ 2024-10-05 6:16 Sam James
0 siblings, 0 replies; 21+ messages in thread
From: Sam James @ 2024-10-05 6:16 UTC (permalink / raw
To: gentoo-commits
commit: 218914ed7443a3e9b660b7f7776d7e9bbaaeea9b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 5 06:14:24 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 5 06:14:24 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=218914ed
sys-fs/zfs-kmod: drop 2.2.2, 2.2.2-r1, 2.2.3, 2.2.4
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-fs/zfs-kmod/Manifest | 6 -
.../zfs-kmod/files/zfs-kmod-2.2.2-arm64-neon.patch | 100 ----------
.../zfs-kmod/files/zfs-kmod-2.2.2-autotrim.patch | 31 ---
sys-fs/zfs-kmod/zfs-kmod-2.2.2-r1.ebuild | 209 ---------------------
sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild | 208 --------------------
sys-fs/zfs-kmod/zfs-kmod-2.2.3.ebuild | 207 --------------------
sys-fs/zfs-kmod/zfs-kmod-2.2.4.ebuild | 207 --------------------
7 files changed, 968 deletions(-)
diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index 914a5a3839de..07d7c573a713 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -1,11 +1,5 @@
DIST zfs-2.1.15.tar.gz 35209038 BLAKE2B 61f9e14c54d43d1c51269917bb3ffde0530166126ea0467103ff1171dffc537315fd21c270d12f73d677e121b8094af39dd0a1fe3f80986bb42dc16d627dff52 SHA512 24096f2a6ecb3cc51f3d2f11cc69ad134d6fc33667007277c50cf798be2b19b6ddfa9be6923ca53d8b09f0bebae14c44d74811ec776e5aaf4ea0e810844c1f3d
DIST zfs-2.1.15.tar.gz.asc 836 BLAKE2B 897c05a8870cd0418493b42fe854ef5b28f9a31513ac262a25631089defa59190808b51bd31e43412b01171bcac0dff0608d417dfdacfeee0b0f067e0627d48f SHA512 a6c5a9d214070a220716075455eb1cb85a53fb20b5fe4319f112cde0653a25f87b66d0f0bcf0ca641e3ac38239759cb9df6ed7f4700056a2732cc8c1ccd9ce05
-DIST zfs-2.2.2.tar.gz 33816541 BLAKE2B f0619ae42d898d18077096217d0a9ddd7c7378424707aa51d3645661b2889a1459bc4a5e9fe42b6860b2d26e4600da35765b0e741725dafacc2ead2370cad866 SHA512 bba252cbf7986f2cce154dd18a34aa478cf98f70106337188dc894de2446d60a58fa643706927757d1787506b44d4ff404897a2d0e16aacb0a7bf27765703332
-DIST zfs-2.2.2.tar.gz.asc 836 BLAKE2B bdc86492b2bf45d329e34e89ea7796f5cbf518d32ab114c909321b1d0d8040b9ce4e25b3b85fcbc5ea62ee10a2d716b5b27e37c2c005b307c0b593815c49d625 SHA512 110be1aa90f4749106717165a3cb5116379e2d170146a2b3d2601f04212450da9327e028d6e1e5de7f8a46c6bb7a15e2bcdd09e3e760590fbc695f9562f1440b
-DIST zfs-2.2.3.tar.gz 33854765 BLAKE2B f83439aa929609191a048dd326b2a15e0f57c72d2901cbfb205b81a29aa42dab49b42eb61647ca3eaed17518b8c907e81343364bfecf83ed441271648f8efd4b SHA512 e6c3df531a33f4bd198429e61b7630f1e965a03fd60d1b847bdf0d55c6d2af3abc38b5e8a63aa9ef9f969cc7eca36cb24a7641f6fb8c41ef2fa024d76cd28f3d
-DIST zfs-2.2.3.tar.gz.asc 836 BLAKE2B 86e1adc393d1f4643a6fd8c188b555e9dc0fdf7e25690f37ff0a04ff8826eb4fe3c125b54f0c5b9ab33f1daff43c4b44373ee9a4df506f6714f98d77782e6c3c SHA512 fe23ddb9bde78416776411d66a56aa662fa051c8544b4be01ba238b8c1a85ccde1c55329f228fe8ab2681b54a4e4cb08d4e927c597c117242f0b536a40921dc9
-DIST zfs-2.2.4.tar.gz 33882933 BLAKE2B f0026a12b7c1252bf8941e39f23d3e165750034707dfddf034d8aac942a749cb7f0108478797ca978704a22743d9928240b29cf78fe89eda9f873f40102413f0 SHA512 1d17e30573d594fb5c9ea77cde104616dca362fed7530296816d1b55173594f66170fcfb23ab57c27074f85b79d3eb557b4ee9a1c420e507b2434a7902d8dcc1
-DIST zfs-2.2.4.tar.gz.asc 836 BLAKE2B 7fde4232c25056eac2fae76abec4d6749c91d285d79ae6dce4ae4880fa90a26c9fb370dfa4daaf8a849f30fcc1b63eeb215444bfca724f6750bf7e4344f35fa7 SHA512 0cb3caf01b9e4d1f0c35d9f7933a4b11560b9bbf6c05494d8a1775b0a52ac1d642aebd77ef1c7b23a0a06f92e2b1ab3d8afacce41017eb07745d148af7f76a17
DIST zfs-2.2.5.tar.gz 33896824 BLAKE2B ec73c866bf931e4af63a35b3e61e1254d681d21aadba304ea95c147a3911c3d92db686591147036848ceae1683f31f6f81e04a24df6cb11a91a8abaed179567f SHA512 8e288620ce78fb235fa0c9929fc97150987a64091a8a5209209f1e0975d4d6213b8b307e32b3c89d934e83dc8468a1998b797fcdff5bbbbd023f07674877b0c6
DIST zfs-2.2.5.tar.gz.asc 836 BLAKE2B ae6e47ce82ffda8834047e03f361ca096448f98ea811a09c0c68b202996c613e6524501cda49873acc4bca9f60c298635f89e5d7fe8f00ffa05b192fc98e16ef SHA512 0a397471c3f1ee9675eb9fcd589409c5085f8692930275ea15d92042fadaf1d3772666a3cca5adb1730c953464e0ec00f501cc5333a303d322c636020c2a7060
DIST zfs-2.2.6.tar.gz 33900138 BLAKE2B 0bbe36df779aaf19460a75725af9c9b13e64e77a6020974ad18d60d9fd52db2ddd6ea98b3e6c7451195bdfb347b8aab51db9b3f9a7c15c77bff47329bbd07dd2 SHA512 c217a3397b67d7239bc30bc492d58fff96bb29c9cf73e390d1787a4fb787cb297557e594a926453fed11faaab80363d40853af271f8ee18ce9a317dfde4c6745
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-arm64-neon.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-arm64-neon.patch
deleted file mode 100644
index 54121adcdca3..000000000000
--- a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-arm64-neon.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-https://bugs.gentoo.org/904657
-https://github.com/openzfs/zfs/issues/14555
-https://github.com/openzfs/zfs/commit/976bf9b6a61919638d42ed79cd207132785d128a
-
-From 976bf9b6a61919638d42ed79cd207132785d128a Mon Sep 17 00:00:00 2001
-From: Shengqi Chen <harry-chen@outlook.com>
-Date: Tue, 9 Jan 2024 08:05:24 +0800
-Subject: [PATCH] Linux 6.2 compat: add check for kernel_neon_* availability
-
-This patch adds check for `kernel_neon_*` symbols on arm and arm64
-platforms to address the following issues:
-
-1. Linux 6.2+ on arm64 has exported them with `EXPORT_SYMBOL_GPL`, so
- license compatibility must be checked before use.
-2. On both arm and arm64, the definitions of these symbols are guarded
- by `CONFIG_KERNEL_MODE_NEON`, but their declarations are still
- present. Checking in configuration phase only leads to MODPOST
- errors (undefined references).
-
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
-Closes #15711
-Closes #14555
-Closes: #15401
---- a/config/kernel-fpu.m4
-+++ b/config/kernel-fpu.m4
-@@ -79,6 +79,12 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
- __kernel_fpu_end();
- ], [], [ZFS_META_LICENSE])
-
-+ ZFS_LINUX_TEST_SRC([kernel_neon], [
-+ #include <asm/neon.h>
-+ ], [
-+ kernel_neon_begin();
-+ kernel_neon_end();
-+ ], [], [ZFS_META_LICENSE])
- ])
-
- AC_DEFUN([ZFS_AC_KERNEL_FPU], [
-@@ -105,9 +111,20 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
- AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
- [kernel exports FPU functions])
- ],[
-- AC_MSG_RESULT(internal)
-- AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
-- [kernel fpu internal])
-+ dnl #
-+ dnl # ARM neon symbols (only on arm and arm64)
-+ dnl # could be GPL-only on arm64 after Linux 6.2
-+ dnl #
-+ ZFS_LINUX_TEST_RESULT([kernel_neon_license],[
-+ AC_MSG_RESULT(kernel_neon_*)
-+ AC_DEFINE(HAVE_KERNEL_NEON, 1,
-+ [kernel has kernel_neon_* functions])
-+ ],[
-+ # catch-all
-+ AC_MSG_RESULT(internal)
-+ AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
-+ [kernel fpu internal])
-+ ])
- ])
- ])
- ])
---- a/include/os/linux/kernel/linux/simd_aarch64.h
-+++ b/include/os/linux/kernel/linux/simd_aarch64.h
-@@ -71,9 +71,15 @@
- #define ID_AA64PFR0_EL1 sys_reg(3, 0, 0, 1, 0)
- #define ID_AA64ISAR0_EL1 sys_reg(3, 0, 0, 6, 0)
-
-+#if (defined(HAVE_KERNEL_NEON) && defined(CONFIG_KERNEL_MODE_NEON))
- #define kfpu_allowed() 1
- #define kfpu_begin() kernel_neon_begin()
- #define kfpu_end() kernel_neon_end()
-+#else
-+#define kfpu_allowed() 0
-+#define kfpu_begin() do {} while (0)
-+#define kfpu_end() do {} while (0)
-+#endif
- #define kfpu_init() (0)
- #define kfpu_fini() do {} while (0)
-
---- a/include/os/linux/kernel/linux/simd_arm.h
-+++ b/include/os/linux/kernel/linux/simd_arm.h
-@@ -53,9 +53,15 @@
- #include <asm/elf.h>
- #include <asm/hwcap.h>
-
-+#if (defined(HAVE_KERNEL_NEON) && defined(CONFIG_KERNEL_MODE_NEON))
- #define kfpu_allowed() 1
- #define kfpu_begin() kernel_neon_begin()
- #define kfpu_end() kernel_neon_end()
-+#else
-+#define kfpu_allowed() 0
-+#define kfpu_begin() do {} while (0)
-+#define kfpu_end() do {} while (0)
-+#endif
- #define kfpu_init() (0)
- #define kfpu_fini() do {} while (0)
-
-
diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-autotrim.patch b/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-autotrim.patch
deleted file mode 100644
index 6d72389fdb25..000000000000
--- a/sys-fs/zfs-kmod/files/zfs-kmod-2.2.2-autotrim.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-https://bugs.gentoo.org/923745
-https://github.com/openzfs/zfs/issues/15453
-https://github.com/openzfs/zfs/pull/15781
-https://github.com/openzfs/zfs/pull/15789
-
-From a0aa7a2ee3b56d7b6d69c2081034ec8293a6d605 Mon Sep 17 00:00:00 2001
-From: Kevin Jin <33590050+jxdking@users.noreply.github.com>
-Date: Wed, 17 Jan 2024 12:03:58 -0500
-Subject: [PATCH] Autotrim High Load Average Fix
-
-Switch from cv_wait() to cv_wait_idle() in vdev_autotrim_wait_kick(),
-which should mitigate the high load average while waiting.
-
-Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Reviewed-by: Alexander Motin <mav@FreeBSD.org>
-Signed-off-by: jxdking <lostking2008@hotmail.com>
-Closes #15781
---- a/module/zfs/vdev_trim.c
-+++ b/module/zfs/vdev_trim.c
-@@ -194,7 +194,8 @@ vdev_autotrim_wait_kick(vdev_t *vd, int num_of_kick)
- for (int i = 0; i < num_of_kick; i++) {
- if (vd->vdev_autotrim_exit_wanted)
- break;
-- cv_wait(&vd->vdev_autotrim_kick_cv, &vd->vdev_autotrim_lock);
-+ cv_wait_idle(&vd->vdev_autotrim_kick_cv,
-+ &vd->vdev_autotrim_lock);
- }
- boolean_t exit_wanted = vd->vdev_autotrim_exit_wanted;
- mutex_exit(&vd->vdev_autotrim_lock);
-
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.2.2-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.2-r1.ebuild
deleted file mode 100644
index 6f4cf5107e3f..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.2.2-r1.ebuild
+++ /dev/null
@@ -1,209 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-MODULES_INITRAMFS_IUSE=+initramfs
-inherit autotools flag-o-matic linux-mod-r1 multiprocessing
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-MODULES_KERNEL_MAX=6.6
-MODULES_KERNEL_MIN=3.10
-
-if [[ ${PV} == 9999 ]] ; then
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
- inherit git-r3
- unset MODULES_KERNEL_MAX
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV=${PV/_rc/-rc}
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${MY_PV}"
-
- ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
- # Increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]] ; then
- KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~sparc"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-RESTRICT="test"
-
-BDEPEND="
- app-alternatives/awk
- dev-lang/perl
-"
-
-if [[ ${PV} != 9999 ]] ; then
- BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
-
- IUSE+=" +dist-kernel-cap"
- RDEPEND="
- dist-kernel-cap? ( dist-kernel? (
- <virtual/dist-kernel-${ZFS_KERNEL_DEP}
- ) )
- "
-fi
-
-# Used to suggest matching USE, but without suggesting to disable
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
- "${FILESDIR}"/${PN}-2.2.2-arm64-neon.patch
- "${FILESDIR}"/${PN}-2.2.2-autotrim.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-}
-
-pkg_setup() {
- local CONFIG_CHECK="
- EFI_PARTITION
- ZLIB_DEFLATE
- ZLIB_INFLATE
- !DEBUG_LOCK_ALLOC
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- "
- use debug && CONFIG_CHECK+="
- DEBUG_INFO
- FRAME_POINTER
- !DEBUG_INFO_REDUCED
- "
- use rootfs && CONFIG_CHECK+="
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
-
- if [[ ${PV} != 9999 ]] ; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
- fi
-
- linux-mod-r1_pkg_setup
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != 9999 ]] ; then
- # Set module revision number
- sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
- fi
-}
-
-src_configure() {
- use custom-cflags || strip-flags
- filter-ldflags -Wl,*
-
- local myconf=(
- --bindir="${EPREFIX}"/bin
- --sbindir="${EPREFIX}"/sbin
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
-
- # See gentoo.patch
- GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
- TEST_JOBS="$(makeopts_jobs)"
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- emake "${MODULES_MAKEARGS[@]}"
-}
-
-src_install() {
- emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
- modules_post_process
-
- dodoc AUTHORS COPYRIGHT META README.md
-}
-
-_old_layout_cleanup() {
- # new files are just extra/{spl,zfs}.ko with no subdirs.
- local olddir=(
- avl/zavl
- icp/icp
- lua/zlua
- nvpair/znvpair
- spl/spl
- unicode/zunicode
- zcommon/zcommon
- zfs/zfs
- zstd/zzstd
- )
-
- # kernel/module/Kconfig contains possible compressed extentions.
- local kext kextfiles
- for kext in .ko{,.{gz,xz,zst}}; do
- kextfiles+=( "${olddir[@]/%/${kext}}" )
- done
-
- local oldfile oldpath
- for oldfile in "${kextfiles[@]}"; do
- oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
- if [[ -f "${oldpath}" ]]; then
- ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
- rm -rv "${oldpath}" || die
- # we do not remove non-empty directories just for safety in case there's something else.
- # also it may fail if there are both compressed and uncompressed modules installed.
- rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
- fi
- done
-}
-
-pkg_postinst() {
- # Check for old module layout before doing anything else.
- # only attempt layout cleanup if new .ko location is used.
- local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
- # We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
- # if glob expanded -f will do correct file precense check.
- [[ -f ${newko[0]} ]] && _old_layout_cleanup
-
- linux-mod-r1_pkg_postinst
-
- if use x86 || use arm ; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub ; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a new pool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild
deleted file mode 100644
index b46dea36c184..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.2.2.ebuild
+++ /dev/null
@@ -1,208 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-MODULES_INITRAMFS_IUSE=+initramfs
-inherit autotools flag-o-matic linux-mod-r1 multiprocessing
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-MODULES_KERNEL_MAX=6.6
-MODULES_KERNEL_MIN=3.10
-
-if [[ ${PV} == 9999 ]] ; then
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
- inherit git-r3
- unset MODULES_KERNEL_MAX
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV=${PV/_rc/-rc}
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${MY_PV}"
-
- ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
- # Increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]] ; then
- KEYWORDS="amd64 arm64 ~loong ppc64 ~riscv ~sparc"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-RESTRICT="test"
-
-BDEPEND="
- app-alternatives/awk
- dev-lang/perl
-"
-
-if [[ ${PV} != 9999 ]] ; then
- BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
-
- IUSE+=" +dist-kernel-cap"
- RDEPEND="
- dist-kernel-cap? ( dist-kernel? (
- <virtual/dist-kernel-${ZFS_KERNEL_DEP}
- ) )
- "
-fi
-
-# Used to suggest matching USE, but without suggesting to disable
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
- "${FILESDIR}"/${PN}-2.2.2-arm64-neon.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-}
-
-pkg_setup() {
- local CONFIG_CHECK="
- EFI_PARTITION
- ZLIB_DEFLATE
- ZLIB_INFLATE
- !DEBUG_LOCK_ALLOC
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- "
- use debug && CONFIG_CHECK+="
- DEBUG_INFO
- FRAME_POINTER
- !DEBUG_INFO_REDUCED
- "
- use rootfs && CONFIG_CHECK+="
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
-
- if [[ ${PV} != 9999 ]] ; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
- fi
-
- linux-mod-r1_pkg_setup
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != 9999 ]] ; then
- # Set module revision number
- sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
- fi
-}
-
-src_configure() {
- use custom-cflags || strip-flags
- filter-ldflags -Wl,*
-
- local myconf=(
- --bindir="${EPREFIX}"/bin
- --sbindir="${EPREFIX}"/sbin
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
-
- # See gentoo.patch
- GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
- TEST_JOBS="$(makeopts_jobs)"
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- emake "${MODULES_MAKEARGS[@]}"
-}
-
-src_install() {
- emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
- modules_post_process
-
- dodoc AUTHORS COPYRIGHT META README.md
-}
-
-_old_layout_cleanup() {
- # new files are just extra/{spl,zfs}.ko with no subdirs.
- local olddir=(
- avl/zavl
- icp/icp
- lua/zlua
- nvpair/znvpair
- spl/spl
- unicode/zunicode
- zcommon/zcommon
- zfs/zfs
- zstd/zzstd
- )
-
- # kernel/module/Kconfig contains possible compressed extentions.
- local kext kextfiles
- for kext in .ko{,.{gz,xz,zst}}; do
- kextfiles+=( "${olddir[@]/%/${kext}}" )
- done
-
- local oldfile oldpath
- for oldfile in "${kextfiles[@]}"; do
- oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
- if [[ -f "${oldpath}" ]]; then
- ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
- rm -rv "${oldpath}" || die
- # we do not remove non-empty directories just for safety in case there's something else.
- # also it may fail if there are both compressed and uncompressed modules installed.
- rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
- fi
- done
-}
-
-pkg_postinst() {
- # Check for old module layout before doing anything else.
- # only attempt layout cleanup if new .ko location is used.
- local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
- # We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
- # if glob expanded -f will do correct file precense check.
- [[ -f ${newko[0]} ]] && _old_layout_cleanup
-
- linux-mod-r1_pkg_postinst
-
- if use x86 || use arm ; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub ; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a new pool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.2.3.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.3.ebuild
deleted file mode 100644
index 903e8e571c0f..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.2.3.ebuild
+++ /dev/null
@@ -1,207 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-MODULES_INITRAMFS_IUSE=+initramfs
-inherit autotools flag-o-matic linux-mod-r1 multiprocessing
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-MODULES_KERNEL_MAX=6.7
-MODULES_KERNEL_MIN=3.10
-
-if [[ ${PV} == 9999 ]] ; then
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
- inherit git-r3
- unset MODULES_KERNEL_MAX
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV=${PV/_rc/-rc}
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${MY_PV}"
-
- ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
- # Increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]] ; then
- KEYWORDS="amd64 arm64 ~loong ppc64 ~riscv ~sparc"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-RESTRICT="test"
-
-BDEPEND="
- app-alternatives/awk
- dev-lang/perl
-"
-
-if [[ ${PV} != 9999 ]] ; then
- BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
-
- IUSE+=" +dist-kernel-cap"
- RDEPEND="
- dist-kernel-cap? ( dist-kernel? (
- <virtual/dist-kernel-${ZFS_KERNEL_DEP}
- ) )
- "
-fi
-
-# Used to suggest matching USE, but without suggesting to disable
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-}
-
-pkg_setup() {
- local CONFIG_CHECK="
- EFI_PARTITION
- ZLIB_DEFLATE
- ZLIB_INFLATE
- !DEBUG_LOCK_ALLOC
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- "
- use debug && CONFIG_CHECK+="
- DEBUG_INFO
- FRAME_POINTER
- !DEBUG_INFO_REDUCED
- "
- use rootfs && CONFIG_CHECK+="
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
-
- if [[ ${PV} != 9999 ]] ; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
- fi
-
- linux-mod-r1_pkg_setup
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != 9999 ]] ; then
- # Set module revision number
- sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
- fi
-}
-
-src_configure() {
- use custom-cflags || strip-flags
- filter-ldflags -Wl,*
-
- local myconf=(
- --bindir="${EPREFIX}"/bin
- --sbindir="${EPREFIX}"/sbin
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
-
- # See gentoo.patch
- GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
- TEST_JOBS="$(makeopts_jobs)"
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- emake "${MODULES_MAKEARGS[@]}"
-}
-
-src_install() {
- emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
- modules_post_process
-
- dodoc AUTHORS COPYRIGHT META README.md
-}
-
-_old_layout_cleanup() {
- # new files are just extra/{spl,zfs}.ko with no subdirs.
- local olddir=(
- avl/zavl
- icp/icp
- lua/zlua
- nvpair/znvpair
- spl/spl
- unicode/zunicode
- zcommon/zcommon
- zfs/zfs
- zstd/zzstd
- )
-
- # kernel/module/Kconfig contains possible compressed extentions.
- local kext kextfiles
- for kext in .ko{,.{gz,xz,zst}}; do
- kextfiles+=( "${olddir[@]/%/${kext}}" )
- done
-
- local oldfile oldpath
- for oldfile in "${kextfiles[@]}"; do
- oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
- if [[ -f "${oldpath}" ]]; then
- ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
- rm -rv "${oldpath}" || die
- # we do not remove non-empty directories just for safety in case there's something else.
- # also it may fail if there are both compressed and uncompressed modules installed.
- rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
- fi
- done
-}
-
-pkg_postinst() {
- # Check for old module layout before doing anything else.
- # only attempt layout cleanup if new .ko location is used.
- local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
- # We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
- # if glob expanded -f will do correct file precense check.
- [[ -f ${newko[0]} ]] && _old_layout_cleanup
-
- linux-mod-r1_pkg_postinst
-
- if use x86 || use arm ; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub ; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a new pool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.2.4.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.2.4.ebuild
deleted file mode 100644
index c3bb25d6fc53..000000000000
--- a/sys-fs/zfs-kmod/zfs-kmod-2.2.4.ebuild
+++ /dev/null
@@ -1,207 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-MODULES_INITRAMFS_IUSE=+initramfs
-inherit autotools flag-o-matic linux-mod-r1 multiprocessing
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://github.com/openzfs/zfs"
-
-MODULES_KERNEL_MAX=6.8
-MODULES_KERNEL_MIN=3.10
-
-if [[ ${PV} == 9999 ]] ; then
- EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
- inherit git-r3
- unset MODULES_KERNEL_MAX
-else
- VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/openzfs.asc
- inherit verify-sig
-
- MY_PV=${PV/_rc/-rc}
- SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
- SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
- S="${WORKDIR}/zfs-${MY_PV}"
-
- ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
- # Increments minor eg 5.14 -> 5.15, and still supports override.
- ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
-
- if [[ ${PV} != *_rc* ]] ; then
- KEYWORDS="amd64 arm64 ~loong ppc64 ~riscv ~sparc"
- fi
-fi
-
-LICENSE="CDDL MIT debug? ( GPL-2+ )"
-SLOT="0/${PVR}"
-IUSE="custom-cflags debug +rootfs"
-RESTRICT="test"
-
-BDEPEND="
- app-alternatives/awk
- dev-lang/perl
-"
-
-if [[ ${PV} != 9999 ]] ; then
- BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
-
- IUSE+=" +dist-kernel-cap"
- RDEPEND="
- dist-kernel-cap? ( dist-kernel? (
- <virtual/dist-kernel-${ZFS_KERNEL_DEP}
- ) )
- "
-fi
-
-# Used to suggest matching USE, but without suggesting to disable
-PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
-)
-
-pkg_pretend() {
- use rootfs || return 0
-}
-
-pkg_setup() {
- local CONFIG_CHECK="
- EFI_PARTITION
- ZLIB_DEFLATE
- ZLIB_INFLATE
- !DEBUG_LOCK_ALLOC
- !PAX_KERNEXEC_PLUGIN_METHOD_OR
- "
- use debug && CONFIG_CHECK+="
- DEBUG_INFO
- FRAME_POINTER
- !DEBUG_INFO_REDUCED
- "
- use rootfs && CONFIG_CHECK+="
- BLK_DEV_INITRD
- DEVTMPFS
- "
-
- kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
-
- if [[ ${PV} != 9999 ]] ; then
- local kv_major_max kv_minor_max zcompat
- zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
- kv_major_max="${zcompat%%.*}"
- zcompat="${zcompat#*.}"
- kv_minor_max="${zcompat%%.*}"
- kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
- "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
- fi
-
- linux-mod-r1_pkg_setup
-}
-
-src_prepare() {
- default
-
- # Run unconditionally (bug #792627)
- eautoreconf
-
- if [[ ${PV} != 9999 ]] ; then
- # Set module revision number
- sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
- fi
-}
-
-src_configure() {
- use custom-cflags || strip-flags
- filter-ldflags -Wl,*
-
- local myconf=(
- --bindir="${EPREFIX}"/bin
- --sbindir="${EPREFIX}"/sbin
- --with-config=kernel
- --with-linux="${KV_DIR}"
- --with-linux-obj="${KV_OUT_DIR}"
- $(use_enable debug)
-
- # See gentoo.patch
- GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
- TEST_JOBS="$(makeopts_jobs)"
- )
-
- econf "${myconf[@]}"
-}
-
-src_compile() {
- emake "${MODULES_MAKEARGS[@]}"
-}
-
-src_install() {
- emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
- modules_post_process
-
- dodoc AUTHORS COPYRIGHT META README.md
-}
-
-_old_layout_cleanup() {
- # new files are just extra/{spl,zfs}.ko with no subdirs.
- local olddir=(
- avl/zavl
- icp/icp
- lua/zlua
- nvpair/znvpair
- spl/spl
- unicode/zunicode
- zcommon/zcommon
- zfs/zfs
- zstd/zzstd
- )
-
- # kernel/module/Kconfig contains possible compressed extentions.
- local kext kextfiles
- for kext in .ko{,.{gz,xz,zst}}; do
- kextfiles+=( "${olddir[@]/%/${kext}}" )
- done
-
- local oldfile oldpath
- for oldfile in "${kextfiles[@]}"; do
- oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
- if [[ -f "${oldpath}" ]]; then
- ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
- rm -rv "${oldpath}" || die
- # we do not remove non-empty directories just for safety in case there's something else.
- # also it may fail if there are both compressed and uncompressed modules installed.
- rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
- fi
- done
-}
-
-pkg_postinst() {
- # Check for old module layout before doing anything else.
- # only attempt layout cleanup if new .ko location is used.
- local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
- # We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
- # if glob expanded -f will do correct file precense check.
- [[ -f ${newko[0]} ]] && _old_layout_cleanup
-
- linux-mod-r1_pkg_postinst
-
- if use x86 || use arm ; then
- ewarn "32-bit kernels will likely require increasing vmalloc to"
- ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
- fi
-
- if has_version sys-boot/grub ; then
- ewarn "This version of OpenZFS includes support for new feature flags"
- ewarn "that are incompatible with previous versions. GRUB2 support for"
- ewarn "/boot with the new feature flags is not yet available."
- ewarn "Do *NOT* upgrade root pools to use the new feature flags."
- ewarn "Any new pools will be created with the new feature flags by default"
- ewarn "and will not be compatible with older versions of OpenZFS. To"
- ewarn "create a new pool that is backward compatible wih GRUB2, use "
- ewarn
- ewarn "zpool create -o compatibility=grub2 ..."
- ewarn
- ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
- fi
-}
^ permalink raw reply related [flat|nested] 21+ messages in thread
end of thread, other threads:[~2024-10-05 6:16 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30 2:51 [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2024-10-05 6:16 Sam James
2024-02-06 1:50 Sam James
2024-01-29 16:08 Sam James
2023-12-28 3:43 Sam James
2023-11-24 21:53 Sam James
2023-07-03 21:03 Sam James
2022-10-04 5:07 Sam James
2022-09-17 22:16 Georgy Yakovlev
2022-03-22 18:01 Sam James
2021-12-20 5:19 Georgy Yakovlev
2021-11-11 2:22 Georgy Yakovlev
2021-11-07 23:59 Georgy Yakovlev
2021-07-02 8:31 Georgy Yakovlev
2021-06-09 5:20 Georgy Yakovlev
2021-06-04 2:14 Georgy Yakovlev
2020-12-18 20:04 Georgy Yakovlev
2020-09-21 23:04 Georgy Yakovlev
2020-09-07 4:04 Georgy Yakovlev
2020-03-30 21:08 Georgy Yakovlev
2019-05-29 22:15 Georgy Yakovlev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox