From: Darrick J. Wong <djwong@xxxxxxxxxx> The xfs_scrub_all program wants to write a state file into the package state dir to keep track of how recently it performed a media scan. Don't allow the systemd timer to run if that path isn't writable. Cc: <linux-xfs@xxxxxxxxxxxxxxx> # v6.10.0 Fixes: 267ae610a3d90f ("xfs_scrub_all: enable periodic file data scrubs automatically") Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> --- scrub/Makefile | 6 +++++- scrub/xfs_scrub_all.timer.in | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) rename scrub/{xfs_scrub_all.timer => xfs_scrub_all.timer.in} (77%) diff --git a/scrub/Makefile b/scrub/Makefile index 1e1109048c2a83..934b9062651bf1 100644 --- a/scrub/Makefile +++ b/scrub/Makefile @@ -108,10 +108,14 @@ endif # Automatically trigger a media scan once per month XFS_SCRUB_ALL_AUTO_MEDIA_SCAN_INTERVAL=1mo -LDIRT = $(XFS_SCRUB_ALL_PROG) $(XFS_SCRUB_FAIL_PROG) *.service *.cron +LDIRT = $(XFS_SCRUB_ALL_PROG) $(XFS_SCRUB_FAIL_PROG) *.service *.cron xfs_scrub_all.timer default: depend $(LTCOMMAND) $(XFS_SCRUB_ALL_PROG) $(XFS_SCRUB_FAIL_PROG) $(OPTIONAL_TARGETS) +xfs_scrub_all.timer: xfs_scrub_all.timer.in $(builddefs) + @echo " [SED] $@" + $(Q)$(SED) -e "s|@pkg_state_dir@|$(PKG_STATE_DIR)|g" < $< > $@ + xfs_scrub_all: xfs_scrub_all.in $(builddefs) @echo " [SED] $@" $(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" \ diff --git a/scrub/xfs_scrub_all.timer b/scrub/xfs_scrub_all.timer.in similarity index 77% rename from scrub/xfs_scrub_all.timer rename to scrub/xfs_scrub_all.timer.in index f0c557fc380391..9008f036d496c0 100644 --- a/scrub/xfs_scrub_all.timer +++ b/scrub/xfs_scrub_all.timer.in @@ -1,10 +1,11 @@ # SPDX-License-Identifier: GPL-2.0-or-later # -# Copyright (C) 2018-2024 Oracle. All Rights Reserved. +# Copyright (C) 2018-2025 Oracle. All Rights Reserved. # Author: Darrick J. Wong <djwong@xxxxxxxxxx> [Unit] Description=Periodic XFS Online Metadata Check for All Filesystems +ConditionPathIsReadWrite=@pkg_state_dir@ [Timer] # Run on Sunday at 3:10am, to avoid running afoul of DST changes