Hello community,

here is the log from the commit of package cachefilesd for openSUSE:Factory 
checked in at 2020-08-18 15:10:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cachefilesd (Old)
 and      /work/SRC/openSUSE:Factory/.cachefilesd.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cachefilesd"

Tue Aug 18 15:10:41 2020 rev:23 rq:827024 version:0.10.10

Changes:
--------
--- /work/SRC/openSUSE:Factory/cachefilesd/cachefilesd.changes  2015-10-08 
08:24:47.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.cachefilesd.new.3399/cachefilesd.changes        
2020-08-18 15:10:43.200032444 +0200
@@ -1,0 +2,7 @@
+Sun Aug 16 12:45:03 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 0.10.10:
+  * no changelog available 
+  - remove fix-cpu-spin.patch (solved differently upstream)
+
+-------------------------------------------------------------------

Old:
----
  cachefilesd-0.10.5.tar.bz2
  fix-cpu-spin.patch

New:
----
  cachefilesd-0.10.10.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cachefilesd.spec ++++++
--- /var/tmp/diff_new_pack.oq2f1i/_old  2020-08-18 15:10:45.160033256 +0200
+++ /var/tmp/diff_new_pack.oq2f1i/_new  2020-08-18 15:10:45.164033257 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package cachefilesd
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,29 +12,27 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           cachefilesd
-Version:        0.10.5
+Version:        0.10.10
 Release:        0
 Summary:        CacheFiles userspace management daemon
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          System/Daemons
-Url:            http://people.redhat.com/~dhowells/fscache/
+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
-Patch4:         fix-cpu-spin.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  libkmod-devel
-BuildRequires:  pkg-config
+BuildRequires:  pkgconfig
 BuildRequires:  systemd-rpm-macros
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %{?systemd_requires}
 
 %description
@@ -47,16 +45,15 @@
 %patch1
 %patch2
 %patch3 -p1
-%patch4 -p1
-autoreconf -fiv
 
 %build
+autoreconf -fiv
 %configure \
     --with-systemdsystemunitdir=%{_unitdir}
-make %{?_smp_mflags} %{?smp_mflags}
+%make_build %{?smp_mflags}
 
 %install
-make DESTDIR=%{buildroot} install %{?_smp_mflags}
+%make_install
 mkdir -p %{buildroot}%{_localstatedir}/cache/fscache
 install -m 644 cachefilesd.service %{buildroot}%{_unitdir}/cachefilesd.service
 ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
@@ -74,7 +71,6 @@
 %service_del_postun %{name}.service
 
 %files
-%defattr(-, root, root)
 %doc README *.txt
 %{_mandir}/man?/*
 %{_sbindir}/cachefilesd

++++++ cachefilesd-0.10.5.tar.bz2 -> cachefilesd-0.10.10.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/.gitignore 
new/cachefilesd-0.10.10/.gitignore
--- old/cachefilesd-0.10.5/.gitignore   2011-12-06 14:38:00.000000000 +0100
+++ new/cachefilesd-0.10.10/.gitignore  2017-03-08 17:38:13.000000000 +0100
@@ -1 +1,4 @@
 cachefilesd
+*.o
+*~
+\#*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/Makefile 
new/cachefilesd-0.10.10/Makefile
--- old/cachefilesd-0.10.5/Makefile     2011-12-06 14:38:00.000000000 +0100
+++ new/cachefilesd-0.10.10/Makefile    2017-03-08 17:38:13.000000000 +0100
@@ -1,9 +1,10 @@
-CFLAGS         := -g -O2 -Wall
+CFLAGS         := -g -O2 -Wall -Wsign-compare
 INSTALL                := install
 DESTDIR                :=
 ETCDIR         := /etc
 BINDIR         := /bin
 SBINDIR                := /sbin
+MANDIR         := /usr/share/man
 SPECFILE       := redhat/cachefilesd.spec
 
 LNS            := ln -sf
@@ -14,7 +15,8 @@
 #
 ###############################################################################
 VERSION                := $(word 2,$(shell grep "^Version:" $(SPECFILE)))
-TARBALL                := cachefilesd-$(VERSION).tar.bz2
+TARBALL                := cachefilesd-$(VERSION).tar
+ZTARBALL       := $(TARBALL).bz2
 
 ###############################################################################
 #
@@ -46,11 +48,11 @@
 # Install everything
 #
 ###############################################################################
-MAN5   := $(DESTDIR)/usr/share/man/man5
-MAN8   := $(DESTDIR)/usr/share/man/man8
+MAN5   := $(DESTDIR)$(MANDIR)/man5
+MAN8   := $(DESTDIR)$(MANDIR)/man8
 
 install: all
-       $(INSTALL) -D cachefilesd $(DESTDIR)$(SBINDIR)/cachefilesd
+       $(INSTALL) -D -m 0755 cachefilesd $(DESTDIR)$(SBINDIR)/cachefilesd
        $(INSTALL) -D -m 0644 cachefilesd.conf 
$(DESTDIR)$(ETCDIR)/cachefilesd.conf
        $(INSTALL) -D -m 0644 cachefilesd.conf.5 $(MAN5)/cachefilesd.conf.5
        $(INSTALL) -D -m 0644 cachefilesd.8 $(MAN8)/cachefilesd.8
@@ -73,10 +75,11 @@
 # Generate a tarball
 #
 ###############################################################################
-$(TARBALL):
+$(ZTARBALL):
        git archive --prefix=cachefilesd-$(VERSION)/ --format tar -o $(TARBALL) 
HEAD
+       bzip2 -9 <$(TARBALL) >$(ZTARBALL)
 
-tarball: $(TARBALL)
+tarball: $(ZTARBALL)
 
 ###############################################################################
 #
@@ -84,9 +87,10 @@
 #
 ###############################################################################
 SRCBALL        := rpmbuild/SOURCES/$(TARBALL)
+ZSRCBALL := rpmbuild/SOURCES/$(ZTARBALL)
 
 BUILDID        := .local
-dist   := $(word 2,$(shell grep "%dist" /etc/rpm/macros.dist))
+dist   := $(word 2,$(shell grep -r "^%dist" /etc/rpm /usr/lib/rpm))
 release        := $(word 2,$(shell grep ^Release: $(SPECFILE)))
 release        := $(subst %{?dist},$(dist),$(release))
 release        := $(subst %{?buildid},$(BUILDID),$(release))
@@ -109,7 +113,8 @@
        chmod ug-s rpmbuild
        mkdir -p rpmbuild/{SPECS,SOURCES,BUILD,BUILDROOT,RPMS,SRPMS}
        git archive --prefix=cachefilesd-$(VERSION)/ --format tar -o $(SRCBALL) 
HEAD
-       rpmbuild -ts $(SRCBALL) --define "_srcrpmdir rpmbuild/SRPMS" $(RPMFLAGS)
+       bzip2 -9 <$(SRCBALL) >$(ZSRCBALL)
+       rpmbuild -ts $(ZSRCBALL) --define "_srcrpmdir rpmbuild/SRPMS" 
$(RPMFLAGS)
        rpmbuild --rebuild $(SRPM) $(RPMBUILDDIRS) $(RPMFLAGS)
 
 rpmlint: rpm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/README 
new/cachefilesd-0.10.10/README
--- old/cachefilesd-0.10.5/README       2011-12-06 14:38:00.000000000 +0100
+++ new/cachefilesd-0.10.10/README      2017-03-08 17:38:13.000000000 +0100
@@ -114,6 +114,19 @@
        entries.  The permissible values are between 12 and 20, the latter
        indicating 1048576 entries.  The default is 12.
 
+ (*) resume_thresholds <blocks> <files>
+
+       Scanning to refill the cull table is suspended when all the objects in
+       a cache are pinned by a live network filesystem in the kernel and
+       there's nothing available to cull.  Scanning is resumed when the kernel
+       releases sufficient objects that either the number of objects released
+       exceeds the files parameter here or the cumulative i_blocks values
+       exceed the blocks parameter.  Either threshold can be disabled by
+       specifying it as "-".
+
+       The default is to ignore the block threshold and to resume when five or
+       more files have been released.
+
  (*) debug <mask>
 
        Specify a numeric bitmask to control debugging in the kernel module.
@@ -130,7 +143,7 @@
 
 The daemon is run as follows:
 
-       /sbin/cachefilesd [-d]* [-s] [-n] [-f <configfile>]
+       /sbin/cachefilesd [-d]* [-s] [-n] [-N] [-f <configfile>]
 
 The flags are:
 
@@ -147,6 +160,10 @@
 
        Don't daemonise and go into background.
 
+ (*) -N
+
+       Disable culling and scanning to fill the cull table.
+
  (*) -f <configfile>
 
        Use an alternative configuration file rather than the default one.
@@ -364,9 +381,9 @@
 
 The policy source files are for reference installed as:
 
-       /usr/share/doc/cachefilesd-*/cachefilesd.te
-       /usr/share/doc/cachefilesd-*/cachefilesd.fc
-       /usr/share/doc/cachefilesd-*/cachefilesd.if
+       /usr/share/doc/cachefilesd/cachefilesd.te
+       /usr/share/doc/cachefilesd/cachefilesd.fc
+       /usr/share/doc/cachefilesd/cachefilesd.if
 
 By default, the cache is located in /var/cache/fscache, but if it is desirable
 that it should be elsewhere, than either the above policy files must be
