Bug 292074 - periodic daily 801.trim-zfs uses wrong variable name: daily_zfs_trim_flags instead of daily_trim_zfs_flags
Summary: periodic daily 801.trim-zfs uses wrong variable name: daily_zfs_trim_flags in...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 15.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Alexander Ziaee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-31 15:47 UTC by CrazyMihey
Modified: 2026-08-06 22:33 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description CrazyMihey 2025-12-31 15:47:56 UTC
The script «/etc/periodic/daily/801.trim-zfs» invokes:

    zpool trim ${daily_zfs_trim_flags} "${pool}"

However, all other Periodic Configuration Files, including
«/etc/defaults/periodic.conf», define and document the Variable as:

    daily_trim_zfs_flags

As a Result, ReDefined Trim flags configured via «/etc/periodic.conf» or «/etc/periodic.conf.local» are Silently IgnoRed.

This affects FreeBSD 14.3-RELEASE and 15.0-RELEASE.

Suggested Fix:
- zpool trim ${daily_zfs_trim_flags} "${pool}"
+ zpool trim ${daily_trim_zfs_flags} "${pool}"

Currently «Hot-Fixed» Example of «/etc/periodic.conf.local»:
if kldstat -q -m "zfs" 2>"/dev/null" && zpool status -P -t | egrep "[/][Dd][Ee][Vv][/]" | egrep --invert-match --quiet "[(][[:space:]]*[Tt][Rr][Ii][Mm][[:space:]]+[Uu][Nn][Ss][Uu][Pp][Pp][Oo][Rr][Tt][Ee][Dd][[:space:]]*[)]"
 then	# The System contains Devices that SupPort Trim Operations.
  daily_trim_zfs_enable="Yes"
  daily_trim_zfs_flags="${daily_trim_zfs_flags%[[:space:]]}${daily_trim_zfs_flags:+" "}--rate "'"$(( 20 << 20 ))"'""	# Maximum Trim Rate 20 MB/S. ReasonAble Performance Penalty for Most HDDs & SSDs.
  daily_zfs_trim_flags="${daily_zfs_trim_flags%[[:space:]]}${daily_zfs_trim_flags:+" "}--rate "'"$(( 20 << 20 ))"'""	# Due to the Error in «/etc/periodic/daily/801.trim-zfs»…
fi
Comment 1 CrazyMihey 2026-01-01 08:40:08 UTC
Sorry, the Corrected «Hot-Fixed» Code for «/etc/periodic.conf», «/etc/periodic.conf.local», «/usr/local/etc/periodic.conf» WithOut Extra-Quotes looks like:
if kldstat -q -m "zfs" 2>"/dev/null" && zpool status -P -t | egrep "[/][Dd][Ee][Vv][/]" | egrep --invert-match --quiet "[(][[:space:]]*[Tt][Rr][Ii][Mm][[:space:]]+[Uu][Nn][Ss][Uu][Pp][Pp][Oo][Rr][Tt][Ee][Dd][[:space:]]*[)]"
 then	# The System contains Devices that SupPort Trim Operations.
  daily_trim_zfs_enable="Yes"
  daily_trim_zfs_flags="${daily_trim_zfs_flags%[[:space:]]}${daily_trim_zfs_flags:+" "}--rate $(( 20 << 20 ))"	# Maximum Trim Rate 20 MB/S. ReasonAble Performance Penalty for Most HDDs & SSDs.
  daily_zfs_trim_flags="${daily_zfs_trim_flags%[[:space:]]}${daily_zfs_trim_flags:+" "}--rate $(( 20 << 20 ))"	# Due to the Error in «/etc/periodic/daily/801.trim-zfs»…
fi
Comment 2 commit-hook freebsd_committer freebsd_triage 2026-01-01 17:59:33 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=68d6abd9714384a41028dc0d5086b4930366bbea

commit 68d6abd9714384a41028dc0d5086b4930366bbea
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2026-01-01 17:53:31 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2026-01-01 17:57:15 +0000

    periodic/801.trim-zfs: Fix daily-trim-zfs-flags

    This variable was named incorrectly, resulting in any specified flags
    being silently ignored.

    PR:             292074
    MFC after:      3 days
    Reported by:    CrazyMihey@Ya.Ru
    Fixes:          493908c4b45c (Add a daily zfs trim script)

 usr.sbin/periodic/etc/daily/801.trim-zfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 3 Alexander Ziaee freebsd_committer freebsd_triage 2026-01-01 18:00:41 UTC
Good catch. Thanks Mihey!
Comment 4 Enji Cooper freebsd_committer freebsd_triage 2026-01-01 19:05:06 UTC
(In reply to CrazyMihey from comment #1)

Thank you very much for the report Mihey!

A quick ask for next time: could you please submit the patch as a file instead of in a comment? The latter didn't render correctly on Bugzilla.

Cheers and a Happy New Year to you!
Comment 5 CrazyMihey 2026-01-02 17:04:30 UTC
(In reply to Enji Cooper from comment #4)
Happy New Year!
I Just Thing the Author Must Make Changes, Fully UnderStanding, what He Does, Not Just Apply Patches from Here, but
I will Work on This…
Comment 6 Enji Cooper freebsd_committer freebsd_triage 2026-01-02 17:45:28 UTC
(In reply to CrazyMihey from comment #5)

Much appreciated! Attaching your patch as a file with a reference point for your diff ideally helps speed up the process of getting your hard work reviewed and into a development mainline branch.

All the best to you :).
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-01-05 06:16:30 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=77d4961041111ba05ad1c8ff64d7cb848e836624

commit 77d4961041111ba05ad1c8ff64d7cb848e836624
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2026-01-01 17:53:31 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2026-01-05 06:15:14 +0000

    periodic/801.trim-zfs: Fix daily-trim-zfs-flags

    This variable was named incorrectly, resulting in any specified flags
    being silently ignored.

    PR:             292074
    MFC after:      3 days
    Reported by:    CrazyMihey@Ya.Ru
    Fixes:          493908c4b45c (Add a daily zfs trim script)

    (cherry picked from commit 68d6abd9714384a41028dc0d5086b4930366bbea)

 usr.sbin/periodic/etc/daily/801.trim-zfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2026-08-06 22:33:08 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9f7f30b8df12bc36c8260f5de52862039d897f03

commit 9f7f30b8df12bc36c8260f5de52862039d897f03
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2026-01-01 17:53:31 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2026-08-06 22:17:27 +0000

    periodic/801.trim-zfs: Fix daily-trim-zfs-flags

    This variable was named incorrectly, resulting in any specified flags
    being silently ignored.

    PR:             292074
    MFC after:      3 days
    Reported by:    CrazyMihey@Ya.Ru
    Fixes:          493908c4b45c (Add a daily zfs trim script)

    (cherry picked from commit 68d6abd9714384a41028dc0d5086b4930366bbea)

 usr.sbin/periodic/etc/daily/801.trim-zfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)