4 Commits

Author SHA256 Message Date
bfa2b770d9 Accepting request 1307877 from filesystems
OBS-URL: https://build.opensuse.org/request/show/1307877
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cachefilesd?expand=0&rev=26
2025-09-29 14:39:07 +00:00
e53f0b837b - Add patch cachefilesd-nohang-at-reboot.patch
* Try to start before network file systems
  * Should also stop after network file systems but before network

OBS-URL: https://build.opensuse.org/package/show/filesystems/cachefilesd?expand=0&rev=28
2025-09-29 14:01:59 +00:00
89520e9a66 Accepting request 1266716 from filesystems
OBS-URL: https://build.opensuse.org/request/show/1266716
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cachefilesd?expand=0&rev=25
2025-04-03 14:49:51 +00:00
David Sterba
749ba06ffa - Fix cachefilesd startup failure (bsc#1239807)
- remove cachefilesd-loadmod.patch
  The patch would explicitly attempt to load the cachefilesd module at
  startup and fail with -EPERM when started from the systemd unit file,
  as system is by default enforcing a strict seccomp policy that denies
  the finit_module (among many other privileged operations).
  Since the systemd unit file is already loading the cachefilesd module
  before starting the daemon, there is no need to repeat loading from
  within the daemon code, so the patch can be dropped.

OBS-URL: https://build.opensuse.org/package/show/filesystems/cachefilesd?expand=0&rev=26
2025-04-02 23:47:22 +00:00
4 changed files with 58 additions and 87 deletions

View File

@@ -1,81 +0,0 @@
Index: cachefilesd.c
===================================================================
--- cachefilesd.c.orig
+++ cachefilesd.c
@@ -53,6 +53,7 @@
#include <sys/time.h>
#include <sys/vfs.h>
#include <sys/stat.h>
+#include <libkmod.h>
typedef enum objtype {
OBJTYPE_INDEX,
@@ -292,6 +293,9 @@ int main(int argc, char *argv[])
long page_size;
int _cachefd, nullfd, opt, loop, open_max;
bool nodaemon = false;
+ struct kmod_ctx *ctx;
+ struct kmod_module *mod;
+ int kmod_status;
/* handle help request */
if (argc == 2 && strcmp(argv[1], "--help") == 0)
@@ -366,6 +370,29 @@ int main(int argc, char *argv[])
/* just in case... */
sync();
+ if (!(ctx = kmod_new(NULL, NULL))) {
+ oserror("Failed to allocate memory for kmod.");
+ }
+
+ kmod_load_resources(ctx);
+
+ kmod_status = kmod_module_new_from_name(ctx, "cachefiles", &mod);
+
+ if(kmod_status < 0) oserror("Cannot load cachefiles module");
+
+ kmod_status = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST,NULL, NULL, NULL, NULL);
+
+ if (kmod_status == 0)
+ info("Inserted module '%s'", kmod_module_get_name(mod));
+ else if (kmod_status == KMOD_PROBE_APPLY_BLACKLIST)
+ oserror("Module '%s' is blacklisted", kmod_module_get_name(mod));
+ else {
+ oserror("Failed to insert '%s'", kmod_module_get_name(mod));
+ }
+
+ kmod_module_unref(mod);
+ kmod_unref(ctx);
+
/* open the devfile or the procfile on fd 3 */
_cachefd = open(devfile, O_RDWR);
if (_cachefd < 0) {
Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -29,6 +29,8 @@ AC_SUBST([systemdsystemunitdir], [$with_
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+PKG_CHECK_MODULES([KMOD], [libkmod])
+
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
Index: Makefile.am
===================================================================
--- Makefile.am.orig
+++ Makefile.am
@@ -8,7 +8,8 @@ endif
sysconf_DATA = cachefilesd.conf
-cachefilesd_CFLAGS = -fwhole-program
+cachefilesd_CFLAGS = $(KMOD_CFLAGS) -fwhole-program
+cachefilesd_LDADD = $(KMOD_LIBS)
cachefilesd_SOURCES = cachefilesd.c
dist_man8_MANS = cachefilesd.8
-dist_man5_MANS = cachefilesd.conf.5
\ No newline at end of file
+dist_man5_MANS = cachefilesd.conf.5

View File

@@ -0,0 +1,31 @@
It helps a lot if the caching management daemon
goes down before remote network file systems and
the network it self. Otherwise one have to wait
at shutdown up to the point where systemd kills
the daemon due to the timeout:
[* ] A stop job is running for Local network file caching management daemon (6min / 6min)
---
cachefilesd.service | 8 ++++++++
1 file changed, 8 insertions(+)
--- cachefilesd.service
+++ cachefilesd.service 2025-09-08 07:15:41.715782827 +0000
@@ -1,7 +1,15 @@
[Unit]
Description=Local network file caching management daemon
+Before=remote-fs.target
+Before=autofs.service
[Service]
+Restart=no
+IgnoreSIGPIPE=no
+KillMode=process
+RemainAfterExit=yes
+RuntimeDirectory=cachefilesd
+ExecStartPre=-/sbin/modprobe -qab cachefiles
ExecStart=/usr/sbin/cachefilesd -s -n
[Install]

View File

@@ -1,3 +1,25 @@
-------------------------------------------------------------------
Mon Sep 8 07:44:57 UTC 2025 - Dr. Werner Fink <werner@suse.de>
- Add patch cachefilesd-nohang-at-reboot.patch
* Try to start before network file systems
* Should also stop after network file systems but before network
-------------------------------------------------------------------
Wed Mar 19 21:18:39 UTC 2025 - Anthony Iliopoulos <ailiop@suse.com>
- Fix cachefilesd startup failure (bsc#1239807)
- remove cachefilesd-loadmod.patch
The patch would explicitly attempt to load the cachefilesd module at
startup and fail with -EPERM when started from the systemd unit file,
as system is by default enforcing a strict seccomp policy that denies
the finit_module (among many other privileged operations).
Since the systemd unit file is already loading the cachefilesd module
before starting the daemon, there is no need to repeat loading from
within the daemon code, so the patch can be dropped.
-------------------------------------------------------------------
Mon Feb 26 10:30:52 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@@ -1,7 +1,7 @@
#
# spec file for package cachefilesd
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -26,11 +26,10 @@ URL: https://people.redhat.com/~dhowells/fscache/
Source: http://people.redhat.com/~dhowells/fscache/%{name}-%{version}.tar.bz2
Patch0: cachefilesd-autotools.patch
Patch1: cachefilesd-config.patch
Patch2: cachefilesd-loadmod.patch
Patch3: cachefilesd-monitoring-howto-update.patch
Patch2: cachefilesd-monitoring-howto-update.patch
Patch3: cachefilesd-nohang-at-reboot.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libkmod-devel
BuildRequires: pkgconfig
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
@@ -43,8 +42,8 @@ caching framework for mounted filesystems.
%setup -q
%patch -P 0
%patch -P 1
%patch -P 2
%patch -P 3 -p1
%patch -P 2 -p1
%patch -P 3 -p0
%build
autoreconf -fiv