@@ -376,7 +393,7 @@
 For instructions on how to add an auxiliary policy to enable the cache to be
 located elsewhere when SELinux is in enforcing mode, please see:
 
-       /usr/share/doc/cachefilesd-*/move-cache.txt
+       /usr/share/doc/cachefilesd/move-cache.txt
 
 When the cachefilesd RPM is installed; alternatively, the document can be found
 in the sources.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/cachefilesd.8 
new/cachefilesd-0.10.10/cachefilesd.8
--- old/cachefilesd-0.10.5/cachefilesd.8        2011-12-06 14:38:00.000000000 
+0100
+++ new/cachefilesd-0.10.10/cachefilesd.8       2017-03-08 17:38:13.000000000 
+0100
@@ -11,14 +11,14 @@
 .SH NAME
 cachefilesd \- CacheFiles userspace management daemon
 .SH SYNOPSIS
-.B "cachefilesd [-d]* [-s] [-n] [-f <configfile>]"
+.B "cachefilesd [-d]* [-s] [-n] [-N] [-f <configfile>]"
 .SH DESCRIPTION
 The \fBcachefilesd\fP daemon manages the cache data store that is used by
 network filesystems such a AFS and NFS to cache data locally on disk.
 .P
 The README file should be read before attempting to configure this facility:
 .IP
-/usr/share/doc/cachefilesd-*/README
+/usr/share/doc/cachefilesd/README
 .SH OPTIONS
 .TP
 .B -d
@@ -30,6 +30,9 @@
 .B -n
 Don't daemonise.
 .TP
+.B -N
+Disable culling and scanning to fill the cull table.
+.TP
 .BI "-p <pidfile>"
 Use an alternate PID file to /var/run/cachefilesd.pid.
 .TP
@@ -38,7 +41,7 @@
 .SH FILES
 .BR /etc/cachefilesd.conf
 .SH SEE ALSO
-\fBcachefilesd.conf\fR(5), /usr/share/doc/cachefilesd-*/README
+\fBcachefilesd.conf\fR(5), /usr/share/doc/cachefilesd/README
 .SH AUTHORS
 .br
 David Howells <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/cachefilesd.c 
new/cachefilesd-0.10.10/cachefilesd.c
--- old/cachefilesd-0.10.5/cachefilesd.c        2011-12-06 14:38:00.000000000 
+0100
+++ new/cachefilesd-0.10.10/cachefilesd.c       2017-03-08 17:38:13.000000000 
+0100
@@ -27,10 +27,11 @@
  * NUL characters are cause for error
  */
 
-#define CACHEFILESD_VERSION "0.10.2"
+#define CACHEFILESD_VERSION "0.10.10"
 
 #define _GNU_SOURCE
 #include <stdarg.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -45,6 +46,8 @@
 #include <dirent.h>
 #include <time.h>
 #include <poll.h>
+#include <limits.h>
+#include <grp.h>
 #include <sys/inotify.h>
 #include <sys/time.h>
 #include <sys/vfs.h>
@@ -65,9 +68,9 @@
        DIR             *dir;           /* this object's directory (or NULL for 
data obj) */
        ino_t           ino;            /* inode number of this object */
        int             usage;          /* number of users of this object */
-       char            empty;          /* T if directory empty */
-       char            new;            /* T if object new */
-       char            cullable;       /* T if object now cullable */
+       bool            empty;          /* T if directory empty */
+       bool            new;            /* T if object new */
+       bool            cullable;       /* T if object now cullable */
        objtype_t       type;           /* type of object */
        time_t          atime;          /* last access time on this object */
        char            name[1];        /* name of this object */
@@ -81,11 +84,11 @@
 };
 
 static int nobjects = 1;
-static int nopendir = 0;
+static int nopendir;
 
 /* current scan point */
-static struct object *scan = &root;
-static int jumpstart_scan = 0;
+static struct object *scan_cursor;
+static bool scan_signalled, stop_signalled, reap_signalled;
 
 /* ranked order of cullable objects
  * - we have two tables: one we're building and one that's full of ready to be
@@ -95,9 +98,13 @@
 static struct object **cullbuild;
 static struct object **cullready;
 
-static int oldest_build = -1;
-static int oldest_ready = -1;
-static int ncullable = 0;
+static unsigned nr_in_build_table;
+static unsigned nr_in_ready_table;
+static int ncullable;
+static bool kernel_wants_cull;
+static bool have_nr_releases;
+static unsigned long long f_released_since_last_scan;
+static unsigned long long b_released_since_last_scan;
 
 
 static const char *configfile = "/etc/cachefilesd.conf";
@@ -106,10 +113,15 @@
 static const char *pidfile = "/var/run/cachefilesd.pid";
 static char *cacheroot, *graveyardpath;
 
-static int xdebug, xnolog, xopenedlog;
-static int stop, reap, cull, nocull; //, statecheck;
+static bool culling_disabled;
+static bool xnolog, xopenedlog;
+static int xdebug;
 static int graveyardfd;
 static unsigned long long brun, bcull, bstop, frun, fcull, fstop;
+static unsigned long long b_resume_threshold = ULLONG_MAX;
+static unsigned long long f_resume_threshold = 5;
+
+static const gid_t group_list[0];
 
 #define cachefd 3
 
@@ -154,7 +166,7 @@
        else {
                if (!xopenedlog) {
                        openlog("cachefilesd", LOG_PID, LOG_DAEMON);
-                       xopenedlog = 1;
+                       xopenedlog = true;
                }
 
                va_start(va, fmt);
@@ -186,7 +198,7 @@
                else if (!xnolog) {
                        if (!xopenedlog) {
                                openlog("cachefilesd", LOG_PID, LOG_DAEMON);
-                               xopenedlog = 1;
+                               xopenedlog = true;
                        }
 
                        va_start(va, fmt);
@@ -209,7 +221,8 @@
 static void read_cache_state(void);
 static int is_object_in_use(const char *filename);
 static void cull_file(const char *filename);
-static void build_cull_table(void);
+static void begin_building_cull_table(void);
+static bool build_cull_table(void);
 static void decant_cull_table(void);
 static void insert_into_cull_table(struct object *object);
 static void put_object(struct object *object);
@@ -225,7 +238,7 @@
  */
 static void sigterm(int sig)
 {
-       stop = 1;
+       stop_signalled = true;
 }
 
 /*****************************************************************************/
