diff --git a/0001-compact-workaround-for-GPL-only-symbols-on-riscv-fro.patch b/0001-compact-workaround-for-GPL-only-symbols-on-riscv-fro.patch new file mode 100644 index 0000000000000000000000000000000000000000..2e81623b65e5e2c4195e63e03cb36793d43ef61c --- /dev/null +++ b/0001-compact-workaround-for-GPL-only-symbols-on-riscv-fro.patch @@ -0,0 +1,102 @@ +From 86239a5b9c54e5d34c75446e23c4c88f8defc59f Mon Sep 17 00:00:00 2001 +From: Shengqi Chen +Date: Thu, 7 Dec 2023 04:37:50 +0800 +Subject: [PATCH] compact: workaround for GPL-only symbols on riscv from Linux + 6.2 + +Since Linux 6.2, the implementation of flush_dcache_page on riscv +references GPL-only symbol `PageHuge`, breaking the build of zfs. + +This patch uses existing mechanism to override flush_dcache_page, +removing the call to `PageHuge`. According to comments in kernel, +it is only used to do some check against HugeTLB pages, which only +exist in userspace. ZFS uses flush_dcache_page only on kernel pages, +thus this patch will not introduce any behaviour change. + +See also: torvalds/linux@d33deda, openzfs/zfs@589f59b + +Reviewed-by: Brian Behlendorf +Signed-off-by: Shengqi Chen +Closes #14974 +Closes #15627 +--- + config/kernel-flush_dcache_page.m4 | 5 +++-- + config/kernel.m4 | 6 ++++++ + include/os/linux/kernel/linux/dcache_compat.h | 15 +++++++++++++-- + 3 files changed, 22 insertions(+), 4 deletions(-) + +diff --git a/config/kernel-flush_dcache_page.m4 b/config/kernel-flush_dcache_page.m4 +index 2340c386e..aa916c87d 100644 +--- a/config/kernel-flush_dcache_page.m4 ++++ b/config/kernel-flush_dcache_page.m4 +@@ -1,7 +1,8 @@ + dnl # + dnl # Starting from Linux 5.13, flush_dcache_page() becomes an inline +-dnl # function and may indirectly referencing GPL-only cpu_feature_keys on +-dnl # powerpc ++dnl # function and may indirectly referencing GPL-only symbols: ++dnl # on powerpc: cpu_feature_keys ++dnl # on riscv: PageHuge (added from 6.2) + dnl # + + dnl # +diff --git a/config/kernel.m4 b/config/kernel.m4 +index 056517a84..d25b65994 100644 +--- a/config/kernel.m4 ++++ b/config/kernel.m4 +@@ -168,6 +168,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ + ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE + ZFS_AC_KERNEL_SRC_FLUSH_DCACHE_PAGE + ;; ++ riscv*) ++ ZFS_AC_KERNEL_SRC_FLUSH_DCACHE_PAGE ++ ;; + esac + + AC_MSG_CHECKING([for available kernel interfaces]) +@@ -310,6 +313,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ + ZFS_AC_KERNEL_CPU_HAS_FEATURE + ZFS_AC_KERNEL_FLUSH_DCACHE_PAGE + ;; ++ riscv*) ++ ZFS_AC_KERNEL_FLUSH_DCACHE_PAGE ++ ;; + esac + ]) + +diff --git a/include/os/linux/kernel/linux/dcache_compat.h b/include/os/linux/kernel/linux/dcache_compat.h +index 1e3520493..ab1711b99 100644 +--- a/include/os/linux/kernel/linux/dcache_compat.h ++++ b/include/os/linux/kernel/linux/dcache_compat.h +@@ -42,8 +42,8 @@ + /* + * Starting from Linux 5.13, flush_dcache_page() becomes an inline function + * and under some configurations, may indirectly referencing GPL-only +- * cpu_feature_keys on powerpc. Override this function when it is detected +- * being GPL-only. ++ * symbols, e.g., cpu_feature_keys on powerpc and PageHuge on riscv. ++ * Override this function when it is detected being GPL-only. + */ + #if defined __powerpc__ && defined HAVE_FLUSH_DCACHE_PAGE_GPL_ONLY + #include +@@ -53,6 +53,17 @@ + clear_bit(PG_dcache_clean, &(page)->flags); \ + } while (0) + #endif ++/* ++ * For riscv implementation, the use of PageHuge can be safely removed. ++ * Because it handles pages allocated by HugeTLB, while flush_dcache_page ++ * in zfs module is only called on kernel pages. ++ */ ++#if defined __riscv && defined HAVE_FLUSH_DCACHE_PAGE_GPL_ONLY ++#define flush_dcache_page(page) do { \ ++ if (test_bit(PG_dcache_clean, &(page)->flags)) \ ++ clear_bit(PG_dcache_clean, &(page)->flags); \ ++ } while (0) ++#endif + + /* + * 2.6.30 API change, +-- +2.45.2 + diff --git a/zfs-2.1.10.tar.gz b/zfs-2.1.16.tar.gz similarity index 75% rename from zfs-2.1.10.tar.gz rename to zfs-2.1.16.tar.gz index f3c1c35fee1da80267b4d7263f4c326183821878..056722dbdbcd3caa86c801a59bd23695d60699b5 100644 Binary files a/zfs-2.1.10.tar.gz and b/zfs-2.1.16.tar.gz differ diff --git a/zfs-kmod.spec b/zfs-kmod.spec index c43eb143043597a81d2fae5262985f625993919a..f494ac8b41942c5cc14f2c96e1f26de75f64ab6d 100644 --- a/zfs-kmod.spec +++ b/zfs-kmod.spec @@ -2,17 +2,18 @@ %bcond_with debuginfo Name: zfs-kmod -Version: 2.1.10 +Version: 2.1.16 Release: 1 Summary: Kernel module(s) Group: System Environment/Kernel License: CDDL-1.0 URL: https://github.com/openzfs/zfs -BuildRequires: %kernel_module_package_buildreqs +BuildRequires: kernel-devel BuildRequires: kernel-rpm-macros Source0: zfs-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Patch0: 0001-compact-workaround-for-GPL-only-symbols-on-riscv-fro.patch # Additional dependency information for the kmod sub-package must be specified # by generating a preamble text file which kmodtool can append to the spec file. @@ -48,6 +49,7 @@ Provides: kmod-spl-devel = %{version} This package provides the header files and objects to build kernel modules. %prep +%autosetup -n %{kmod_name}-%{version} -p1 if ! [ -d "%{ksrc}" ]; then echo "Kernel build directory isn't set properly, cannot continue" exit 1 @@ -96,6 +98,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Jan 02 2025 pSomng - 2.1.16-1 +- Update to 2.1.16 +- backport openzfs/zfs@86239a5 + * Wed Apr 19 2023 Xinliang Liu - 2.1.10-1 - Update to 2.1.10 - Fix release number contains double %{dist}, e.g. "*.oe1.oe1.aarch64.rpm" diff --git a/zfs.spec b/zfs.spec index 6113843ba147ec852ae4f57402b63d970df5b5af..1f1fcc7c65cf5c7df78d3955ef501514f7af2930 100644 --- a/zfs.spec +++ b/zfs.spec @@ -80,7 +80,7 @@ %define __python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())") Name: zfs -Version: 2.1.10 +Version: 2.1.16 Release: 1 Summary: Commands to control the kernel modules and libraries @@ -93,6 +93,7 @@ Requires: libzpool5%{?_isa} = %{version}-%{release} Requires: libnvpair3%{?_isa} = %{version}-%{release} Requires: libuutil3%{?_isa} = %{version}-%{release} Requires: libzfs5%{?_isa} = %{version}-%{release} +Patch0: 0001-compact-workaround-for-GPL-only-symbols-on-riscv-fro.patch Requires: %{name}-kmod = %{version} Provides: %{name}-kmod-common = %{version}-%{release} Obsoletes: spl <= %{version} @@ -328,6 +329,7 @@ image which is ZFS aware. %endif %prep +%autosetup -p1 %if %{with debug} %define debug --enable-debug %else @@ -557,6 +559,10 @@ systemctl --system daemon-reload >/dev/null || true %endif %changelog +* Thu Jan 02 2025 pSomng - 2.1.16-1 +- Update to 2.1.16 +- backport openzfs/zfs@86239a5 + * Wed Apr 19 2023 Xinliang Liu - 2.1.10-1 - Update to 2.1.10 - Fix release number contains double %{dist}, e.g. "*.oe1.oe1.aarch64.rpm"