From e3d2dbb9f73cadd3ecb9a06e9092ce4c602ef14c Mon Sep 17 00:00:00 2001
From: omni <omni+alpine@hack.org>
Date: Thu, 12 Dec 2024 18:49:35 +0000
Subject: [PATCH 1/3] main/zfs: upgrade to 2.2.7

---
 main/zfs/APKBUILD                         | 8 ++++----
 main/zfs/alpine-bash-completion-dir.patch | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/main/zfs/APKBUILD b/main/zfs/APKBUILD
index e8a7add08c77..08b6efc718cc 100644
--- a/main/zfs/APKBUILD
+++ b/main/zfs/APKBUILD
@@ -1,8 +1,8 @@
 # Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
 # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
 pkgname=zfs
-pkgver=2.2.6
-pkgrel=1
+pkgver=2.2.7
+pkgrel=0
 pkgdesc="Advanced filesystem and volume manager"
 url="https://openzfs.org"
 arch="all"
@@ -118,6 +118,6 @@ pyzfs() {
 }
 
 sha512sums="
-c217a3397b67d7239bc30bc492d58fff96bb29c9cf73e390d1787a4fb787cb297557e594a926453fed11faaab80363d40853af271f8ee18ce9a317dfde4c6745  zfs-2.2.6.tar.gz
-96610e902286b80d451a47c7d765e78891c3601b45def7ac83e17bea3f44727dcb8925b7e0be102e71690a20ffa6efe7dee32d11c2eda8f22c1b2d4e00422084  alpine-bash-completion-dir.patch
+6493faa8e31d9c042c4e8f748d32cb9243212fdf4e0341c19568b47bcf302e60beb89940b80374610b71e1dca1ca5813f3efaddbf1a2453ceabb38381165b271  zfs-2.2.7.tar.gz
+91f30fe210288aa652b7cc2074d4bc994e0620f9af148c3007ef6d258e4de5ea9a9fa9813042b1c7a1e5ffb52d621f13b9c433f29ca950aef2d4dc21d9df4e20  alpine-bash-completion-dir.patch
 "
diff --git a/main/zfs/alpine-bash-completion-dir.patch b/main/zfs/alpine-bash-completion-dir.patch
index 7c8c9e302a82..d555045dd480 100644
--- a/main/zfs/alpine-bash-completion-dir.patch
+++ b/main/zfs/alpine-bash-completion-dir.patch
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -140654,6 +140654,7 @@ printf "%s\n" "no" >&6; }
+@@ -100927,6 +100927,7 @@ printf "%s\n" "no" >&6; }
  	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking default bash completion directory" >&5
  printf %s "checking default bash completion directory... " >&6; }
  	case "$VENDOR" in
-- 
GitLab


From 390c6256318d7a91fbbd9072c00c3b5b251931f3 Mon Sep 17 00:00:00 2001
From: omni <omni+alpine@hack.org>
Date: Thu, 12 Dec 2024 18:55:58 +0000
Subject: [PATCH 2/3] main/zfs-lts: upgrade zfs to 2.2.6

---
 ...nux612-avoid-kmem-cache-create-redef.patch |  30 ----
 ...linux612-support-3arg-dequeue-signal.patch | 139 ------------------
 ...inux612-fmode-unsigned-offset-is-now.patch |  43 ------
 ...2-f-version-removed-from-struct-file.patch |  98 ------------
 ...5-linux612-pg-error-flag-was-removed.patch | 125 ----------------
 main/zfs-lts/APKBUILD                         |  19 +--
 6 files changed, 4 insertions(+), 450 deletions(-)
 delete mode 100644 main/zfs-lts/0001-linux612-avoid-kmem-cache-create-redef.patch
 delete mode 100644 main/zfs-lts/0002-linux612-support-3arg-dequeue-signal.patch
 delete mode 100644 main/zfs-lts/0003-linux612-fmode-unsigned-offset-is-now.patch
 delete mode 100644 main/zfs-lts/0004-linux612-f-version-removed-from-struct-file.patch
 delete mode 100644 main/zfs-lts/0005-linux612-pg-error-flag-was-removed.patch

