From 58216f57225315059e38d564a17ec6b656eada60 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Mon, 22 Mar 2021 09:42:04 +0100 Subject: [PATCH] [type/__ssrq_zfs] Add workaround for bug 11574 https://github.com/openzfs/zfs/issues/11574 --- type/__ssrq_zfs/explorer/pagesize | 25 +++++++++++++++++++++++++ type/__ssrq_zfs/manifest | 23 ++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100755 type/__ssrq_zfs/explorer/pagesize diff --git a/type/__ssrq_zfs/explorer/pagesize b/type/__ssrq_zfs/explorer/pagesize new file mode 100755 index 0000000..1bed50b --- /dev/null +++ b/type/__ssrq_zfs/explorer/pagesize @@ -0,0 +1,25 @@ +#!/bin/sh -e +# +# 2021 Dennis Camera (dennis.camera at ssrq-sds-fds.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +getconf PAGESIZE 2>/dev/null || +getconf PAGE_SIZE 2>/dev/null || { + echo 'Cannot determine pagesize.' >&2 + exit 1 +} diff --git a/type/__ssrq_zfs/manifest b/type/__ssrq_zfs/manifest index 5e13087..a2e0a9b 100755 --- a/type/__ssrq_zfs/manifest +++ b/type/__ssrq_zfs/manifest @@ -1,6 +1,6 @@ #!/bin/sh -e # -# 2020 Dennis Camera (dennis.camera@ssrq-sds-fds.ch) +# 2020-2021 Dennis Camera (dennis.camera at ssrq-sds-fds.ch) # # This file is part of cdist. # @@ -86,6 +86,27 @@ __block /etc/modprobe.d/zfs.conf:cdist-zfs-tunables \ $(sed -e 's/^/options zfs /' "${__object:?}/parameter/tunable") EOF + + +# HACK: Workaround spl bug that exhausts all memory on `zfs scrub' on non-4k +# page sizes +# https://github.com/openzfs/zfs/issues/11756 +# https://github.com/openzfs/zfs/issues/11574 +pagesize=$(cat "${__object:?}/explorer/pagesize") +if test $((pagesize)) -eq $((64 * 1024)) +then + spl_kmem_cache_slab_limit=16384 +fi +require='__package_apt/zfs-modules' \ +__block /etc/modprobe.d/zfs.conf:cdist-spl-workaround-11574 \ + --state "$(test "${spl_kmem_cache_slab_limit-}" && echo present || echo absent)" \ + --file /etc/modprobe.d/zfs.conf \ + --prefix '# cdist:spl-workaround-11574' \ + --suffix '#/cdist:spl-workaround-11574' \ + --text - <