From 451e31956cdaaea9f92d2e00ad0ee32e77994f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 2 Oct 2019 19:33:51 +0100 Subject: [PATCH 1/4] linux: update fpu patches for 5.3 At the moment we experience bad instabilities with linux 5.3: https://github.com/zfsonlinux/zfs/issues/9346 as the zfs-native method of disabling the FPU is buggy. (cherry picked from commit 96097ab665fb1b908e416ba7e39ecbf0bb6b14d0) --- ...=> export_kernel_fpu_functions_4_14.patch} | 0 .../export_kernel_fpu_functions_5_3.patch | 42 +++++++++++++++++++ pkgs/os-specific/linux/kernel/patches.nix | 10 ++++- pkgs/top-level/all-packages.nix | 9 ++-- 4 files changed, 56 insertions(+), 5 deletions(-) rename pkgs/os-specific/linux/kernel/{export_kernel_fpu_functions.patch => export_kernel_fpu_functions_4_14.patch} (100%) create mode 100644 pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_5_3.patch diff --git a/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions.patch b/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_4_14.patch similarity index 100% rename from pkgs/os-specific/linux/kernel/export_kernel_fpu_functions.patch rename to pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_4_14.patch diff --git a/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_5_3.patch b/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_5_3.patch new file mode 100644 index 000000000000..dc9ca64bdc1f --- /dev/null +++ b/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_5_3.patch @@ -0,0 +1,42 @@ +From 1e010beda2896bdf3082fb37a3e49f8ce20e04d8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= +Date: Thu, 2 May 2019 05:28:08 +0100 +Subject: [PATCH] x86/fpu: Export kernel_fpu_{begin,end}() with + EXPORT_SYMBOL_GPL +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We need these symbols in zfs as the fpu implementation breaks userspace: + +https://github.com/zfsonlinux/zfs/issues/9346 +Signed-off-by: Jörg Thalheim +--- + arch/x86/kernel/fpu/core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c +index 12c70840980e..352538b3bb5d 100644 +--- a/arch/x86/kernel/fpu/core.c ++++ b/arch/x86/kernel/fpu/core.c +@@ -102,7 +102,7 @@ void kernel_fpu_begin(void) + } + __cpu_invalidate_fpregs_state(); + } +-EXPORT_SYMBOL_GPL(kernel_fpu_begin); ++EXPORT_SYMBOL(kernel_fpu_begin); + + void kernel_fpu_end(void) + { +@@ -111,7 +111,7 @@ void kernel_fpu_end(void) + this_cpu_write(in_kernel_fpu, false); + preempt_enable(); + } +-EXPORT_SYMBOL_GPL(kernel_fpu_end); ++EXPORT_SYMBOL(kernel_fpu_end); + + /* + * Save the FPU state (mark it for reload if necessary): +-- +2.23.0 + diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index b80320db282e..fa5b168389bc 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -59,8 +59,14 @@ }; export_kernel_fpu_functions = { - name = "export_kernel_fpu_functions"; - patch = ./export_kernel_fpu_functions.patch; + "4.14" = { + name = "export_kernel_fpu_functions"; + patch = ./export_kernel_fpu_functions_4_14.patch; + }; + "5.3" = { + name = "export_kernel_fpu_functions"; + patch = ./export_kernel_fpu_functions_5_3.patch; + }; }; # patches from https://lkml.org/lkml/2019/7/15/1748 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 148352f647f0..312e637a445a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15747,7 +15747,7 @@ in # when adding a new linux version kernelPatches.cpu-cgroup-v2."4.11" kernelPatches.modinst_arg_list_too_long - kernelPatches.export_kernel_fpu_functions + kernelPatches.export_kernel_fpu_functions."4.14" ]; }; @@ -15755,13 +15755,16 @@ in kernelPatches = [ kernelPatches.bridge_stp_helper kernelPatches.modinst_arg_list_too_long - kernelPatches.export_kernel_fpu_functions + kernelPatches.export_kernel_fpu_functions."4.14" ]; }; # Update this when adding the newest kernel major version! linux_latest = callPackage ../os-specific/linux/kernel/linux-5.4.nix { - kernelPatches = [ kernelPatches.bridge_stp_helper ]; + kernelPatches = [ + kernelPatches.bridge_stp_helper + kernelPatches.export_kernel_fpu_functions."5.3" + ]; }; linux_testing = callPackage ../os-specific/linux/kernel/linux-testing.nix { From a59e29c97e1e6df5b9a9659c0255a5e4dc01ba85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 25 Sep 2019 11:30:31 +0100 Subject: [PATCH 2/4] zfsUnstable: drop build patches (cherry picked from commit 539e66c4291604806aca382201647bcf77d3cf73) --- .../linux/zfs/build-fixes-0.8.patch | 36 ------------------- pkgs/os-specific/linux/zfs/default.nix | 11 ++---- 2 files changed, 2 insertions(+), 45 deletions(-) delete mode 100644 pkgs/os-specific/linux/zfs/build-fixes-0.8.patch diff --git a/pkgs/os-specific/linux/zfs/build-fixes-0.8.patch b/pkgs/os-specific/linux/zfs/build-fixes-0.8.patch deleted file mode 100644 index ff2c6e2e1503..000000000000 --- a/pkgs/os-specific/linux/zfs/build-fixes-0.8.patch +++ /dev/null @@ -1,36 +0,0 @@ -From b323e7a7ebb2327943851fa3fd139399eb24d3dd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= -Date: Mon, 13 Aug 2018 22:58:21 +0200 -Subject: [PATCH] build fixes needed for nixos - ---- - module/Makefile.in | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/module/Makefile.in b/module/Makefile.in -index 935bd2663..afb08df81 100644 ---- a/module/Makefile.in -+++ b/module/Makefile.in -@@ -44,15 +44,15 @@ clean: - modules_install: - @# Install the kernel modules - $(MAKE) -C @LINUX_OBJ@ M=`pwd` $@ \ -- INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \ -+ INSTALL_MOD_PATH=@prefix@/$(INSTALL_MOD_PATH) \ - INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \ - KERNELRELEASE=@LINUX_VERSION@ - @# Remove extraneous build products when packaging -- kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ -- if [ -n "$(DESTDIR)" ]; then \ -+ kmoddir=@prefix@$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ -+ if [ -n "@prefix@" ]; then \ - find $$kmoddir -name 'modules.*' | xargs $(RM); \ - fi -- sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \ -+ sysmap=@prefix@$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \ - if [ -f $$sysmap ]; then \ - depmod -ae -F $$sysmap @LINUX_VERSION@; \ - fi --- -2.19.2 - diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix index 96e37fc8dfc2..985faa519510 100644 --- a/pkgs/os-specific/linux/zfs/default.nix +++ b/pkgs/os-specific/linux/zfs/default.nix @@ -19,7 +19,7 @@ let common = { version , sha256 - , extraPatches + , extraPatches ? [] , rev ? "zfs-${version}" , isUnstable ? false , incompatibleKernelVersion ? null }: @@ -103,6 +103,7 @@ let installFlags = [ "sysconfdir=\${out}/etc" "DEFAULT_INITCONF_DIR=\${out}/default" + "INSTALL_MOD_PATH=\${out}" ]; postInstall = optionalString buildKernel '' @@ -157,10 +158,6 @@ in { version = "0.8.2"; sha256 = "0miax0h2wg4b2kn8n93804faajy2n1sh25knyy2hg3k77nlr4pni"; - - extraPatches = [ - ./build-fixes-0.8.patch - ]; }; zfsUnstable = common { @@ -172,9 +169,5 @@ in { sha256 = "0miax0h2wg4b2kn8n93804faajy2n1sh25knyy2hg3k77nlr4pni"; isUnstable = true; - - extraPatches = [ - ./build-fixes-0.8.patch - ]; }; } From 502654d37dc30719376de161360b0520bde6fdad Mon Sep 17 00:00:00 2001 From: Frank Doepper Date: Fri, 4 Oct 2019 12:34:15 +0200 Subject: [PATCH 3/4] zfs: fix PATH for zpool.d scripts (cherry picked from commit 17f76a906ef15f7f62986741c7c494d997363719) --- pkgs/os-specific/linux/zfs/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix index 985faa519510..ae72aad6c077 100644 --- a/pkgs/os-specific/linux/zfs/default.nix +++ b/pkgs/os-specific/linux/zfs/default.nix @@ -7,6 +7,7 @@ , libtirpc , nfs-utils , gawk, gnugrep, gnused, systemd +, smartmontools, sysstat, sudo # Kernel dependencies , kernel ? null @@ -131,6 +132,13 @@ let (cd $out/share/bash-completion/completions; ln -s zfs zpool) ''; + postFixup = '' + path="PATH=${makeBinPath [ coreutils gawk gnused gnugrep utillinux smartmontools sysstat sudo ]}" + for i in $out/libexec/zfs/zpool.d/*; do + sed -i "2i$path" $i + done + ''; + outputs = [ "out" ] ++ optionals buildUser [ "lib" "dev" ]; meta = { From e5d2585097251b02c1e45f5d5061b1781d286239 Mon Sep 17 00:00:00 2001 From: sjau Date: Fri, 24 Jan 2020 14:52:44 +0100 Subject: [PATCH 4/4] zfs: 0.8.2 -> 0.8.3 (cherry picked from commit 88de34b160cec2915cb8ee4f5cd08542874eeaa6) --- pkgs/os-specific/linux/zfs/default.nix | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix index ae72aad6c077..738171bb5ec8 100644 --- a/pkgs/os-specific/linux/zfs/default.nix +++ b/pkgs/os-specific/linux/zfs/default.nix @@ -56,6 +56,22 @@ let substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d" substituteInPlace ./etc/zfs/Makefile.am --replace "\$(sysconfdir)" "$out/etc" substituteInPlace ./cmd/zed/Makefile.am --replace "\$(sysconfdir)" "$out/etc" + + substituteInPlace ./contrib/initramfs/hooks/Makefile.am \ + --replace "/usr/share/initramfs-tools/hooks" "$out/usr/share/initramfs-tools/hooks" + substituteInPlace ./contrib/initramfs/Makefile.am \ + --replace "/usr/share/initramfs-tools" "$out/usr/share/initramfs-tools" + substituteInPlace ./contrib/initramfs/scripts/Makefile.am \ + --replace "/usr/share/initramfs-tools/scripts" "$out/usr/share/initramfs-tools/scripts" + substituteInPlace ./contrib/initramfs/scripts/local-top/Makefile.am \ + --replace "/usr/share/initramfs-tools/scripts/local-top" "$out/usr/share/initramfs-tools/scripts/local-top" + substituteInPlace ./contrib/initramfs/scripts/Makefile.am \ + --replace "/usr/share/initramfs-tools/scripts" "$out/usr/share/initramfs-tools/scripts" + substituteInPlace ./contrib/initramfs/scripts/local-top/Makefile.am \ + --replace "/usr/share/initramfs-tools/scripts/local-top" "$out/usr/share/initramfs-tools/scripts/local-top" + substituteInPlace ./etc/systemd/system/Makefile.am \ + --replace '$(DESTDIR)$(systemdunitdir)' "$out"'$(DESTDIR)$(systemdunitdir)' + substituteInPlace ./etc/systemd/system/zfs-share.service.in \ --replace "/bin/rm " "${coreutils}/bin/rm " @@ -163,9 +179,9 @@ in { # incompatibleKernelVersion = "4.20"; # this package should point to the latest release. - version = "0.8.2"; + version = "0.8.3"; - sha256 = "0miax0h2wg4b2kn8n93804faajy2n1sh25knyy2hg3k77nlr4pni"; + sha256 = "0viql8rnqr32diapkpdsrwm6xj8vw5vi4dk2x2m7s7g0q2zdkahw"; }; zfsUnstable = common { @@ -173,9 +189,9 @@ in { # incompatibleKernelVersion = "4.19"; # this package should point to a version / git revision compatible with the latest kernel release - version = "0.8.2"; + version = "0.8.3"; - sha256 = "0miax0h2wg4b2kn8n93804faajy2n1sh25knyy2hg3k77nlr4pni"; + sha256 = "0viql8rnqr32diapkpdsrwm6xj8vw5vi4dk2x2m7s7g0q2zdkahw"; isUnstable = true; }; }