diff --git a/main/zfs-lts/0001-linux612-avoid-kmem-cache-create-redef.patch b/main/zfs-lts/0001-linux612-avoid-kmem-cache-create-redef.patch
deleted file mode 100644
index 9d193377efd7..000000000000
--- a/main/zfs-lts/0001-linux612-avoid-kmem-cache-create-redef.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From c31b18b23c166e3edca65f0a1a295dad3ff88f02 Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 15:43:48 +1000
-Subject: [PATCH] Linux 6.12: avoid kmem_cache_create redefinition
-
-torvalds/linux@b2e7456b5c25 makes kmem_cache_create() a macro, which
-gets in the way of our our own redefinition, so we undef the macro first
-for our own clients. This follows what we did for kmem_cache_alloc(),
-see e951dba48.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- include/os/linux/spl/sys/kmem_cache.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/include/os/linux/spl/sys/kmem_cache.h b/include/os/linux/spl/sys/kmem_cache.h
-index cfdb0ba750f7..71048db4ec5a 100644
---- a/include/os/linux/spl/sys/kmem_cache.h
-+++ b/include/os/linux/spl/sys/kmem_cache.h
-@@ -200,6 +200,7 @@ extern uint64_t spl_kmem_cache_entry_size(kmem_cache_t *cache);
- 
- /* Avoid conflicts with kernel names that might be implemented as macros. */
- #undef	kmem_cache_alloc
-+#undef	kmem_cache_create
- 
- #define	kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl) \
-     spl_kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl)
diff --git a/main/zfs-lts/0002-linux612-support-3arg-dequeue-signal.patch b/main/zfs-lts/0002-linux612-support-3arg-dequeue-signal.patch
deleted file mode 100644
index 94fd942f6c66..000000000000
--- a/main/zfs-lts/0002-linux612-support-3arg-dequeue-signal.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From 08192d12eb06a7d799a0e95e8eb91889b50a6b81 Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 16:06:14 +1000
-Subject: [PATCH] Linux 6.12: support 3arg dequeue_signal() without task param
-
-See torvalds/linux@a2b80ce87a87. It claims the task arg is always
-`current`, and so it is with us, so this is a safe change to make. The
-only spanner is that we also support the older pre-5.17 3-arg
-dequeue_signal() which had different meaning, so we have to check the
-types to get the right one.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- config/kernel-kthread.m4         | 37 ++++++++++++++++++++++++++------
- module/os/linux/spl/spl-thread.c | 18 +++++++++-------
- 2 files changed, 40 insertions(+), 15 deletions(-)
-
-diff --git a/config/kernel-kthread.m4 b/config/kernel-kthread.m4
-index f5b824d7947a..4d580efead6b 100644
---- a/config/kernel-kthread.m4
-+++ b/config/kernel-kthread.m4
-@@ -15,7 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT], [
- 	])
- ])
- 
--AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
-+AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL], [
- 	dnl #
- 	dnl # 5.17 API: enum pid_type * as new 4th dequeue_signal() argument,
- 	dnl # 5768d8906bc23d512b1a736c1e198aa833a6daa4 ("signal: Requeue signals in the appropriate queue")
-@@ -23,12 +23,24 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
- 	dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, kernel_siginfo_t *info);
- 	dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type);
- 	dnl #
-+	dnl # 6.12 API: first arg struct_task* removed
-+	dnl # int dequeue_signal(sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type);
-+	dnl #
- 	AC_MSG_CHECKING([whether dequeue_signal() takes 4 arguments])
--	ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal], [
-+	ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_4arg], [
- 		AC_MSG_RESULT(yes)
--		AC_DEFINE(HAVE_DEQUEUE_SIGNAL_4ARG, 1, [dequeue_signal() takes 4 arguments])
-+		AC_DEFINE(HAVE_DEQUEUE_SIGNAL_4ARG, 1,
-+		    [dequeue_signal() takes 4 arguments])
- 	], [
- 		AC_MSG_RESULT(no)
-+		AC_MSG_CHECKING([whether dequeue_signal() a task argument])
-+		ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_3arg_task], [
-+			AC_MSG_RESULT(yes)
-+			AC_DEFINE(HAVE_DEQUEUE_SIGNAL_3ARG_TASK, 1,
-+			    [dequeue_signal() takes a task argument])
-+		], [
-+			AC_MSG_RESULT(no)
-+		])
- 	])
- ])
- 
-@@ -43,8 +55,19 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT], [
- 	])
- ])
- 
--AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
--	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal], [
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL], [
-+	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_3arg_task], [
-+		#include <linux/sched/signal.h>
-+	], [
-+		struct task_struct *task = NULL;
-+		sigset_t *mask = NULL;
-+		kernel_siginfo_t *info = NULL;
-+		int error __attribute__ ((unused));
-+
-+		error = dequeue_signal(task, mask, info);
-+	])
-+
-+	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_4arg], [
- 		#include <linux/sched/signal.h>
- 	], [
- 		struct task_struct *task = NULL;
-@@ -59,10 +82,10 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
- 
- AC_DEFUN([ZFS_AC_KERNEL_KTHREAD], [
- 	ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT
--	ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG
-+	ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL
- ])
- 
- AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD], [
- 	ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT
--	ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG
-+	ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL
- ])
-diff --git a/module/os/linux/spl/spl-thread.c b/module/os/linux/spl/spl-thread.c
-index 80acd0201b3b..7f74d44f91ff 100644
---- a/module/os/linux/spl/spl-thread.c
-+++ b/module/os/linux/spl/spl-thread.c
-@@ -172,21 +172,23 @@ issig(int why)
- 	if (why != FORREAL)
- 		return (1);
- 
--	struct task_struct *task = current;
- 	spl_kernel_siginfo_t __info;
- 	sigset_t set;
- 	siginitsetinv(&set, 1ULL << (SIGSTOP - 1) | 1ULL << (SIGTSTP - 1));
--	sigorsets(&set, &task->blocked, &set);
-+	sigorsets(&set, &current->blocked, &set);
- 
--	spin_lock_irq(&task->sighand->siglock);
--#ifdef HAVE_DEQUEUE_SIGNAL_4ARG
-+	spin_lock_irq(&current->sighand->siglock);
-+#if defined(HAVE_DEQUEUE_SIGNAL_4ARG)
- 	enum pid_type __type;
--	if (dequeue_signal(task, &set, &__info, &__type) != 0) {
-+	if (dequeue_signal(current, &set, &__info, &__type) != 0) {
-+#elif defined(HAVE_DEQUEUE_SIGNAL_3ARG_TASK)
-+	if (dequeue_signal(current, &set, &__info) != 0) {
- #else
--	if (dequeue_signal(task, &set, &__info) != 0) {
-+	enum pid_type __type;
-+	if (dequeue_signal(&set, &__info, &__type) != 0) {
- #endif
- #ifdef HAVE_SIGNAL_STOP
--		spin_unlock_irq(&task->sighand->siglock);
-+		spin_unlock_irq(&current->sighand->siglock);
- 		kernel_signal_stop();
- #else
- 		if (current->jobctl & JOBCTL_STOP_DEQUEUED)
-@@ -199,7 +201,7 @@ issig(int why)
- 		return (0);
- 	}
- 
--	spin_unlock_irq(&task->sighand->siglock);
-+	spin_unlock_irq(&current->sighand->siglock);
- 
- 	return (1);
- }
diff --git a/main/zfs-lts/0003-linux612-fmode-unsigned-offset-is-now.patch b/main/zfs-lts/0003-linux612-fmode-unsigned-offset-is-now.patch
deleted file mode 100644
index b3834dd1b21d..000000000000
--- a/main/zfs-lts/0003-linux612-fmode-unsigned-offset-is-now.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 997831548a7c76f22b70384e5bf5efc054b732d3 Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 16:19:18 +1000
-Subject: [PATCH] Linux 6.12: FMODE_UNSIGNED_OFFSET is now FOP_UNSIGNED_OFFSET
-
-torvalds/linux@641bb4394f40 asserts that this is a static flag, not
-intended to be variable per-file, so it moves it to
-file_operations instead. We just change our check to follow.
-
-No configure check is necessary because FOP_UNSIGNED_OFFSET didn't exist
-before this commit, and FMODE_UNSIGNED_OFFSET flag is removed in the
-same commit, so there's no chance of a conflict.
-
-It's not clear to me that we need this check at all, as we never set
-this flag on our own files, and I can't see any way that our llseek
-handler could recieve a file from another filesystem. But, the whole
-zpl_llseek() has a number of opportunities for pleasing cleanup that are
-nothing to do with this change, so I'll leave that for a future change.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- include/os/linux/kernel/linux/vfs_compat.h | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h
-index 075b9e111b10..b4767d1ece89 100644
---- a/include/os/linux/kernel/linux/vfs_compat.h
-+++ b/include/os/linux/kernel/linux/vfs_compat.h
-@@ -68,7 +68,11 @@ lseek_execute(
- 	loff_t offset,
- 	loff_t maxsize)
- {
-+#ifdef FMODE_UNSIGNED_OFFSET
- 	if (offset < 0 && !(filp->f_mode & FMODE_UNSIGNED_OFFSET))
-+#else
-+	if (offset < 0 && !(filp->f_op->fop_flags & FOP_UNSIGNED_OFFSET))
-+#endif
- 		return (-EINVAL);
- 
- 	if (offset > maxsize)
diff --git a/main/zfs-lts/0004-linux612-f-version-removed-from-struct-file.patch b/main/zfs-lts/0004-linux612-f-version-removed-from-struct-file.patch
deleted file mode 100644
index fba769df0cb5..000000000000
--- a/main/zfs-lts/0004-linux612-f-version-removed-from-struct-file.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From dbc70ec73aae2e33025e2e3ae650762f250361b9 Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 16:44:01 +1000
-Subject: [PATCH] Linux 6.12: f_version removed from struct file
-
-linux/torvalds@11068e0b64cb removes it, suggesting this was a always
-there as a helper to handle concurrent seeks, which all filesystems now
-handle themselves if necessary.
-
-Without looking into the mechanism, I can imagine how it might have been
-used, but we have always set it to zero and never read from it,
-presumably because we've always tracked per-caller position through the
-znode anyway. So I don't see how there can be any functional change for
-us by removing it. I've stayed conservative though and left it in for
-older kernels, since its clearly not hurting anything there.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- config/kernel-file.m4                      | 31 ++++++++++++++++++++++
- config/kernel.m4                           |  2 ++
- include/os/linux/kernel/linux/vfs_compat.h |  2 ++
- 3 files changed, 35 insertions(+)
- create mode 100644 config/kernel-file.m4
-
-diff --git a/config/kernel-file.m4 b/config/kernel-file.m4
-new file mode 100644
-index 000000000000..31252544c745
---- /dev/null
-+++ b/config/kernel-file.m4
-@@ -0,0 +1,31 @@
-+dnl #
-+dnl # 6.12 removed f_version from struct file
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_FILE_F_VERSION], [
-+	ZFS_LINUX_TEST_SRC([file_f_version], [
-+		#include <linux/fs.h>
-+
-+		static const struct f __attribute__((unused)) = {
-+			.f_version = 0;
-+		};
-+	])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_FILE_F_VERSION], [
-+	AC_MSG_CHECKING([whether file->f_version exists])
-+	ZFS_LINUX_TEST_RESULT([file_f_version], [
-+		AC_MSG_RESULT(yes)
-+		AC_DEFINE(HAVE_FILE_F_VERSION, 1,
-+		    [file->f_version exists])
-+	], [
-+		AC_MSG_RESULT(no)
-+	])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_FILE], [
-+	ZFS_AC_KERNEL_FILE_F_VERSION
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_FILE], [
-+	ZFS_AC_KERNEL_SRC_FILE_F_VERSION
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index 465f69b72b36..640dbbaeff7b 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -125,6 +125,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
- 	ZFS_AC_KERNEL_SRC_SYNC_BDEV
- 	ZFS_AC_KERNEL_SRC_MM_PAGE_SIZE
- 	ZFS_AC_KERNEL_SRC_MM_PAGE_MAPPING
-+	ZFS_AC_KERNEL_SRC_FILE
- 	case "$host_cpu" in
- 		powerpc*)
- 			ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE
-@@ -234,6 +235,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
- 	ZFS_AC_KERNEL_SYNC_BDEV
- 	ZFS_AC_KERNEL_MM_PAGE_SIZE
- 	ZFS_AC_KERNEL_MM_PAGE_MAPPING
-+	ZFS_AC_KERNEL_FILE
- 	case "$host_cpu" in
- 		powerpc*)
- 			ZFS_AC_KERNEL_CPU_HAS_FEATURE
-diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h
-index b4767d1ece89..3ed456dbf4c8 100644
---- a/include/os/linux/kernel/linux/vfs_compat.h
-+++ b/include/os/linux/kernel/linux/vfs_compat.h
-@@ -81,7 +81,9 @@ lseek_execute(
- 	if (offset != filp->f_pos) {
- 		spin_lock(&filp->f_lock);
- 		filp->f_pos = offset;
-+#ifdef HAVE_FILE_F_VERSION
- 		filp->f_version = 0;
-+#endif
- 		spin_unlock(&filp->f_lock);
- 	}
- 
diff --git a/main/zfs-lts/0005-linux612-pg-error-flag-was-removed.patch b/main/zfs-lts/0005-linux612-pg-error-flag-was-removed.patch
deleted file mode 100644
index 7d35ea3c6bf3..000000000000
--- a/main/zfs-lts/0005-linux612-pg-error-flag-was-removed.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From 01e06ed89d3547c873e704499be86dac8310e26c Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 17:17:00 +1000
-Subject: [PATCH] Linux 6.12: PG_error flag was removed
-
-torvalds/linux@09022bc196d2 removes the flag, and the corresponding
-SetPageError() and ClearPageError() macros, with no replacement offered.
-
-Going back through the upstream history, use of this flag has been
-gradually removed over the last year as part of the long tail of
-converting everything to folios. Interesting tidbit comments from
-torvalds/linux@29e9412b250e and torvalds/linux@420e05d0de18 suggest that
-this flag has not been used meaningfully since page writeback failures
-started being recorded in errseq_t instead (the whole "fsyncgate" thing,
-~2017, around torvalds/linux@8ed1e46aaf1b).
-
-Given that, it's possible that since perhaps Linux 4.13 we haven't been
-getting anything by setting the flag. I don't know if that's true and/or
-if there's something we should be doing instead, but my gut feel is that
-its probably fine we only use the page cache as a proxy to allow mmap()
-to work, rather than backing IO with it.
-
-As such, I'm expecting that removing this will do no harm, but I'm
-leaving it in for older kernels to maintain status quo, and if there is
-an overall better way, that is left for a future change.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- config/kernel-mm-page-flags.m4            | 24 +++++++++++++++++++++++
- config/kernel.m4                          |  2 ++
- include/os/linux/kernel/linux/mm_compat.h | 14 +++++++++++++
- module/os/linux/zfs/zfs_znode_os.c        |  1 +
- 4 files changed, 41 insertions(+)
- create mode 100644 config/kernel-mm-page-flags.m4
-
-diff --git a/config/kernel-mm-page-flags.m4 b/config/kernel-mm-page-flags.m4
-new file mode 100644
-index 000000000000..b1277118305d
---- /dev/null
-+++ b/config/kernel-mm-page-flags.m4
-@@ -0,0 +1,24 @@
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR], [
-+	ZFS_LINUX_TEST_SRC([mm_page_flag_error], [
-+		#include <linux/page-flags.h>
-+
-+		static enum pageflags
-+		    test_flag __attribute__((unused)) = PG_error;
-+	])
-+])
-+AC_DEFUN([ZFS_AC_KERNEL_MM_PAGE_FLAG_ERROR], [
-+	AC_MSG_CHECKING([whether PG_error flag is available])
-+	ZFS_LINUX_TEST_RESULT([mm_page_flag_error], [
-+		AC_MSG_RESULT(yes)
-+		AC_DEFINE(HAVE_MM_PAGE_FLAG_ERROR, 1, [PG_error flag is available])
-+	],[
-+		AC_MSG_RESULT(no)
-+	])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAGS], [
-+	ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR
-+])
-+AC_DEFUN([ZFS_AC_KERNEL_MM_PAGE_FLAGS], [
-+	ZFS_AC_KERNEL_MM_PAGE_FLAG_ERROR
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index 640dbbaeff7b..df3bf5293529 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -123,6 +123,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
- 	ZFS_AC_KERNEL_SRC_PROC_HANDLER_CTL_TABLE_CONST
- 	ZFS_AC_KERNEL_SRC_COPY_SPLICE_READ
- 	ZFS_AC_KERNEL_SRC_SYNC_BDEV
-+	ZFS_AC_KERNEL_SRC_MM_PAGE_FLAGS
- 	ZFS_AC_KERNEL_SRC_MM_PAGE_SIZE
- 	ZFS_AC_KERNEL_SRC_MM_PAGE_MAPPING
- 	ZFS_AC_KERNEL_SRC_FILE
-@@ -232,6 +233,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
- 	ZFS_AC_KERNEL_PROC_HANDLER_CTL_TABLE_CONST
- 	ZFS_AC_KERNEL_COPY_SPLICE_READ
- 	ZFS_AC_KERNEL_SYNC_BDEV
-+	ZFS_AC_KERNEL_MM_PAGE_FLAGS
- 	ZFS_AC_KERNEL_MM_PAGE_SIZE
- 	ZFS_AC_KERNEL_MM_PAGE_MAPPING
- 	ZFS_AC_KERNEL_FILE
-diff --git a/include/os/linux/kernel/linux/mm_compat.h b/include/os/linux/kernel/linux/mm_compat.h
-index 817f6df422de..4cdc0e099994 100644
---- a/include/os/linux/kernel/linux/mm_compat.h
-+++ b/include/os/linux/kernel/linux/mm_compat.h
-@@ -40,4 +40,18 @@
- #define	page_mapping(p) folio_mapping(page_folio(p))
- #endif
- 
-+/*
-+ * 6.12 removed PG_error, SetPageError and ClearPageError, with no direct
-+ * replacement, because page writeback errors are recorded elsewhere. Since we
-+ * only use the page cache to assist with mmap(), never directly backing it
-+ * with IO, it shouldn't be possible for this condition to occur on our pages
-+ * anyway, even if this is the right way to report it. So it should be safe
-+ * to remove, but for avoidance of doubt, we make it a no-op on 6.12 and leave
-+ * it for everything else.
-+ */
-+#ifndef HAVE_MM_PAGE_FLAG_ERROR
-+#define	SetPageError(p)		do {} while (0)
-+#define	ClearPageError(p)	do {} while (0)
-+#endif
-+
- #endif /* _ZFS_MM_COMPAT_H */
-diff --git a/module/os/linux/zfs/zfs_znode.c b/module/os/linux/zfs/zfs_znode.c
-index e135f9044679..bbaca2f58394 100644
---- a/module/os/linux/zfs/zfs_znode.c
-+++ b/module/os/linux/zfs/zfs_znode.c
-@@ -58,6 +58,9 @@
- #include <sys/sa.h>
- #include <sys/zfs_sa.h>
- #include <sys/zfs_stat.h>
-+#ifdef _KERNEL
-+#include <linux/mm_compat.h>
-+#endif
- 
- #include "zfs_prop.h"
- #include "zfs_comutil.h"
diff --git a/main/zfs-lts/APKBUILD b/main/zfs-lts/APKBUILD
index 98758653b53d..a8be0a462eb2 100644
--- a/main/zfs-lts/APKBUILD
+++ b/main/zfs-lts/APKBUILD
@@ -3,8 +3,8 @@
 
 # when changing _ver we *must* bump _rel
 _name=zfs
-_ver=2.2.6
-_rel=0
+_ver=2.2.7
+_rel=1
 # when changing _kver make sure _krel=0 & _rel=0
 _flavor=${FLAVOR:-lts}
 _kpkg=linux-$_flavor
@@ -37,13 +37,7 @@ depends_dev="glib-dev e2fsprogs-dev util-linux-dev libtirpc-dev
 makedepends="$depends_dev linux-headers"
 install_if="zfs $_kpkg=$_kpkgver"
 subpackages="$pkgname-dev"
-source="https://github.com/openzfs/zfs/releases/download/zfs-$_ver/zfs-$_ver.tar.gz
-	0001-linux612-avoid-kmem-cache-create-redef.patch
-	0002-linux612-support-3arg-dequeue-signal.patch
-	0003-linux612-fmode-unsigned-offset-is-now.patch
-	0004-linux612-f-version-removed-from-struct-file.patch
-	0005-linux612-pg-error-flag-was-removed.patch
-	"
+source="https://github.com/openzfs/zfs/releases/download/zfs-$_ver/zfs-$_ver.tar.gz"
 
 builddir="$srcdir/$_name-$_ver"
 options="!check"
@@ -117,10 +111,5 @@ dev() {
 }
 
 sha512sums="
-c217a3397b67d7239bc30bc492d58fff96bb29c9cf73e390d1787a4fb787cb297557e594a926453fed11faaab80363d40853af271f8ee18ce9a317dfde4c6745  zfs-2.2.6.tar.gz
-3c0fbd662848981151c68215ac9567f2c0660bdd7aa6fa4891a4476526983c2ab91f385bb7095593e86c76182e436d4c1f7c41a526e82de470affcb15870cb28  0001-linux612-avoid-kmem-cache-create-redef.patch
-25a078527c0921dd1b4c78eae9f6464f0fe54bc336879a347cfeb2a4950bec4eaef0c7a465d2f45bd2acabae7b86b067249fb3047c0d544d43fe337a0f3e99b3  0002-linux612-support-3arg-dequeue-signal.patch
-3920f05e3576205f2b01de3f8d32c03a446c24339265805721b819e51f8bc73912e873a3ec68467213d7f07fb4939e732dd406a6c5d1cea3f3ea0663de48961b  0003-linux612-fmode-unsigned-offset-is-now.patch
-4f23bb4b4ab1339a5deabba29e6c2d9724af0fdc929afe962e7c3179b26c66639759f980bf4107dc9d148382f1fdf5aba84403f6968e663cde57a7facc06ab83  0004-linux612-f-version-removed-from-struct-file.patch
-a843a4d6fc43410fc5eda7eb7b5eea5a0f131aa5d664ec418a0b1308ee6d62f2458d821924c57710332ea40e2c8071d37fb3f9c24b8f93432423d1e6adf3acf4  0005-linux612-pg-error-flag-was-removed.patch
+6493faa8e31d9c042c4e8f748d32cb9243212fdf4e0341c19568b47bcf302e60beb89940b80374610b71e1dca1ca5813f3efaddbf1a2453ceabb38381165b271  zfs-2.2.7.tar.gz
 "
-- 
GitLab


From 32bb47cf2aa36c5a75222e2d80bc05e3acaa677a Mon Sep 17 00:00:00 2001
From: omni <omni+alpine@hack.org>
Date: Thu, 12 Dec 2024 18:56:59 +0000
Subject: [PATCH 3/3] main/zfs-rpi: upgrade zfs to 2.2.7

---
 ...nux612-avoid-kmem-cache-create-redef.patch |  30 ----
 ...linux612-support-3arg-dequeue-signal.patch | 139 ------------------
 ...inux612-fmode-unsigned-offset-is-now.patch |  43 ------
 ...2-f-version-removed-from-struct-file.patch |  98 ------------
 ...5-linux612-pg-error-flag-was-removed.patch | 125 ----------------
 main/zfs-rpi/APKBUILD                         |  19 +--
 6 files changed, 4 insertions(+), 450 deletions(-)
 delete mode 100644 main/zfs-rpi/0001-linux612-avoid-kmem-cache-create-redef.patch
 delete mode 100644 main/zfs-rpi/0002-linux612-support-3arg-dequeue-signal.patch
 delete mode 100644 main/zfs-rpi/0003-linux612-fmode-unsigned-offset-is-now.patch
 delete mode 100644 main/zfs-rpi/0004-linux612-f-version-removed-from-struct-file.patch
 delete mode 100644 main/zfs-rpi/0005-linux612-pg-error-flag-was-removed.patch

diff --git a/main/zfs-rpi/0001-linux612-avoid-kmem-cache-create-redef.patch b/main/zfs-rpi/0001-linux612-avoid-kmem-cache-create-redef.patch
deleted file mode 100644
index 9d193377efd7..000000000000
--- a/main/zfs-rpi/0001-linux612-avoid-kmem-cache-create-redef.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From c31b18b23c166e3edca65f0a1a295dad3ff88f02 Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 15:43:48 +1000
-Subject: [PATCH] Linux 6.12: avoid kmem_cache_create redefinition
-
-torvalds/linux@b2e7456b5c25 makes kmem_cache_create() a macro, which
-gets in the way of our our own redefinition, so we undef the macro first
-for our own clients. This follows what we did for kmem_cache_alloc(),
-see e951dba48.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- include/os/linux/spl/sys/kmem_cache.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/include/os/linux/spl/sys/kmem_cache.h b/include/os/linux/spl/sys/kmem_cache.h
-index cfdb0ba750f7..71048db4ec5a 100644
---- a/include/os/linux/spl/sys/kmem_cache.h
-+++ b/include/os/linux/spl/sys/kmem_cache.h
-@@ -200,6 +200,7 @@ extern uint64_t spl_kmem_cache_entry_size(kmem_cache_t *cache);
- 
- /* Avoid conflicts with kernel names that might be implemented as macros. */
- #undef	kmem_cache_alloc
-+#undef	kmem_cache_create
- 
- #define	kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl) \
-     spl_kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl)
diff --git a/main/zfs-rpi/0002-linux612-support-3arg-dequeue-signal.patch b/main/zfs-rpi/0002-linux612-support-3arg-dequeue-signal.patch
deleted file mode 100644
index 94fd942f6c66..000000000000
--- a/main/zfs-rpi/0002-linux612-support-3arg-dequeue-signal.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From 08192d12eb06a7d799a0e95e8eb91889b50a6b81 Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 16:06:14 +1000
-Subject: [PATCH] Linux 6.12: support 3arg dequeue_signal() without task param
-
-See torvalds/linux@a2b80ce87a87. It claims the task arg is always
-`current`, and so it is with us, so this is a safe change to make. The
-only spanner is that we also support the older pre-5.17 3-arg
-dequeue_signal() which had different meaning, so we have to check the
-types to get the right one.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- config/kernel-kthread.m4         | 37 ++++++++++++++++++++++++++------
- module/os/linux/spl/spl-thread.c | 18 +++++++++-------
- 2 files changed, 40 insertions(+), 15 deletions(-)
-
-diff --git a/config/kernel-kthread.m4 b/config/kernel-kthread.m4
-index f5b824d7947a..4d580efead6b 100644
---- a/config/kernel-kthread.m4
-+++ b/config/kernel-kthread.m4
-@@ -15,7 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT], [
- 	])
- ])
- 
--AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
-+AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL], [
- 	dnl #
- 	dnl # 5.17 API: enum pid_type * as new 4th dequeue_signal() argument,
- 	dnl # 5768d8906bc23d512b1a736c1e198aa833a6daa4 ("signal: Requeue signals in the appropriate queue")
-@@ -23,12 +23,24 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
- 	dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, kernel_siginfo_t *info);
- 	dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type);
- 	dnl #
-+	dnl # 6.12 API: first arg struct_task* removed
-+	dnl # int dequeue_signal(sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type);
-+	dnl #
- 	AC_MSG_CHECKING([whether dequeue_signal() takes 4 arguments])
--	ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal], [
-+	ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_4arg], [
- 		AC_MSG_RESULT(yes)
--		AC_DEFINE(HAVE_DEQUEUE_SIGNAL_4ARG, 1, [dequeue_signal() takes 4 arguments])
-+		AC_DEFINE(HAVE_DEQUEUE_SIGNAL_4ARG, 1,
-+		    [dequeue_signal() takes 4 arguments])
- 	], [
- 		AC_MSG_RESULT(no)
-+		AC_MSG_CHECKING([whether dequeue_signal() a task argument])
-+		ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_3arg_task], [
-+			AC_MSG_RESULT(yes)
-+			AC_DEFINE(HAVE_DEQUEUE_SIGNAL_3ARG_TASK, 1,
-+			    [dequeue_signal() takes a task argument])
-+		], [
-+			AC_MSG_RESULT(no)
-+		])
- 	])
- ])
- 
-@@ -43,8 +55,19 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT], [
- 	])
- ])
- 
--AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
--	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal], [
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL], [
-+	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_3arg_task], [
-+		#include <linux/sched/signal.h>
-+	], [
-+		struct task_struct *task = NULL;
-+		sigset_t *mask = NULL;
-+		kernel_siginfo_t *info = NULL;
-+		int error __attribute__ ((unused));
-+
-+		error = dequeue_signal(task, mask, info);
-+	])
-+
-+	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_4arg], [
- 		#include <linux/sched/signal.h>
- 	], [
- 		struct task_struct *task = NULL;
-@@ -59,10 +82,10 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
- 
- AC_DEFUN([ZFS_AC_KERNEL_KTHREAD], [
- 	ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT
--	ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG
-+	ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL
- ])
- 
- AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD], [
- 	ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT
--	ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG
-+	ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL
- ])
-diff --git a/module/os/linux/spl/spl-thread.c b/module/os/linux/spl/spl-thread.c
-index 80acd0201b3b..7f74d44f91ff 100644
---- a/module/os/linux/spl/spl-thread.c
-+++ b/module/os/linux/spl/spl-thread.c
-@@ -172,21 +172,23 @@ issig(int why)
- 	if (why != FORREAL)
- 		return (1);
- 
--	struct task_struct *task = current;
- 	spl_kernel_siginfo_t __info;
- 	sigset_t set;
- 	siginitsetinv(&set, 1ULL << (SIGSTOP - 1) | 1ULL << (SIGTSTP - 1));
--	sigorsets(&set, &task->blocked, &set);
-+	sigorsets(&set, &current->blocked, &set);
- 
--	spin_lock_irq(&task->sighand->siglock);
--#ifdef HAVE_DEQUEUE_SIGNAL_4ARG
-+	spin_lock_irq(&current->sighand->siglock);
-+#if defined(HAVE_DEQUEUE_SIGNAL_4ARG)
- 	enum pid_type __type;
--	if (dequeue_signal(task, &set, &__info, &__type) != 0) {
-+	if (dequeue_signal(current, &set, &__info, &__type) != 0) {
-+#elif defined(HAVE_DEQUEUE_SIGNAL_3ARG_TASK)
-+	if (dequeue_signal(current, &set, &__info) != 0) {
- #else
--	if (dequeue_signal(task, &set, &__info) != 0) {
-+	enum pid_type __type;
-+	if (dequeue_signal(&set, &__info, &__type) != 0) {
- #endif
- #ifdef HAVE_SIGNAL_STOP
--		spin_unlock_irq(&task->sighand->siglock);
-+		spin_unlock_irq(&current->sighand->siglock);
- 		kernel_signal_stop();
- #else
- 		if (current->jobctl & JOBCTL_STOP_DEQUEUED)
-@@ -199,7 +201,7 @@ issig(int why)
- 		return (0);
- 	}
- 
--	spin_unlock_irq(&task->sighand->siglock);
-+	spin_unlock_irq(&current->sighand->siglock);
- 
- 	return (1);
- }
diff --git a/main/zfs-rpi/0003-linux612-fmode-unsigned-offset-is-now.patch b/main/zfs-rpi/0003-linux612-fmode-unsigned-offset-is-now.patch
deleted file mode 100644
index b3834dd1b21d..000000000000
--- a/main/zfs-rpi/0003-linux612-fmode-unsigned-offset-is-now.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 997831548a7c76f22b70384e5bf5efc054b732d3 Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 16:19:18 +1000
-Subject: [PATCH] Linux 6.12: FMODE_UNSIGNED_OFFSET is now FOP_UNSIGNED_OFFSET
-
-torvalds/linux@641bb4394f40 asserts that this is a static flag, not
-intended to be variable per-file, so it moves it to
-file_operations instead. We just change our check to follow.
-
-No configure check is necessary because FOP_UNSIGNED_OFFSET didn't exist
-before this commit, and FMODE_UNSIGNED_OFFSET flag is removed in the
-same commit, so there's no chance of a conflict.
-
-It's not clear to me that we need this check at all, as we never set
-this flag on our own files, and I can't see any way that our llseek
-handler could recieve a file from another filesystem. But, the whole
-zpl_llseek() has a number of opportunities for pleasing cleanup that are
-nothing to do with this change, so I'll leave that for a future change.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- include/os/linux/kernel/linux/vfs_compat.h | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h
-index 075b9e111b10..b4767d1ece89 100644
---- a/include/os/linux/kernel/linux/vfs_compat.h
-+++ b/include/os/linux/kernel/linux/vfs_compat.h
-@@ -68,7 +68,11 @@ lseek_execute(
- 	loff_t offset,
- 	loff_t maxsize)
- {
-+#ifdef FMODE_UNSIGNED_OFFSET
- 	if (offset < 0 && !(filp->f_mode & FMODE_UNSIGNED_OFFSET))
-+#else
-+	if (offset < 0 && !(filp->f_op->fop_flags & FOP_UNSIGNED_OFFSET))
-+#endif
- 		return (-EINVAL);
- 
- 	if (offset > maxsize)
diff --git a/main/zfs-rpi/0004-linux612-f-version-removed-from-struct-file.patch b/main/zfs-rpi/0004-linux612-f-version-removed-from-struct-file.patch
deleted file mode 100644
index fba769df0cb5..000000000000
--- a/main/zfs-rpi/0004-linux612-f-version-removed-from-struct-file.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From dbc70ec73aae2e33025e2e3ae650762f250361b9 Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 16:44:01 +1000
-Subject: [PATCH] Linux 6.12: f_version removed from struct file
-
-linux/torvalds@11068e0b64cb removes it, suggesting this was a always
-there as a helper to handle concurrent seeks, which all filesystems now
-handle themselves if necessary.
-
-Without looking into the mechanism, I can imagine how it might have been
-used, but we have always set it to zero and never read from it,
-presumably because we've always tracked per-caller position through the
-znode anyway. So I don't see how there can be any functional change for
-us by removing it. I've stayed conservative though and left it in for
-older kernels, since its clearly not hurting anything there.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- config/kernel-file.m4                      | 31 ++++++++++++++++++++++
- config/kernel.m4                           |  2 ++
- include/os/linux/kernel/linux/vfs_compat.h |  2 ++
- 3 files changed, 35 insertions(+)
- create mode 100644 config/kernel-file.m4
-
-diff --git a/config/kernel-file.m4 b/config/kernel-file.m4
-new file mode 100644
-index 000000000000..31252544c745
---- /dev/null
-+++ b/config/kernel-file.m4
-@@ -0,0 +1,31 @@
-+dnl #
-+dnl # 6.12 removed f_version from struct file
-+dnl #
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_FILE_F_VERSION], [
-+	ZFS_LINUX_TEST_SRC([file_f_version], [
-+		#include <linux/fs.h>
-+
-+		static const struct f __attribute__((unused)) = {
-+			.f_version = 0;
-+		};
-+	])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_FILE_F_VERSION], [
-+	AC_MSG_CHECKING([whether file->f_version exists])
-+	ZFS_LINUX_TEST_RESULT([file_f_version], [
-+		AC_MSG_RESULT(yes)
-+		AC_DEFINE(HAVE_FILE_F_VERSION, 1,
-+		    [file->f_version exists])
-+	], [
-+		AC_MSG_RESULT(no)
-+	])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_FILE], [
-+	ZFS_AC_KERNEL_FILE_F_VERSION
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_FILE], [
-+	ZFS_AC_KERNEL_SRC_FILE_F_VERSION
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index 465f69b72b36..640dbbaeff7b 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -125,6 +125,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
- 	ZFS_AC_KERNEL_SRC_SYNC_BDEV
- 	ZFS_AC_KERNEL_SRC_MM_PAGE_SIZE
- 	ZFS_AC_KERNEL_SRC_MM_PAGE_MAPPING
-+	ZFS_AC_KERNEL_SRC_FILE
- 	case "$host_cpu" in
- 		powerpc*)
- 			ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE
-@@ -234,6 +235,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
- 	ZFS_AC_KERNEL_SYNC_BDEV
- 	ZFS_AC_KERNEL_MM_PAGE_SIZE
- 	ZFS_AC_KERNEL_MM_PAGE_MAPPING
-+	ZFS_AC_KERNEL_FILE
- 	case "$host_cpu" in
- 		powerpc*)
- 			ZFS_AC_KERNEL_CPU_HAS_FEATURE
-diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h
-index b4767d1ece89..3ed456dbf4c8 100644
---- a/include/os/linux/kernel/linux/vfs_compat.h
-+++ b/include/os/linux/kernel/linux/vfs_compat.h
-@@ -81,7 +81,9 @@ lseek_execute(
- 	if (offset != filp->f_pos) {
- 		spin_lock(&filp->f_lock);
- 		filp->f_pos = offset;
-+#ifdef HAVE_FILE_F_VERSION
- 		filp->f_version = 0;
-+#endif
- 		spin_unlock(&filp->f_lock);
- 	}
- 
diff --git a/main/zfs-rpi/0005-linux612-pg-error-flag-was-removed.patch b/main/zfs-rpi/0005-linux612-pg-error-flag-was-removed.patch
deleted file mode 100644
index 7d35ea3c6bf3..000000000000
--- a/main/zfs-rpi/0005-linux612-pg-error-flag-was-removed.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From 01e06ed89d3547c873e704499be86dac8310e26c Mon Sep 17 00:00:00 2001
-From: Rob Norris <robn@despairlabs.com>
-Date: Tue, 24 Sep 2024 17:17:00 +1000
-Subject: [PATCH] Linux 6.12: PG_error flag was removed
-
-torvalds/linux@09022bc196d2 removes the flag, and the corresponding
-SetPageError() and ClearPageError() macros, with no replacement offered.
-
-Going back through the upstream history, use of this flag has been
-gradually removed over the last year as part of the long tail of
-converting everything to folios. Interesting tidbit comments from
-torvalds/linux@29e9412b250e and torvalds/linux@420e05d0de18 suggest that
-this flag has not been used meaningfully since page writeback failures
-started being recorded in errseq_t instead (the whole "fsyncgate" thing,
-~2017, around torvalds/linux@8ed1e46aaf1b).
-
-Given that, it's possible that since perhaps Linux 4.13 we haven't been
-getting anything by setting the flag. I don't know if that's true and/or
-if there's something we should be doing instead, but my gut feel is that
-its probably fine we only use the page cache as a proxy to allow mmap()
-to work, rather than backing IO with it.
-
-As such, I'm expecting that removing this will do no harm, but I'm
-leaving it in for older kernels to maintain status quo, and if there is
-an overall better way, that is left for a future change.
-
-Sponsored-by: https://despairlabs.com/sponsor/
-Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
-Signed-off-by: Rob Norris <robn@despairlabs.com>
-Closes #16582
----
- config/kernel-mm-page-flags.m4            | 24 +++++++++++++++++++++++
- config/kernel.m4                          |  2 ++
- include/os/linux/kernel/linux/mm_compat.h | 14 +++++++++++++
- module/os/linux/zfs/zfs_znode_os.c        |  1 +
- 4 files changed, 41 insertions(+)
- create mode 100644 config/kernel-mm-page-flags.m4
-
-diff --git a/config/kernel-mm-page-flags.m4 b/config/kernel-mm-page-flags.m4
-new file mode 100644
-index 000000000000..b1277118305d
---- /dev/null
-+++ b/config/kernel-mm-page-flags.m4
-@@ -0,0 +1,24 @@
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR], [
-+	ZFS_LINUX_TEST_SRC([mm_page_flag_error], [
-+		#include <linux/page-flags.h>
-+
-+		static enum pageflags
-+		    test_flag __attribute__((unused)) = PG_error;
-+	])
-+])
-+AC_DEFUN([ZFS_AC_KERNEL_MM_PAGE_FLAG_ERROR], [
-+	AC_MSG_CHECKING([whether PG_error flag is available])
-+	ZFS_LINUX_TEST_RESULT([mm_page_flag_error], [
-+		AC_MSG_RESULT(yes)
-+		AC_DEFINE(HAVE_MM_PAGE_FLAG_ERROR, 1, [PG_error flag is available])
-+	],[
-+		AC_MSG_RESULT(no)
-+	])
-+])
-+
-+AC_DEFUN([ZFS_AC_KERNEL_SRC_MM_PAGE_FLAGS], [
-+	ZFS_AC_KERNEL_SRC_MM_PAGE_FLAG_ERROR
-+])
-+AC_DEFUN([ZFS_AC_KERNEL_MM_PAGE_FLAGS], [
-+	ZFS_AC_KERNEL_MM_PAGE_FLAG_ERROR
-+])
-diff --git a/config/kernel.m4 b/config/kernel.m4
-index 640dbbaeff7b..df3bf5293529 100644
---- a/config/kernel.m4
-+++ b/config/kernel.m4
-@@ -123,6 +123,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
- 	ZFS_AC_KERNEL_SRC_PROC_HANDLER_CTL_TABLE_CONST
- 	ZFS_AC_KERNEL_SRC_COPY_SPLICE_READ
- 	ZFS_AC_KERNEL_SRC_SYNC_BDEV
-+	ZFS_AC_KERNEL_SRC_MM_PAGE_FLAGS
- 	ZFS_AC_KERNEL_SRC_MM_PAGE_SIZE
- 	ZFS_AC_KERNEL_SRC_MM_PAGE_MAPPING
- 	ZFS_AC_KERNEL_SRC_FILE
-@@ -232,6 +233,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
- 	ZFS_AC_KERNEL_PROC_HANDLER_CTL_TABLE_CONST
- 	ZFS_AC_KERNEL_COPY_SPLICE_READ
- 	ZFS_AC_KERNEL_SYNC_BDEV
-+	ZFS_AC_KERNEL_MM_PAGE_FLAGS
- 	ZFS_AC_KERNEL_MM_PAGE_SIZE
- 	ZFS_AC_KERNEL_MM_PAGE_MAPPING
- 	ZFS_AC_KERNEL_FILE
-diff --git a/include/os/linux/kernel/linux/mm_compat.h b/include/os/linux/kernel/linux/mm_compat.h
-index 817f6df422de..4cdc0e099994 100644
---- a/include/os/linux/kernel/linux/mm_compat.h
-+++ b/include/os/linux/kernel/linux/mm_compat.h
-@@ -40,4 +40,18 @@
- #define	page_mapping(p) folio_mapping(page_folio(p))
- #endif
- 
-+/*
-+ * 6.12 removed PG_error, SetPageError and ClearPageError, with no direct
-+ * replacement, because page writeback errors are recorded elsewhere. Since we
-+ * only use the page cache to assist with mmap(), never directly backing it
-+ * with IO, it shouldn't be possible for this condition to occur on our pages
-+ * anyway, even if this is the right way to report it. So it should be safe
-+ * to remove, but for avoidance of doubt, we make it a no-op on 6.12 and leave
-+ * it for everything else.
-+ */
-+#ifndef HAVE_MM_PAGE_FLAG_ERROR
-+#define	SetPageError(p)		do {} while (0)
-+#define	ClearPageError(p)	do {} while (0)
-+#endif
-+
- #endif /* _ZFS_MM_COMPAT_H */
-diff --git a/module/os/linux/zfs/zfs_znode.c b/module/os/linux/zfs/zfs_znode.c
-index e135f9044679..bbaca2f58394 100644
---- a/module/os/linux/zfs/zfs_znode.c
-+++ b/module/os/linux/zfs/zfs_znode.c
-@@ -58,6 +58,9 @@
- #include <sys/sa.h>
- #include <sys/zfs_sa.h>
- #include <sys/zfs_stat.h>
-+#ifdef _KERNEL
-+#include <linux/mm_compat.h>
-+#endif
- 
- #include "zfs_prop.h"
- #include "zfs_comutil.h"
diff --git a/main/zfs-rpi/APKBUILD b/main/zfs-rpi/APKBUILD
index 73db056c5d0b..13fbd5790f53 100644
--- a/main/zfs-rpi/APKBUILD
+++ b/main/zfs-rpi/APKBUILD
@@ -3,8 +3,8 @@
 
 # when changing _ver we *must* bump _rel
 _name=zfs
-_ver=2.2.6
-_rel=0
+_ver=2.2.7
+_rel=1
 # when changing _kver/_krel make sure _rel=0
 _flavor=${FLAVOR:-rpi}
 _kpkg=linux-$_flavor
@@ -38,13 +38,7 @@ depends_dev="glib-dev e2fsprogs-dev util-linux-dev libtirpc-dev
 makedepends="$depends_dev linux-headers xz"
 install_if="zfs $_kpkg=$_kpkgver"
 subpackages="$pkgname-dev"
-source="https://github.com/openzfs/zfs/releases/download/zfs-$_ver/zfs-$_ver.tar.gz
-	0001-linux612-avoid-kmem-cache-create-redef.patch
-	0002-linux612-support-3arg-dequeue-signal.patch
-	0003-linux612-fmode-unsigned-offset-is-now.patch
-	0004-linux612-f-version-removed-from-struct-file.patch
-	0005-linux612-pg-error-flag-was-removed.patch
-	"
+source="https://github.com/openzfs/zfs/releases/download/zfs-$_ver/zfs-$_ver.tar.gz"
 
 builddir="$srcdir/$_name-$_ver"
 options="!check"
@@ -118,10 +112,5 @@ dev() {
 }
 
 sha512sums="
-c217a3397b67d7239bc30bc492d58fff96bb29c9cf73e390d1787a4fb787cb297557e594a926453fed11faaab80363d40853af271f8ee18ce9a317dfde4c6745  zfs-2.2.6.tar.gz
-3c0fbd662848981151c68215ac9567f2c0660bdd7aa6fa4891a4476526983c2ab91f385bb7095593e86c76182e436d4c1f7c41a526e82de470affcb15870cb28  0001-linux612-avoid-kmem-cache-create-redef.patch
-25a078527c0921dd1b4c78eae9f6464f0fe54bc336879a347cfeb2a4950bec4eaef0c7a465d2f45bd2acabae7b86b067249fb3047c0d544d43fe337a0f3e99b3  0002-linux612-support-3arg-dequeue-signal.patch
-3920f05e3576205f2b01de3f8d32c03a446c24339265805721b819e51f8bc73912e873a3ec68467213d7f07fb4939e732dd406a6c5d1cea3f3ea0663de48961b  0003-linux612-fmode-unsigned-offset-is-now.patch
-4f23bb4b4ab1339a5deabba29e6c2d9724af0fdc929afe962e7c3179b26c66639759f980bf4107dc9d148382f1fdf5aba84403f6968e663cde57a7facc06ab83  0004-linux612-f-version-removed-from-struct-file.patch
-a843a4d6fc43410fc5eda7eb7b5eea5a0f131aa5d664ec418a0b1308ee6d62f2458d821924c57710332ea40e2c8071d37fb3f9c24b8f93432423d1e6adf3acf4  0005-linux612-pg-error-flag-was-removed.patch
+6493faa8e31d9c042c4e8f748d32cb9243212fdf4e0341c19568b47bcf302e60beb89940b80374610b71e1dca1ca5813f3efaddbf1a2453ceabb38381165b271  zfs-2.2.7.tar.gz
 "
-- 
GitLab