Skip to content

Commit

Permalink
[type/__openzfs] Auto-mitigate data corruption bug
Browse files Browse the repository at this point in the history
Set zfs_dmu_offset_next_sync=0 on OpenZFS < 2.1.14 or < 2.2.2.
  • Loading branch information
sideeffect42 committed Feb 26, 2024
1 parent 5d45e9c commit ed2aca9
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 ed2aca9

Please sign in to comment.