Package: zfs-dkms
Version: 2.3.0-1
Severity: important

The Linux-Minimum defined in META is wrong. It says 4.18, but the code uses 
SHRINK_EMPTY from Linux v4.19.

Propagate Linux-Minimum to BUILD_EXCLUSIVE_KERNEL_MIN in dkms.conf s.t. dkms 
skips building modules for old kernels where the configure script would error 
out.

I'm intentionally not setting BUILD_EXCLUSIVE_KERNEL_MAX to suppress module 
build errors on too new kernels since users would be surprised if kernel 
upgrades succeed without error but booting fails because building the module 
was skipped.


Andreas
>From f6d0a2e61eabfb1eab2088dffa166f06df5baa4f Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Tue, 25 Feb 2025 09:52:12 +0100
Subject: [PATCH 1/3] dkms.mkconf: switch to BUILD_EXCLUSIVE_CONFIG

supported by dkms/bookworm
---
 debian/patches/cross-compile.patch      |  2 +-
 debian/patches/skip-on-PREEMPT_RT.patch | 11 ++++-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/debian/patches/cross-compile.patch 
b/debian/patches/cross-compile.patch
index e9c68d7d..6a6e6e16 100644
--- a/debian/patches/cross-compile.patch
+++ b/debian/patches/cross-compile.patch
@@ -4,7 +4,7 @@ Origin: ubuntu
 Forwarded: no
 --- a/scripts/dkms.mkconf
 +++ b/scripts/dkms.mkconf
-@@ -51,6 +51,12 @@
+@@ -48,6 +48,12 @@ PRE_BUILD="configure
      }
    )
    \$(
diff --git a/debian/patches/skip-on-PREEMPT_RT.patch 
b/debian/patches/skip-on-PREEMPT_RT.patch
index 44ceb35a..82c5dd6a 100644
--- a/debian/patches/skip-on-PREEMPT_RT.patch
+++ b/debian/patches/skip-on-PREEMPT_RT.patch
@@ -6,16 +6,13 @@ Last-Update: 2024-08-08
 
 --- a/scripts/dkms.mkconf
 +++ b/scripts/dkms.mkconf
-@@ -25,6 +25,12 @@
+@@ -25,6 +25,9 @@ PACKAGE_NAME="${pkgname}"
  PACKAGE_VERSION="${pkgver}"
  PACKAGE_CONFIG="${pkgcfg}"
  NO_WEAK_MODULES="yes"
-+if [ -f \$kernel_source_dir/.config ]; then
-+    . \$kernel_source_dir/.config
-+    if [ "\$CONFIG_PREEMPT_RT" = "y" ]; then
-+        BUILD_EXCLUSIVE_KERNEL="NOT ON PREEMPT_RT"
-+    fi
-+fi
++
++BUILD_EXCLUSIVE_CONFIG="!CONFIG_PREEMPT_RT"
++
  PRE_BUILD="configure
    --disable-dependency-tracking
    --prefix=/usr
-- 
2.39.5

>From a7457b805c4bc80cf39236c535ceb2f6b608cd33 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Tue, 25 Feb 2025 10:01:20 +0100
Subject: [PATCH 2/3] dkms.mkconf: set BUILD_EXCLUSIVE_KERNEL_MIN to the value
 from META

---
 .../patches/BUILD_EXCLUSIVE_KERNEL_MIN.patch  | 23 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 debian/patches/BUILD_EXCLUSIVE_KERNEL_MIN.patch

diff --git a/debian/patches/BUILD_EXCLUSIVE_KERNEL_MIN.patch 
b/debian/patches/BUILD_EXCLUSIVE_KERNEL_MIN.patch
new file mode 100644
index 00000000..78c95acc
--- /dev/null
+++ b/debian/patches/BUILD_EXCLUSIVE_KERNEL_MIN.patch
@@ -0,0 +1,23 @@
+Author: Andreas Beckmann <a...@debian.org>
+Description: set BUILD_EXCLUSIVE_KERNEL_MIN in dkms.conf
+
+--- a/scripts/dkms.mkconf
++++ b/scripts/dkms.mkconf
+@@ -20,6 +20,8 @@ if [ -z "${pkgname}" ] || [ -z "${pkgver
+       exit 1
+ fi
+ 
++linux_min=$(awk '/Linux-Minimum:/{print $2}' META)
++
+ exec cat >"${filename}" <<EOF
+ PACKAGE_NAME="${pkgname}"
+ PACKAGE_VERSION="${pkgver}"
+@@ -28,6 +30,8 @@ NO_WEAK_MODULES="yes"
+ 
+ BUILD_EXCLUSIVE_CONFIG="!CONFIG_PREEMPT_RT"
+ 
++BUILD_EXCLUSIVE_KERNEL_MIN="${linux_min}"
++
+ PRE_BUILD="configure
+   --disable-dependency-tracking
+   --prefix=/usr
diff --git a/debian/patches/series b/debian/patches/series
index b6ad6225..b3574d6f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -19,3 +19,4 @@ ubuntu/zfs-mount-container-start.patch
 #ubuntu/4510-silently-ignore-modprobe-failure.patch
 #ubuntu/4751-suppress-types.patch
 fix-pyzfs-version.patch
+BUILD_EXCLUSIVE_KERNEL_MIN.patch
-- 
2.39.5

>From 98893b4b21c1163df65a2eec9cb9ae7be46d1f7f Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Tue, 25 Feb 2025 10:50:18 +0100
Subject: [PATCH 3/3] META: bump Linux-Minimum due to SHRINK_EMPTY usage

---
 debian/patches/bump-Linux-Minimum.patch | 13 +++++++++++++
 debian/patches/series                   |  1 +
 2 files changed, 14 insertions(+)
 create mode 100644 debian/patches/bump-Linux-Minimum.patch

diff --git a/debian/patches/bump-Linux-Minimum.patch 
b/debian/patches/bump-Linux-Minimum.patch
new file mode 100644
index 00000000..ea62c41c
--- /dev/null
+++ b/debian/patches/bump-Linux-Minimum.patch
@@ -0,0 +1,13 @@
+Author: Andreas Beckmann <a...@debian.org>
+Description: bump Linux-Minimum due to SHRINK_EMPTY usage
+
+SHRINK_EMPTY was introduced in Linux v4.19
+
+--- a/META
++++ b/META
+@@ -7,4 +7,4 @@ Release-Tags:  relext
+ License:       CDDL
+ Author:        OpenZFS
+ Linux-Maximum: 6.12
+-Linux-Minimum: 4.18
++Linux-Minimum: 4.19
diff --git a/debian/patches/series b/debian/patches/series
index b3574d6f..eb404ef7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -20,3 +20,4 @@ ubuntu/zfs-mount-container-start.patch
 #ubuntu/4751-suppress-types.patch
 fix-pyzfs-version.patch
 BUILD_EXCLUSIVE_KERNEL_MIN.patch
+bump-Linux-Minimum.patch
-- 
2.39.5

Reply via email to