@@ -234,7 +247,7 @@
  */
 static void sigio(int sig)
 {
-       reap = 1;
+       reap_signalled = true;
 }
 
 /*****************************************************************************/
@@ -243,7 +256,7 @@
  */
 static void sigalrm(int sig)
 {
-       jumpstart_scan = 1;
+       scan_signalled = true;
 }
 
 /*****************************************************************************/
@@ -276,7 +289,8 @@
        FILE *config;
        char *line, *cp;
        long page_size;
-       int _cachefd, nullfd, opt, loop, open_max, nodaemon = 0;
+       int _cachefd, nullfd, opt, loop, open_max;
+       bool nodaemon = false;
 
        /* handle help request */
        if (argc == 2 && strcmp(argv[1], "--help") == 0)
@@ -286,7 +300,7 @@
                version();
 
        /* parse the arguments */
-       while (opt = getopt(argc, argv, "dsnf:p:v"),
+       while (opt = getopt(argc, argv, "dsnNf:p:v"),
               opt != EOF
               ) {
                switch (opt) {
@@ -297,12 +311,17 @@
 
                case 's':
                        /* disable syslog writing */
-                       xnolog = 1;
+                       xnolog = true;
                        break;
 
                case 'n':
                        /* don't daemonise */
-                       nodaemon = 1;
+                       nodaemon = true;
+                       break;
+
+               case 'N':
+                       /* disable culling */
+                       culling_disabled = true;
                        break;
 
                case 'f':
@@ -334,6 +353,9 @@
                oserror("Unable to get max open files");
 
        /* become owned by root */
+       if (setgroups(sizeof(group_list) / sizeof(gid_t), group_list) < 0)
+               oserror("Unable to clear the supplementary groups");
+
        if (setresuid(0, 0, 0) < 0)
                oserror("Unable to set UID to 0");
 
@@ -410,7 +432,7 @@
                /*  allow culling to be disabled */
                if (memcmp(cp, "nocull", 6) == 0 &&
                    (!cp[6] || isspace(cp[6]))) {
-                       nocull = 1;
+                       culling_disabled = true;
                }
 
                /* note the cull table size command */
@@ -429,6 +451,44 @@
                        continue;
                }
 
+               /* Note the suspension resume released file count thresholds
+                * ("-" to disable a threshold).
+                */
+               if (memcmp(cp, "resume_thresholds", 18) == 0 && 
isspace(cp[18])) {
+                       unsigned long long b_thresh, f_thresh;
+                       char *sp;
+
+                       for (sp = cp + 18; isspace(*sp); sp++) {;}
+
+                       if (*sp == '-') {
+                               sp++;
+                               b_thresh = ULLONG_MAX;
+                       } else {
+                               b_thresh = strtoul(sp, &sp, 10);
+                       }
+
+                       if (!*sp || !isspace(*sp))
+                               cfgerror("Error parsing resume threshold 
(blocks)");
+                       if (b_thresh == 0)
+                               cfgerror("Invalid resume threshold (blocks)");
+                       for (; isspace(*sp); sp++) {;}
+
+                       if (*sp == '-') {
+                               sp++;
+                               f_thresh = ULLONG_MAX;
+                       } else {
+                               f_thresh = strtoul(sp, &sp, 10);
+                               if (*sp)
+                                       cfgerror("Error parsing resume 
threshold (files)");
+                               if (f_thresh == 0)
+                                       cfgerror("Invalid resume threshold 
(files)");
+                       }
+
+                       b_resume_threshold = b_thresh;
+                       f_resume_threshold = f_thresh;
+                       continue;
+               }
+
                /* note the dir command */
                if (memcmp(cp, "dir", 3) == 0 && isspace(cp[3])) {
                        char *sp;
@@ -469,7 +529,7 @@
                oserror("Unable to close %s", configfile);
 
        /* allocate the cull tables */
-       if (!nocull) {
+       if (!culling_disabled) {
                cullbuild = calloc(culltable_size, sizeof(cullbuild[0]));
                if (!cullbuild)
                        oserror("calloc");
@@ -491,7 +551,7 @@
        /* set up a connection to syslog whilst we still can (the bind command
         * will give us our own namespace with no /dev/log */
        openlog("cachefilesd", LOG_PID, LOG_DAEMON);
-       xopenedlog = 1;
+       xopenedlog = true;
        info("About to bind cache");
 
        /* now issue the bind command */
@@ -559,10 +619,10 @@
        if (fstatfs(graveyardfd, &sfs) < 0)
                oserror("Unable to stat cache filesystem");
 
-       if (sfs.f_bsize == -1 ||
-           sfs.f_blocks == -1 ||
-           sfs.f_bfree == -1 ||
-           sfs.f_bavail == -1)
+       if (sfs.f_bsize  + 1 == 0 ||
+           sfs.f_blocks + 1 == 0 ||
+           sfs.f_bfree  + 1 == 0 ||
+           sfs.f_bavail + 1 == 0)
                error("Backing filesystem returns unusable statistics through 
fstatfs()");
 }
 
@@ -573,6 +633,8 @@
 static void cachefilesd(void)
 {
        sigset_t sigs, osigs;
+       bool scanning_suspended = false;
+       bool scan_in_progress = false;
 
        struct pollfd pollfds[1] = {
                [0] = {
@@ -586,13 +648,14 @@
        /* open the cache directories */
        open_cache();
 
-       /* we need to disable I/O and termination signals so they're only
-        * caught at appropriate times
+       /* We need to be able to disable signals that we need to check for
+        * before calling poll so that we don't race and miss something.
         */
        sigemptyset(&sigs);
        sigaddset(&sigs, SIGIO);
        sigaddset(&sigs, SIGINT);
        sigaddset(&sigs, SIGTERM);
+       sigaddset(&sigs, SIGALRM);
 
        signal(SIGTERM, sigterm);
        signal(SIGINT, sigterm);
@@ -600,16 +663,81 @@
        /* check the graveyard for graves */
        reap_graveyard();
 
-       while (!stop) {
+       while (!stop_signalled) {
+               bool do_cull = false;
+
+               debug(3, "Loop %sbuild=%d ready=%d susp=%u scan=%u",
+                     culling_disabled ? "NOCULL " : "",
+                     nr_in_build_table, nr_in_ready_table,
+                     scanning_suspended, scan_in_progress);
+
                read_cache_state();
 
-               /* sleep without racing on reap and cull with the signal
-                * handlers */
-               if (!scan && !reap && !cull) {
+               if (!culling_disabled) {
+                       /* Determine if we're going to need to start a new scan
+                        * to refill the cull table.  We want to do this if the
+                        * secondary cull table is less than half full - but
+                        * overriding that, we don't want to do this if we know
+                        * there's insufficient cullables to make it worth
+                        * while.
+                        */
+                       if (!scan_in_progress) {
+                               bool begin_scan = false;
+
+                               debug(1, "Consider scan %d/%d",
+                                     nr_in_build_table, culltable_size / 2);
+
+                               if (nr_in_build_table < culltable_size / 2) {
+                                       debug(1, "Want to scan");
+                                       begin_scan = true;
+                               }
+
+                               if (begin_scan && scanning_suspended) {
+                                       debug(1, "Scanning suspended");
+                                       if (have_nr_releases) {
+                                               if (f_released_since_last_scan <
+                                                   f_resume_threshold &&
+                                                   b_released_since_last_scan <
+                                                   b_resume_threshold)
+                                                       begin_scan = false;
+                                       } else {
+                                               begin_scan = scan_signalled;
+                                       }
+                               }
+
+                               if (begin_scan) {
+                                       debug(1, "Beginning a scan");
+                                       begin_building_cull_table();
+                                       scan_in_progress = true;
+                                       scanning_suspended = false;
+                                       scan_signalled = false;
+                                       f_released_since_last_scan = 0;
+                                       b_released_since_last_scan = 0;
+                               }
+                       }
+
+                       /* Determine if there's anything we can actually cull 
yet if
+                        * the kernel is calling for space.
+                        */
+                       if (kernel_wants_cull) {
+                               debug(1, "Want to cull");
+                               if (nr_in_ready_table > 0)
+                                       do_cull = true;
+                       }
+               }
+
+               /* We block the signals across the checks for reap, cull and
+                * scan initiation before polling so that we sleep without
+                * racing against the signal handlers.
+                */
+               if (!scan_in_progress && !reap_signalled && !do_cull) {
                        if (sigprocmask(SIG_BLOCK, &sigs, &osigs) < 0)
                                oserror("Unable to block signals");
 
-                       if (!reap && !cull) {
+                       if (!reap_signalled &&
+                           !stop_signalled &&
+                           !scan_signalled) {
+                               debug(1, "Poll");
                                if (ppoll(pollfds, 1, NULL, &osigs) < 0 &&
                                    errno != EINTR)
                                        oserror("Unable to suspend process");
@@ -617,37 +745,44 @@
 
                        if (sigprocmask(SIG_UNBLOCK, &sigs, NULL) < 0)
                                oserror("Unable to unblock signals");
-
-                       read_cache_state();
+                       continue;
                }
 
-               if (nocull) {
-                       cull = 0;
-               } else {
-                       if (jumpstart_scan) {
-                               jumpstart_scan = 0;
-                               if (!stop && !scan) {
-                                       debug(1, "Refilling cull table");
-                                       root.usage++;
-                                       scan = &root;
+               if (!culling_disabled) {
+                       if (do_cull)
+                               cull_objects();
+
+                       if (scan_in_progress) {
+                               scan_in_progress = build_cull_table();
+                               if (!scan_in_progress) {
+                                       /* Scan complete.
+                                        *
+                                        * If the scan didn't produce a full
+                                        * table then don't repeat the scan
+                                        * until something gets released by the
+                                        * kernel.
+                                        */
+                                       if (nr_in_build_table < culltable_size) 
{
+                                               debug(1, "Suspend scanning");
+                                               scanning_suspended = true;
+                                               if (!have_nr_releases) {
+                                                       signal(SIGALRM, 
sigalrm);
+                                                       alarm(30);
+                                               }
+                                       }
                                }
                        }
 
-                       if (cull) {
-                               if (oldest_ready >= 0)
-                                       cull_objects();
-                               else if (oldest_build < 0)
-                                       jumpstart_scan = 1;
+                       if (!scan_in_progress) {
+                               if (nr_in_ready_table <= culltable_size / 2 + 2 
&&
+                                   nr_in_build_table > 0) {
+                                       debug(1, "Decant");
+                                       decant_cull_table();
+                               }
                        }
-
-                       if (scan)
-                               build_cull_table();
-
-                       if (!scan && oldest_ready < 0 && oldest_build >= 0)
-                               decant_cull_table();
                }
 
-               if (reap)
+               if (reap_signalled)
                        reap_graveyard();
        }
 
@@ -662,7 +797,7 @@
 static void reap_graveyard(void)
 {
        /* set a one-shot notification to catch more graves appearing */
-       reap = 0;
+       reap_signalled = false;
        signal(SIGIO, sigio);
        if (fcntl(graveyardfd, F_NOTIFY, DN_CREATE) < 0)
                oserror("unable to set notification on graveyard");
@@ -676,9 +811,11 @@
  */
 static void reap_graveyard_aux(const char *dirname)
 {
-       struct dirent dirent, *de;
+       struct dirent *de;
+       size_t len;
+       char name[NAME_MAX + 1];
+       bool deleted;
        DIR *dir;
-       int deleted, ret;
 
        if (chdir(dirname) < 0)
                oserror("chdir failed");
@@ -691,44 +828,51 @@
                /* removing directory entries may cause us to skip when reading
                 * them */
                rewinddir(dir);
-               deleted = 0;
+               deleted = false;
 
-               while (ret = readdir_r(dir, &dirent, &de),
-                      ret == 0 && de != NULL
+               while (errno = 0,
+                      de = readdir(dir),
+                      de != NULL
                       ) {
                        /* ignore "." and ".." */
-                       if (dirent.d_name[0] == '.') {
-                               if (dirent.d_name[1] == '\0')
+                       if (de->d_name[0] == '.') {
+                               if (de->d_name[1] == '\0')
                                        continue;
-                               if (dirent.d_name[1] == '.' ||
-                                   dirent.d_name[1] == '\0')
+                               if (de->d_name[1] == '.' ||
+                                   de->d_name[1] == '\0')
                                        continue;
                        }
 
-                       deleted = 1;
+                       deleted = true;
 
                        /* attempt to unlink non-directory files */
-                       if (dirent.d_type != DT_DIR) {
-                               debug(1, "unlink %s", dirent.d_name);
-                               if (unlink(dirent.d_name) == 0)
+                       if (de->d_type != DT_DIR) {
+                               debug(1, "unlink %s", de->d_name);
+                               if (unlink(de->d_name) == 0)
                                        continue;
                                if (errno != EISDIR)
                                        oserror("Unable to unlink file %s",
-                                               dirent.d_name);
+                                               de->d_name);
                        }
 
                        /* recurse into directories */
-                       memcpy(&dirent, de, sizeof(dirent));
+                       len = strlen(de->d_name) + 1;
+                       if (len > sizeof(name)) {
+                               errno = ENAMETOOLONG;
+                               oserror("Name longer than NAME_MAX \"%s\"",
+                                       de->d_name);
+                       }
+                       memcpy(name, de->d_name, len);
 
-                       reap_graveyard_aux(dirent.d_name);
+                       reap_graveyard_aux(name);
 
                        /* which we then attempt to remove */
-                       debug(1, "rmdir %s", dirent.d_name);
-                       if (rmdir(dirent.d_name) < 0)
-                               oserror("Unable to remove dir %s", 
dirent.d_name);
+                       debug(1, "rmdir %s", name);
+                       if (rmdir(name) < 0)
+                               oserror("Unable to remove dir %s", name);
                }
 
-               if (ret < 0)
+               if (errno != 0)
                        oserror("Unable to read dir %s", dirname);
        } while (deleted);
 
@@ -752,6 +896,8 @@
                oserror("Unable to read cache state");
        buffer[n] = '\0';
 
+       debug(3, "KERNEL: %s", buffer);
+
        tok = buffer;
        do {
                next = strpbrk(tok, " \t");
@@ -759,23 +905,34 @@
                        *next++ = '\0';
 
                arg = strchr(tok, '=');
-               if (arg)
+               if (arg) {
                        *arg++ = '\0';
+               } else {
+                       debug(0, "Warning: malformed output from kernel, 
missing arg to [%s]", tok);
+                       continue;
+               }
 
-               if (strcmp(tok, "cull") == 0)
-                       cull = strtoul(arg, NULL, 0);
-               else if (strcmp(tok, "brun") == 0)
+               if (strcmp(tok, "cull") == 0) {
+                       kernel_wants_cull = (strtoul(arg, NULL, 0) != 0);
+               } else if (strcmp(tok, "brun") == 0) {
                        brun = strtoull(arg, NULL, 16);
-               else if (strcmp(tok, "bcull") == 0)
+               } else if (strcmp(tok, "bcull") == 0) {
                        bcull = strtoull(arg, NULL, 16);
-               else if (strcmp(tok, "bstop") == 0)
+               } else if (strcmp(tok, "bstop") == 0) {
                        bstop = strtoull(arg, NULL, 16);
-               else if (strcmp(tok, "frun") == 0)
+               } else if (strcmp(tok, "frun") == 0) {
                        frun = strtoull(arg, NULL, 16);
-               else if (strcmp(tok, "fcull") == 0)
+               } else if (strcmp(tok, "fcull") == 0) {
                        fcull = strtoull(arg, NULL, 16);
-               else if (strcmp(tok, "fstop") == 0)
+               } else if (strcmp(tok, "fstop") == 0) {
                        fstop = strtoull(arg, NULL, 16);
+               } else if (strcmp(tok, "breleased") == 0) {
+                       b_released_since_last_scan += strtoull(arg, NULL, 16);
+                       have_nr_releases = true;
+               } else if (strcmp(tok, "freleased") == 0) {
+                       f_released_since_last_scan += strtoull(arg, NULL, 16);
+                       have_nr_releases = true;
+               }
 
        } while ((tok = next));
 }
@@ -854,7 +1011,7 @@
                oserror("Unable to alloc object");
 
        object->usage = 1;
-       object->new = 1;
+       object->new = true;
 
        object->ino = st->st_ino;
        object->atime = st->st_atime;
@@ -984,21 +1141,21 @@
                error("NULL object pointer");
 
        /* just insert if table is empty */
-       if (oldest_build == -1) {
+       if (nr_in_build_table == 0) {
                object->usage++;
-               oldest_build = 0;
                cullbuild[0] = object;
+               nr_in_build_table++;
                return;
        }
 
        /* insert somewhere if table is not full */
-       if (oldest_build < culltable_size - 1) {
+       if (nr_in_build_table < culltable_size) {
                object->usage++;
-               oldest_build++;
 
                /* just insert at end if new oldest object */
-               if (object->atime <= cullbuild[oldest_build - 1]->atime) {
-                       cullbuild[oldest_build] = object;
+               if (object->atime <= cullbuild[nr_in_build_table - 1]->atime) {
+                       cullbuild[nr_in_build_table] = object;
+                       nr_in_build_table++;
                        return;
                }
 
@@ -1006,25 +1163,27 @@
                if (object->atime > cullbuild[0]->atime) {
                        memmove(&cullbuild[1],
                                &cullbuild[0],
-                               oldest_build * sizeof(cullbuild[0]));
+                               nr_in_build_table * sizeof(cullbuild[0]));
 
                        cullbuild[0] = object;
+                       nr_in_build_table++;
                        return;
                }
 
                /* if only two objects in list then insert between them */
-               if (oldest_build == 2) {
+               if (nr_in_build_table == 2) {
                        cullbuild[2] = cullbuild[1];
                        cullbuild[1] = object;
+                       nr_in_build_table++;
                        return;
                }
 
                /* insert somewhere in between front and back elements
-                * of a three object list
+                * of a three-plus object list
                 * - oldest_build == #objects_currently_in_list
                 */
                y = 1;
-               o = oldest_build - 1;
+               o = nr_in_build_table - 1;
 
                do {
                        m = (y + o) / 2;
@@ -1038,14 +1197,15 @@
 
                memmove(&cullbuild[y + 1],
                        &cullbuild[y],
-                       (oldest_build - y) * sizeof(cullbuild[0]));
+                       (nr_in_build_table - y) * sizeof(cullbuild[0]));
 
                cullbuild[y] = object;
+               nr_in_build_table++;
                return;
        }
 
        /* if table is full then insert only if older than newest */
-       if (oldest_build > culltable_size - 1)
+       if (nr_in_build_table > culltable_size)
                error("Cull table overfull");
 
        if (object->atime >= cullbuild[0]->atime)
@@ -1105,19 +1265,32 @@
 
 /*****************************************************************************/
 /*
- * do the next step in building up the cull table
+ * Begin a scan to build a cull table.
+ */
+static void begin_building_cull_table(void)
+{
+       debug(1, "Refilling cull table");
+       root.usage++;
+       scan_cursor = &root;
+}
+
+/*****************************************************************************/
+/*
+ * Do the next step in building up the cull table.  Returns false upon
+ * completion of a scan.
  */
-static void build_cull_table(void)
+static bool build_cull_table(void)
 {
-       struct dirent dirent, *de;
+       struct dirent *de;
        struct object *curr, *child;
        struct stat64 st;
-       int loop, fd;
+       unsigned loop;
+       int fd;
 
-       curr = scan;
+       curr = scan_cursor;
 
        if (!curr->dir) {
-               curr->empty = 1;
+               curr->empty = true;
 
                fd = openat(dirfd(curr->parent->dir), curr->name, O_DIRECTORY);
                if (fd < 0) {
@@ -1140,38 +1313,37 @@
 
 next:
        /* read the next directory entry */
-       if (readdir_r(curr->dir, &dirent, &de) < 0) {
-               if (errno == ENOENT)
+       errno = 0;
+       de = readdir(curr->dir);
+       if (!de) {
+               if (errno == 0 || errno == ENOENT)
                        goto dir_read_complete;
                oserror("Unable to read directory");
        }
 
-       if (de == NULL)
-               goto dir_read_complete;
-
-       if (dirent.d_name[0] == '.') {
-               if (!dirent.d_name[1] ||
-                   (dirent.d_name[1] == '.' && !dirent.d_name[2]))
+       if (de->d_name[0] == '.') {
+               if (!de->d_name[1] ||
+                   (de->d_name[1] == '.' && !de->d_name[2]))
                        goto next;
        }
 
-       debug(2, "readdir '%s'", dirent.d_name);
+       debug(2, "readdir '%s'", de->d_name);
 
-       switch (dirent.d_type) {
+       switch (de->d_type) {
        case DT_UNKNOWN:
        case DT_DIR:
        case DT_REG:
                break;
        default:
-               oserror("readdir returned unsupported type %d", dirent.d_type);
+               oserror("readdir returned unsupported type %d", de->d_type);
        }
 
        /* delete any funny looking files */
-       if (memchr("IDSJET+@", dirent.d_name[0], 8) == NULL)
+       if (memchr("IDSJET+@", de->d_name[0], 8) == NULL)
                goto found_unexpected_object;
 
        /* see if this object is already known to us */
-       if (fstatat64(dirfd(curr->dir), dirent.d_name, &st, 0) < 0) {
+       if (fstatat64(dirfd(curr->dir), de->d_name, &st, 0) < 0) {
                if (errno == ENOENT)
                        goto next;
                oserror("Failed to stat directory");
@@ -1179,18 +1351,18 @@
 
        if (!S_ISDIR(st.st_mode) &&
            (!S_ISREG(st.st_mode) ||
-            dirent.d_name[0] == 'I' ||
-            dirent.d_name[0] == 'J' ||
-            dirent.d_name[0] == '@' ||
-            dirent.d_name[0] == '+'))
+            de->d_name[0] == 'I' ||
+            de->d_name[0] == 'J' ||
+            de->d_name[0] == '@' ||
+            de->d_name[0] == '+'))
                goto found_unexpected_object;
 
        /* create a representation for this object */
-       child = create_object(curr, dirent.d_name, &st);
+       child = create_object(curr, de->d_name, &st);
        if (!child && errno == ENOENT)
                goto next;
 
-       curr->empty = 0;
+       curr->empty = false;
 
        if (!child)
                oserror("Unable to create object");
@@ -1213,45 +1385,41 @@
                                goto next;
                        }
 
-                       for (loop = 0; loop <= oldest_ready; loop++)
+                       for (loop = 0; loop < nr_in_ready_table; loop++)
                                if (cullready[loop] == child)
                                        break;
 
-                       if (loop == oldest_ready) {
+                       if (loop == nr_in_ready_table - 1) {
                                /* child was oldest object */
-                               cullready[oldest_ready] = (void *)(0x6b000000 | 
__LINE__);
-                               oldest_ready--;
+                               cullready[--nr_in_ready_table] = (void 
*)(0x6b000000 | __LINE__);
                                put_object(child);
                                goto removed;
                        }
-                       else if (loop < oldest_ready) {
+                       else if (loop < nr_in_ready_table - 1) {
                                /* child was somewhere in between */
                                memmove(&cullready[loop],
                                        &cullready[loop + 1],
-                                       (oldest_ready - loop) * 
sizeof(cullready[0]));
-                               cullready[oldest_ready] = (void *)(0x6b000000 | 
__LINE__);
-                               oldest_ready--;
+                                       (nr_in_ready_table - (loop + 1)) * 
sizeof(cullready[0]));
+                               cullready[--nr_in_ready_table] = (void 
*)(0x6b000000 | __LINE__);
                                put_object(child);
                                goto removed;
                        }
 
-                       for (loop = 0; loop <= oldest_build; loop++)
+                       for (loop = 0; loop < nr_in_build_table; loop++)
                                if (cullbuild[loop] == child)
                                        break;
 
-                       if (loop == oldest_build) {
+                       if (loop == nr_in_build_table - 1) {
                                /* child was oldest object */
-                               cullbuild[oldest_build] = (void *)(0x6b000000 | 
__LINE__);
-                               oldest_build--;
+                               cullbuild[--nr_in_build_table] = (void 
*)(0x6b000000 | __LINE__);
                                put_object(child);
                        }
-                       else if (loop < oldest_build) {
+                       else if (loop < nr_in_build_table - 1) {
                                /* child was somewhere in between */
                                memmove(&cullbuild[loop],
                                        &cullbuild[loop + 1],
-                                       (oldest_build - loop) * 
sizeof(cullbuild[0]));
-                               cullbuild[oldest_build] = (void *)(0x6b000000 | 
__LINE__);
-                               oldest_build--;
+                                       (nr_in_build_table - (loop + 1)) * 
sizeof(cullbuild[0]));
+                               cullbuild[--nr_in_build_table] = (void 
*)(0x6b000000 | __LINE__);
                                put_object(child);
                        }
 
@@ -1260,9 +1428,9 @@
                }
 
                /* add objects that aren't in use to the cull table */
-               if (!is_object_in_use(dirent.d_name)) {
+               if (!is_object_in_use(de->d_name)) {
                        debug(2, "- insert");
-                       child->new = 0;
+                       child->new = false;
                        insert_into_cull_table(child);
                }
                put_object(child);
@@ -1273,11 +1441,11 @@
        case OBJTYPE_INTERMEDIATE:
                debug(2, "- descend");
 
-               child->new = 0;
-               scan = child;
+               child->new = false;
+               scan_cursor = child;
 
                debug(2, "<-- build_cull_table({%s})", curr->name);
-               return;
+               return true;
 
        default:
                error("Unexpected type");
@@ -1320,21 +1488,19 @@
                }
        }
 
-       scan = curr->parent;
-       if (!scan) {
+       scan_cursor = curr->parent;
+       if (!scan_cursor)
                debug(1, "Scan complete");
-               decant_cull_table();
-       }
 
        debug(2, "<-- build_cull_table({%s})", curr->name);
        put_object(curr);
-       return;
+       return scan_cursor != NULL;
 
        /* delete unexpected objects that we've found */
 found_unexpected_object:
        debug(2, "found_unexpected_object");
 
-       destroy_unexpected_object(curr, &dirent);
+       destroy_unexpected_object(curr, de);
        goto next;
 }
 
@@ -1344,72 +1510,63 @@
  */
 static void decant_cull_table(void)
 {
-       int loop, space, avail, copy, leave, n;
+       unsigned loop, avail, copy, leave, space, n;
 
-       if (scan)
+       if (scan_cursor)
                error("Can't decant cull table whilst scanning");
 
-       /* if nothing there, scan again in a short while */
-       if (oldest_build < 0) {
-               signal(SIGALRM, sigalrm);
-               alarm(30);
-               return;
-       }
-
        /* mark the new entries cullable */
-       for (loop = 0; loop <= oldest_build; loop++) {
+       for (loop = 0; loop < nr_in_build_table; loop++) {
                if (!cullbuild[loop]->cullable) {
-                       cullbuild[loop]->cullable = 1;
+                       cullbuild[loop]->cullable = true;
                        ncullable++;
                }
        }
 
        /* if the ready table is empty, copy the whole lot across */
-       if (oldest_ready == -1) {
-               copy = oldest_build + 1;
+       if (nr_in_ready_table == 0) {
+               copy = nr_in_build_table;
 
                debug(1, "Decant (all %d)", copy);
 
                n = copy * sizeof(cullready[0]);
                memcpy(cullready, cullbuild, n);
                memset(cullbuild, 0x6e, n);
-               oldest_ready = oldest_build;
-               oldest_build = -1;
+               nr_in_ready_table = nr_in_build_table;
+               nr_in_build_table = 0;
                goto check;
        }
 
        /* decant some of the build table if there's space */
-       space = culltable_size - (oldest_ready + 1);
-       if (space <= 0) {
-               if (space < 0)
-                       error("Less than zero space in ready table");
+       if (culltable_size < nr_in_ready_table)
+               error("Less than zero space in ready table");
+       space = culltable_size - nr_in_ready_table;
+       if (space == 0)
                goto check;
-       }
 
        /* work out how much of the build table we can copy */
-       copy = avail = oldest_build + 1;
+       copy = avail = nr_in_build_table;
        if (copy > space)
                copy = space;
        leave = avail - copy;
 
-       debug(1, "Decant (%d/%d to %d)", copy, avail, space);
+       debug(1, "Decant (%u/%u to %u)", copy, avail, space);
 
        /* make a hole in the ready table transfer "copy" elements from the end
         * of cullbuild (oldest) to the beginning of cullready (youngest)
         */
-       n = oldest_ready + 1;
-       memmove(&cullready[copy], &cullready[0], n * sizeof(cullready[0]));
-       oldest_ready += copy;
+       memmove(&cullready[copy], &cullready[0], nr_in_ready_table * 
sizeof(cullready[0]));
+       nr_in_ready_table += copy;
 
        memcpy(&cullready[0], &cullbuild[leave], copy * sizeof(cullready[0]));
        memset(&cullbuild[leave], 0x6b, copy * sizeof(cullbuild[0]));
-       oldest_build = leave - 1;
+       nr_in_build_table = leave;
 
        if (copy + leave > culltable_size)
                error("Scan table exceeded (%d+%d)", copy, leave);
 
 check:
-       for (loop = 0; loop < oldest_ready; loop++)
+       for (loop = 0; loop < nr_in_ready_table; loop++)
                if (((long)cullready[loop] & 0xf0000000) == 0x60000000)
                        abort();
 }
@@ -1486,18 +1643,8 @@
        if (ncullable <= 0)
                error("Cullable object count is inconsistent");
 
-       if (cullready[oldest_ready]->cullable) {
-               cull_object(cullready[oldest_ready]);
-               cullready[oldest_ready] = (void *)(0x6b000000 | __LINE__);
-               oldest_ready--;
-       }
-
-       /* must start refilling the cull table */
-       if (!scan && oldest_build <= culltable_size / 2 + 2) {
-               decant_cull_table();
-
-               debug(1, "Refilling cull table");
-               root.usage++;
-               scan = &root;
+       if (cullready[nr_in_ready_table - 1]->cullable) {
+               cull_object(cullready[nr_in_ready_table - 1]);
+               cullready[--nr_in_ready_table] = (void *)(0x6b000000 | 
__LINE__);
        }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/cachefilesd.conf.5 
new/cachefilesd-0.10.10/cachefilesd.conf.5
--- old/cachefilesd-0.10.5/cachefilesd.conf.5   2011-12-06 14:38:00.000000000 
+0100
+++ new/cachefilesd-0.10.10/cachefilesd.conf.5  2017-03-08 17:38:13.000000000 
+0100
@@ -75,6 +75,16 @@
 disables all culling activity.  The cache will keep building up to the limits
 set and won't be shrunk, except by the removal of out-dated cache files.
 .TP
+.B resume_thresholds <blocks> <files>
+This command specifies the amount of blocks or files that the kernel should let
+go of before the daemon should resume from culling table scan suspension.
+.IP
+Scanning to refill the cull table is suspended when all the objects in a cache
+are pinned by a live network filesystem in the kernel and there's nothing to
+cull.
+.IP
+Either value can be "-" to indicate that this threshold should be ignored.
+.TP
 .B debug <mask>
 This command specifies a numeric bitmask to control debugging in the kernel
 module.  The default is zero (all off).  The following values can be OR'd into
@@ -171,7 +181,7 @@
 .P
 Culling can be disabled with the \fBnocull\fP option.
 .SH SEE ALSO
-\fBcachefilesd\fR(8), \fBdf\fR(1), /usr/share/doc/cachefilesd-*/README
+\fBcachefilesd\fR(8), \fBdf\fR(1), /usr/share/doc/cachefilesd/README
 .SH AUTHORS
 .br
 David Howells <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/cachefilesd.service 
new/cachefilesd-0.10.10/cachefilesd.service
--- old/cachefilesd-0.10.5/cachefilesd.service  2011-12-06 14:38:00.000000000 
+0100
+++ new/cachefilesd-0.10.10/cachefilesd.service 2017-03-08 17:38:13.000000000 
+0100
@@ -4,7 +4,7 @@
 [Service]
 Type=simple
 ExecStartPre=-/sbin/modprobe -qab cachefiles
-ExecStart=/sbin/cachefilesd -n -f /etc/cachefilesd.conf
+ExecStart=/usr/sbin/cachefilesd -n -f /etc/cachefilesd.conf
 
 [Install]
 WantedBy=multi-user.target
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/howto.txt 
new/cachefilesd-0.10.10/howto.txt
--- old/cachefilesd-0.10.5/howto.txt    2011-12-06 14:38:00.000000000 +0100
+++ new/cachefilesd-0.10.10/howto.txt   2017-03-08 17:38:13.000000000 +0100
@@ -275,7 +275,7 @@
 
 On the subject of the CacheFiles facility and configuring it:
 
-       /usr/share/doc/cachefilesd-0.5/README
+       /usr/share/doc/cachefilesd/README
        /usr/share/man/man5/cachefilesd.conf.5.gz
        /usr/share/man/man8/cachefilesd.8.gz
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/redhat/cachefilesd.spec 
new/cachefilesd-0.10.10/redhat/cachefilesd.spec
--- old/cachefilesd-0.10.5/redhat/cachefilesd.spec      2011-12-06 
14:38:00.000000000 +0100
+++ new/cachefilesd-0.10.10/redhat/cachefilesd.spec     2017-03-08 
17:38:13.000000000 +0100
@@ -1,79 +1,63 @@
 # % define buildid .local
 
 Name:          cachefilesd
-Version:       0.10.5
+Version:       0.10.10
 Release:       1%{?dist}%{?buildid}
 Summary:       CacheFiles user-space management daemon
 Group:         System Environment/Daemons
-License:       GPLv2
+License:       GPLv2+
 URL:           http://people.redhat.com/~dhowells/fscache/
 Source0:       
http://people.redhat.com/dhowells/fscache/cachefilesd-%{version}.tar.bz2
 
-BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
 BuildRequires: systemd-units
 Requires(post): systemd-units
 Requires(preun): systemd-units
 Requires(postun): systemd-units
 Requires: selinux-policy-base >= 3.7.19-5
 
+%define _hardened_build 1
+
 %description
 The cachefilesd daemon manages the caching files and directory that are that
 are used by network file systems such a AFS and NFS to do persistent caching to
 the local disk.
 
+%global docdir %{_docdir}/cachefilesd
+
 %prep
 %setup -q
 
 %build
-%ifarch s390 s390x
-PIE="-fPIE"
-%else
-PIE="-fpie"
-%endif
-export PIE
-CFLAGS="`echo $RPM_OPT_FLAGS $ARCH_OPT_FLAGS $PIE`"
-
-make all CFLAGS="$CFLAGS"
+make all \
+       ETCDIR=%{_sysconfdir} \
+       SBINDIR=%{_sbindir} \
+       MANDIR=%{_mandir} \
+       CFLAGS="-Wall -Werror $RPM_OPT_FLAGS $RPM_LD_FLAGS $ARCH_OPT_FLAGS"
 
 %install
-rm -rf %{buildroot}
-mkdir -p %{buildroot}/sbin
+mkdir -p %{buildroot}%{_sbindir}
 mkdir -p %{buildroot}%{_unitdir}
 mkdir -p %{buildroot}%{_mandir}/{man5,man8}
-mkdir -p %{buildroot}/usr/share/doc/%{name}-%{version}
-mkdir -p %{buildroot}/usr/share/doc/%{name}-selinux-%{version}
 mkdir -p %{buildroot}%{_localstatedir}/cache/fscache
-make DESTDIR=%{buildroot} install
+make DESTDIR=%{buildroot} install \
+       ETCDIR=%{_sysconfdir} \
+       SBINDIR=%{_sbindir} \
+       MANDIR=%{_mandir} \
+       CFLAGS="-Wall $RPM_OPT_FLAGS -Werror"
 
 install -m 644 cachefilesd.conf %{buildroot}%{_sysconfdir}
 install -m 644 cachefilesd.service %{buildroot}%{_unitdir}/cachefilesd.service
-install -m 644 selinux/move-cache.txt 
%{buildroot}/usr/share/doc/%{name}-%{version}/
-
-%clean
-rm -rf $RPM_BUILD_ROOT
 
 %post
-if [ $1 -eq 1 ] ; then
-    # Initial installation
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%systemd_post cachefilesd.service
 
 %preun
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /bin/systemctl --no-reload disable cachefilesd.service > /dev/null 2>&1 || 
:
-    /bin/systemctl stop cachefilesd.service > /dev/null 2>&1 || :
-fi
+%systemd_preun cachefilesd.service
 
 %postun
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /bin/systemctl try-restart cachefilesd.service >/dev/null 2>&1 || :
-fi
+%systemd_postun_with_restart cachefilesd.service
 
 %files
-%defattr(-,root,root)
 %doc README
 %doc howto.txt
 %doc selinux/move-cache.txt
@@ -81,12 +65,32 @@
 %doc selinux/*.if
 %doc selinux/*.te
 %config(noreplace) %{_sysconfdir}/cachefilesd.conf
-/sbin/*
+%{_sbindir}/*
 %{_unitdir}/*
 %{_mandir}/*/*
 %{_localstatedir}/cache/fscache
 
 %changelog
+* Wed Mar 7 2017 David Howells <[email protected]> 0.10.10-1
+- Stop using readdir_r [RH BZ 1423289].
+
+* Wed Feb 17 2016 David Howells <[email protected]> 0.10.9-1
+- Fix name of directory in Makefile-generated tarball.
+
+* Wed Feb 17 2016 David Howells <[email protected]> 0.10.8-1
+- Use systemd interaction macros in specfile installation sections [RH BZ 
850053].
+- Fix the service file to use /usr/sbin/ rather than /sbin/.
+- Turn on RELRO and PIE build hardening in RPM builds.
+
+* Wed Feb 3 2016 David Howells <[email protected]> 0.10.7-1
+- Call setgroups() before calling setuid() (caught by rpmlint).
+
+* Wed Feb 3 2016 David Howells <[email protected]> 0.10.6-1
+- Note the correct licence.
+- Handle malformed kernel status correctly.
+- Permit culling to be disabled on the command line with the -N flag.
+- Suspend culling when cache space is short and cache objects are pinned.
+
 * Tue Dec 6 2011 David Howells <[email protected]> 0.10.5-1
 - Fix systemd service data according to review comments [RH BZ 754811].
 
@@ -132,13 +136,13 @@
 * Mon Jul 2 2007 David Howells <[email protected]> 0.8-16
 - Use stat64/fstatat64 to avoid EOVERFLOW errors from the kernel on large 
files.
 
-* Tue Nov 15 2006 David Howells <[email protected]> 0.8-15
+* Tue Nov 14 2006 David Howells <[email protected]> 0.8-15
 - Made cachefilesd ask the kernel whether cullable objects are in use and omit
   them from the cull table if they are.
 - Made the size of cachefilesd's culling tables configurable.
 - Updated the manual pages.
 
-* Mon Nov 14 2006 David Howells <[email protected]> 0.8-14
+* Mon Nov 13 2006 David Howells <[email protected]> 0.8-14
 - Documented SELinux interaction.
 
 * Fri Nov 10 2006 David Howells <[email protected]> 0.8-11
@@ -170,7 +174,7 @@
 - Added postun and preun rules so cachefilesd is stopped
   and started when the rpm is updated or removed.
 
-* Tue Aug  7 2006 Jesse Keating <[email protected]> 0.4-2
+* Tue Aug  8 2006 Jesse Keating <[email protected]> 0.4-2
 - require /sbin/chkconfig not /usr/bin/chkconfig
 
 * Tue Aug  1 2006 David Howells <[email protected]> 0.4-1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cachefilesd-0.10.5/selinux/move-cache.txt 
new/cachefilesd-0.10.10/selinux/move-cache.txt
--- old/cachefilesd-0.10.5/selinux/move-cache.txt       2011-12-06 
14:38:00.000000000 +0100
+++ new/cachefilesd-0.10.10/selinux/move-cache.txt      2017-03-08 
17:38:13.000000000 +0100
@@ -12,10 +12,10 @@
 caching.  If anything more is required, then it will be necessary to modify the
 policy that is installed.
 
-The sources for the installed policy will be themselves installed by the
-cachefilesd-selinux RPM in:
+Example sources for the installed policy will be themselves installed by the
+cachefilesd RPM in:
 
-       /usr/share/doc/cachefilesd-selinux-*/
+       /usr/share/doc/cachefilesd/
 
 See the files named:
 
@@ -23,6 +23,9 @@
        cachefilesd.fc
        cachefilesd.if
 
+The policy actually used for the defaults, however, is part of the SELinux
+package.
+
 
 ==========================
 ADDING AN AUXILIARY POLICY

++++++ cachefilesd-autotools.patch ++++++
--- /var/tmp/diff_new_pack.oq2f1i/_old  2020-08-18 15:10:45.264033299 +0200
+++ /var/tmp/diff_new_pack.oq2f1i/_new  2020-08-18 15:10:45.264033299 +0200
@@ -1,3 +1,5 @@
+Index: configure.ac
+===================================================================
 --- /dev/null
 +++ configure.ac
 @@ -0,0 +1,42 @@
@@ -43,6 +45,8 @@
 +
 +AC_CONFIG_FILES([Makefile])
 +AC_OUTPUT
+Index: Makefile.am
+===================================================================
 --- /dev/null
 +++ Makefile.am
 @@ -0,0 +1,14 @@
@@ -61,6 +65,8 @@
 +dist_man8_MANS = cachefilesd.8
 +dist_man5_MANS = cachefilesd.conf.5
 \ No newline at end of file
+Index: cachefilesd.c
+===================================================================
 --- cachefilesd.c.orig
 +++ cachefilesd.c
 @@ -27,9 +27,10 @@
@@ -69,12 +75,14 @@
  
 +#include "config.h"
 +
- #define CACHEFILESD_VERSION "0.10.2"
+ #define CACHEFILESD_VERSION "0.10.10"
  
 -#define _GNU_SOURCE
  #include <stdarg.h>
+ #include <stdbool.h>
  #include <stdio.h>
- #include <stdlib.h>
+Index: cachefilesd.service
+===================================================================
 --- cachefilesd.service.orig
 +++ cachefilesd.service
 @@ -2,9 +2,7 @@
@@ -83,7 +91,7 @@
  [Service]
 -Type=simple
 -ExecStartPre=-/sbin/modprobe -qab cachefiles
--ExecStart=/sbin/cachefilesd -n -f /etc/cachefilesd.conf
+-ExecStart=/usr/sbin/cachefilesd -n -f /etc/cachefilesd.conf
 +ExecStart=/usr/sbin/cachefilesd -s -n
  
  [Install]

++++++ cachefilesd-loadmod.patch ++++++
--- /var/tmp/diff_new_pack.oq2f1i/_old  2020-08-18 15:10:45.276033303 +0200
+++ /var/tmp/diff_new_pack.oq2f1i/_new  2020-08-18 15:10:45.276033303 +0200
@@ -1,6 +1,8 @@
+Index: cachefilesd.c
+===================================================================
 --- cachefilesd.c.orig
 +++ cachefilesd.c
-@@ -50,6 +50,7 @@
+@@ -53,6 +53,7 @@
  #include <sys/time.h>
  #include <sys/vfs.h>
  #include <sys/stat.h>
@@ -8,17 +10,17 @@
  
  typedef enum objtype {
        OBJTYPE_INDEX,
-@@ -278,6 +279,9 @@ int main(int argc, char *argv[])
-       char *line, *cp;
+@@ -292,6 +293,9 @@ int main(int argc, char *argv[])
        long page_size;
-       int _cachefd, nullfd, opt, loop, open_max, nodaemon = 0;
+       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)
-@@ -344,6 +348,29 @@ int main(int argc, char *argv[])
+@@ -366,6 +370,29 @@ int main(int argc, char *argv[])
        /* just in case... */
        sync();
  
@@ -48,6 +50,8 @@
        /* 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_
@@ -59,6 +63,8 @@
  # 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


Reply via email to