Hi,
Thanks for the super awesome feedback!
I indeed forgot to write a README.Debian [1] recording this
change and its usage. Let me prepare a revision and upload shortly.
[1] instead of NEWS, in order to avoid being too abruptive.
> diff --git a/debian/tree/zfsutils-linux/usr/lib/zfs-linux/scrub
> b/debian/tree/zfsutils-linux/usr/lib/zfs-linux/scrub
> index 91631cb18..cb4e3c07e 100755
> --- a/debian/tree/zfsutils-linux/usr/lib/zfs-linux/scrub
> +++ b/debian/tree/zfsutils-linux/usr/lib/zfs-linux/scrub
> @@ -1,27 +1,19 @@
> #!/bin/sh -eu
>
> # directly exit successfully when zfs module is not loaded
> -if modprobe -n -q --first-time zfs; then
> +if ! [ -d /sys/module/zfs ]; then
> exit 0
> fi
>
> # [auto] / enable / disable
> -PROPERTY_NAME="org.debian:periodical-scrub"
> +PROPERTY_NAME="org.debian:periodic-scrub"
>
> get_property () {
> - # Detect the ${PROPERTY_NAME} property from a given zpool
> - # Note, we are abusing user-defined property on zpool root
> dataset
> - # as "zpool user-defined property".
> + # Detect the ${PROPERTY_NAME} property on a given pool
> + # We are abusing user-defined properties on the root dataset,
> + # since they're not available on pools
>
https://github.com/openzfs/zfs/pull/11680
> pool=$1
> - if ! zfs list -H -o name "${pool}" 1>/dev/null 2>/dev/null;
> then
> - return 1 # failed to find the root dataset
> - fi
> - if ! zfs get -H -o value "${PROPERTY_NAME}" "${pool}"
> 1>/dev/null 2>/dev/null; then
> - return 1 # no such property
> - else
> - # has such property
> - zfs get -H -o value "${PROPERTY_NAME}" "${pool}"
> - fi
> + zfs get -H -o value "${PROPERTY_NAME}" "${pool}" 2>/dev/null
> || return 1
> }
>
> scrub_if_not_scrub_in_progress () {
> diff --git a/debian/tree/zfsutils-linux/usr/lib/zfs-linux/trim
> b/debian/tree/zfsutils-linux/usr/lib/zfs-linux/trim
> index 585a58baf..5a0216507 100755
> --- a/debian/tree/zfsutils-linux/usr/lib/zfs-linux/trim
> +++ b/debian/tree/zfsutils-linux/usr/lib/zfs-linux/trim
> @@ -1,27 +1,19 @@
> -#!/bin/sh -e
> +#!/bin/sh -eu
>
> # directly exit successfully when zfs module is not loaded
> -if modprobe -n -q --first-time zfs; then
> +if ! [ -d /sys/module/zfs ]; then
> exit 0
> fi
>
> # [auto] / enable / disable
> -PROPERTY_NAME="org.debian:periodical-trim"
> +PROPERTY_NAME="org.debian:periodic-trim"
>
> get_property () {
> - # Detect the ${PROPERTY_NAME} property from a given zpool
> - # Note, we are abusing user-defined property on zpool root
> dataset
> - # as "zpool user-defined property".
> - pool=$1
> - if ! zfs list -H -o name "${pool}" 1>/dev/null 2>/dev/null;
> then
> - return 1 # failed to find the root dataset
> - fi
> - if ! zfs get -H -o value "${PROPERTY_NAME}" "${pool}"
> 1>/dev/null 2>/dev/null; then
> - return 1 # no such property
> - else
> - # has such property
> - zfs get -H -o value "${PROPERTY_NAME}" "${pool}"
> - fi
> + # Detect the ${PROPERTY_NAME} property on a given pool
> + # We are abusing user-defined properties on the root dataset,
> + # since they're not available on pools
>
https://github.com/openzfs/zfs/pull/11680
> + pool=$1
> + zfs get -H -o value "${PROPERTY_NAME}" "${pool}" 2>/dev/null ||
> return 1
> }
>
> trim_if_not_already_trimming () {