Skip to content

Commit

Permalink
Merge pull request #27 from riiengineering/type/__openzfs/auto-mitiga…
Browse files Browse the repository at this point in the history
…te-corruption

__openzfs: Auto-mitigate data corruption bug
  • Loading branch information
4nd3r authored Feb 27, 2024
2 parents 5d45e9c + ed2aca9 commit 3462dc1
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion type/__openzfs/manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh -e
#
# 2020,2023 Dennis Camera (dennis.camera at riiengineering.ch)
# 2020,2023,2024 Dennis Camera (dennis.camera at riiengineering.ch)
#
# This file is part of skonfig-extra.
#
Expand Down Expand Up @@ -166,6 +166,31 @@ then
EOF
fi

# HACK: Workaround 2023 data corruption issue
# https://github.com/openzfs/zfs/releases/tag/zfs-2.1.5
# https://github.com/openzfs/zfs/releases/tag/zfs-2.2.2
# https://github.com/openzfs/zfs/issues/15526
# https://github.com/openzfs/zfs/pull/15571
if test -n "${kmod_version}"
then
if { version_ge "${kmod_version}" 2.2.0 && ! version_ge "${kmod_version}" 2.2.2; } \
|| { version_ge "${kmod_version}" 2.1.5 && ! version_ge "${kmod_version}" 2.1.14; }
then
# We only need to apply this hack on OpenZFS < 2.1.14 or < 2.2.2
zfs_dmu_offset_next_sync=0
fi

require= \
__block /etc/modprobe.d/zfs.conf:cdist-data-corruption-workaround \
--state "$(test "${zfs_dmu_offset_next_sync-}" && echo present || echo absent)" \
--file /etc/modprobe.d/zfs.conf \
--prefix '# skonfig:zfs-corruption-mitigation' \
--suffix '#/skonfig:zfs-corruption-mitigation' \
-text - <<-EOF
options zfs zfs_dmu_offset_next_sync=$((zfs_dmu_offset_next_sync))
EOF
fi

set_zed_rc() {
require=__package_apt/zfs-zed \
__key_value /etc/zfs/zed.d/zed.rc:"$1" \
Expand Down

0 comments on commit 3462dc1

Please sign in to comment.