Skip to content

Commit

Permalink
zfs_2_1: 2.1.14 -> 2.1.15
Browse files Browse the repository at this point in the history
This adds compatibility with newer kernels, which fixes
nixosTests.zfs.series_2_1, which broke when the default kernel version
was bumped.

This means we no longer need the removeLinuxDRM option at all, but
I've kept it around as a no-op so people can leave it set in case the
same thing happens again in future.
  • Loading branch information
alyssais committed Feb 27, 2024
1 parent 661d1be commit 45f1428
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 45 deletions.
41 changes: 6 additions & 35 deletions nixos/modules/tasks/filesystems/zfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -347,24 +347,12 @@ in
removeLinuxDRM = lib.mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Linux 6.2 dropped some kernel symbols required on aarch64 required by zfs.
Enabling this option will bring them back to allow this kernel version.
Note that in some jurisdictions this may be illegal as it might be considered
removing copyright protection from the code.
See https://www.ifross.org/?q=en/artikel/ongoing-dispute-over-value-exportsymbolgpl-function for further information.
If configure your kernel package with `zfs.latestCompatibleLinuxPackages`, you will need to also pass removeLinuxDRM to that package like this:
description = ''
Patch the kernel to change symbols needed by ZFS from
EXPORT_SYMBOL_GPL to EXPORT_SYMBOL.
```
{ pkgs, ... }: {
boot.kernelPackages = (pkgs.zfs.override {
removeLinuxDRM = pkgs.hostPlatform.isAarch64;
}).latestCompatibleLinuxPackages;
boot.zfs.removeLinuxDRM = true;
}
```
Currently has no effect, but may again in future if a kernel
update breaks ZFS due to symbols being newly changed to GPL.
'';
};
};
Expand Down Expand Up @@ -588,9 +576,7 @@ in
kernelParams = lib.optionals (!config.boot.zfs.allowHibernation) [ "nohibernate" ];

extraModulePackages = [
(cfgZfs.modulePackage.override
(lib.optionalAttrs (lib.versionOlder cfgZfs.package.version "2.2.3")
{ inherit (cfgZfs) removeLinuxDRM; }))
cfgZfs.modulePackage
];
};

Expand Down Expand Up @@ -727,21 +713,6 @@ in
services.udev.packages = [ cfgZfs.package ]; # to hook zvol naming, etc.
systemd.packages = [ cfgZfs.package ];

# Export kernel_neon_* symbols again.
# This change is necessary until ZFS figures out a solution
# with upstream or in their build system to fill the gap for
# this symbol.
# In the meantime, we restore what was once a working piece of code
# in the kernel.
boot.kernelPatches = lib.optional (lib.versionOlder cfgZfs.package.version "2.2.3" && cfgZfs.removeLinuxDRM && pkgs.stdenv.hostPlatform.system == "aarch64-linux") {
name = "export-neon-symbols-as-gpl";
patch = pkgs.fetchpatch {
url = "https://github.com/torvalds/linux/commit/aaeca98456431a8d9382ecf48ac4843e252c07b3.patch";
hash = "sha256-L2g4G1tlWPIi/QRckMuHDcdWBcKpObSWSRTvbHRIwIk=";
revert = true;
};
};

systemd.services = let
createImportService' = pool: createImportService {
inherit pool;
Expand Down
14 changes: 4 additions & 10 deletions pkgs/os-specific/linux/zfs/2_1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
, kernel ? null
, stdenv
, linuxKernel
, removeLinuxDRM ? false
, lib
, nixosTests
, ...
Expand All @@ -16,20 +15,15 @@ callPackage ./generic.nix args {
# this attribute is the correct one for this package.
kernelModuleAttribute = "zfs_2_1";
# check the release notes for compatible kernels
kernelCompatible =
if stdenv'.isx86_64 || removeLinuxDRM
then kernel.kernelOlder "6.6"
else kernel.kernelOlder "6.2";
kernelCompatible = kernel.kernelOlder "6.8";

latestCompatibleLinuxPackages = if stdenv'.isx86_64 || removeLinuxDRM
then linuxKernel.packages.linux_6_5
else linuxKernel.packages.linux_6_1;
latestCompatibleLinuxPackages = linuxKernel.packages.linux_6_7;

# This is a fixed version to the 2.1.x series, move only
# if the 2.1.x series moves.
version = "2.1.14";
version = "2.1.15";

hash = "sha256-RVAoZbV9yclGuN+D37SB6UCRFbbLEpBoyrQOQCVsQwE=";
hash = "sha256-zFO8fMbirEOrn5W57rAN7IWY6EIXG8jDXqhP7BWJyiY=";

tests = [
nixosTests.zfs.series_2_1
Expand Down

0 comments on commit 45f1428

Please sign in to comment.