aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2010-02-22 14:49:45 +0000
committerDavid Howells <dhowells@redhat.com>2010-02-22 14:56:07 +0000
commit1910715e9b5271c89d96913d04ca967581fc777a (patch)
tree684e1c27dd3c74349bea12ddfed7532be8dcd3a3
parentbf145f9d25647b699fb06981e1011272c29f2c61 (diff)
downloadcachefilesd-1910715e9b5271c89d96913d04ca967581fc777a.tar.gz
cachefilesd historical revision 0.5v0.5
Rerun the scan after a deferral period if the cache is empty for initial scan Updated init.d script to look for cachefilesd in /sbin Added postun and preun rules so cachefilesd is stopped and started when the rpm is updated or removed. Require /sbin/chkconfig not /usr/bin/chkconfig
-rw-r--r--cachefilesd.c34
-rwxr-xr-xcachefilesd.initd2
-rw-r--r--redhat/cachefilesd.spec54
3 files changed, 69 insertions, 21 deletions
diff --git a/cachefilesd.c b/cachefilesd.c
index 9d9c9ef..5331c1b 100644
--- a/cachefilesd.c
+++ b/cachefilesd.c
@@ -78,6 +78,7 @@ static int nopendir = 0;
/* current scan point */
static struct object *scan = &root;
+static int jumpstart_scan = 0;
/* ranked order of cullable objects
* - we have two tables: one we're building and one that's full of ready to be
@@ -229,6 +230,16 @@ static void sigurg(int sig)
/*****************************************************************************/
/*
+ * redo scan after a time since the last scan turned up no results
+ */
+static void sigalrm(int sig)
+{
+ jumpstart_scan = 1;
+
+} /* end sigalrm() */
+
+/*****************************************************************************/
+/*
* start up the cache and go
*/
int main(int argc, char *argv[])
@@ -533,8 +544,21 @@ static void cachefilesd(void)
read_cache_state();
}
- if (cull && oldest_ready >= 0)
- cull_objects();
+ if (jumpstart_scan) {
+ jumpstart_scan = 0;
+ if (!stop && !scan) {
+ notice("Refilling cull table");
+ root.usage++;
+ scan = &root;
+ }
+ }
+
+ if (cull) {
+ if (oldest_ready >= 0)
+ cull_objects();
+ else if (oldest_build < 0)
+ jumpstart_scan = 1;
+ }
if (scan)
build_cull_table();
@@ -1215,8 +1239,12 @@ static void decant_cull_table(void)
if (scan)
error("Can't decant cull table whilst scanning");
- if (oldest_build < 0)
+ /* 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++) {
diff --git a/cachefilesd.initd b/cachefilesd.initd
index 7219410..b6d0f5f 100755
--- a/cachefilesd.initd
+++ b/cachefilesd.initd
@@ -26,7 +26,7 @@ MODPROBE=/sbin/modprobe
MODPROBE_ARGS=""
PROG="cachefilesd"
-[ ! -x /usr/sbin/$PROG ] && exit 0
+[ ! -x /sbin/$PROG ] && exit 0
# Check for and source configuration file otherwise set defaults
[ -f /etc/sysconfig/$PROG ] && . /etc/sysconfig/$PROG
diff --git a/redhat/cachefilesd.spec b/redhat/cachefilesd.spec
index c158aad..a507d1d 100644
--- a/redhat/cachefilesd.spec
+++ b/redhat/cachefilesd.spec
@@ -1,24 +1,25 @@
-Name: cachefilesd
-Version: 0.4
-Release: 1%{?dist}
-Summary: CacheFiles userspace management daemon
-Group: System Environment/Daemons
-License: GPL
-BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
-Url: http://people.redhat.com/~dhowells/fscache/
-Source0: http://people.redhat.com/~dhowells/fscache/cachefilesd-0.4.tar.bz2
-Requires(post): /usr/bin/chkconfig
-Requires(post): /usr/bin/chkconfig
+Name: cachefilesd
+Version: 0.5
+Release: 1%{?dist}
+Summary: CacheFiles userspace management daemon
+Group: System Environment/Daemons
+License: GPL
+URL: http://people.redhat.com/~dhowells/fscache/
+Source0: http://people.redhat.com/dhowells/fscache/cachefilesd-0.5.tar.bz2
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
+BuildRequires: automake, autoconf
+Requires(post): /sbin/chkconfig, /sbin/service
+Requires(preun): /sbin/chkconfig, /sbin/service
%description
-The cachefilesd daemon manages the caching files and directory that are that
-are used by network filesystems such a AFS and NFS to do persistent caching to
-the local disk.
+The cachefilesd daemon manages the caching files and directory that are
+that are used by network filesystems such a AFS and NFS to
+do persistent caching to the local disk.
%prep
%setup -q
-
%build
%ifarch s390 s390x
PIE="-fPIE"
@@ -38,19 +39,26 @@ mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d
mkdir -p %{buildroot}%{_mandir}/{man5,man8}
make DESTDIR=%{buildroot} install
+install -m 644 cachefilesd.conf %{buildroot}%{_sysconfdir}
install -m 755 cachefilesd.initd %{buildroot}%{_sysconfdir}/rc.d/init.d/cachefilesd
%clean
rm -rf $RPM_BUILD_ROOT
-%post
+%post
/sbin/chkconfig --add %{name}
%preun
if [ $1 -eq 0 ]; then
+ /sbin/service cachefilesd stop
/sbin/chkconfig --del %{name}
fi
+%postun
+if [ "$1" -ge 1 ]; then
+ /sbin/service cachefilesd condrestart > /dev/null
+fi
+
%files
%defattr(-,root,root)
@@ -61,6 +69,17 @@ fi
%{_mandir}/*/*
%changelog
+* Fri Aug 11 2006 David Howells <dhowells@redhat.com> 0.5-1
+- Rerun the scan after a deferral period if the cache is empty for initial scan
+
+* Tue Aug 8 2006 Steve Dickson <steved@redhat.com> 0.4-3
+- Updated init.d script to look for cachefilesd in /sbin
+- Added postun and preun rules so cachefilesd is stopped
+ and started when the rpm is updated or removed.
+
+* Tue Aug 7 2006 Jesse Keating <jkeating@redhat.com> 0.4-2
+- require /sbin/chkconfig not /usr/bin/chkconfig
+
* Tue Aug 1 2006 David Howells <dhowells@redhat.com> 0.4-1
- Discard use of autotools
@@ -69,7 +88,7 @@ fi
* Fri Jul 28 2006 Steve Dickson <steved@redhat.com> 0.3-2
- Added post and preun rules
-- Changed init.d script to up right before portmapper.
+- Changed init.d script to up right before portmapper.
* Fri Jun 9 2006 Steve Dickson <steved@redhat.com> 0.3-1
- Incorporated David Howells manual page updates
@@ -81,3 +100,4 @@ fi
* Sat Apr 22 2006 Steve Dickson <steved@redhat.com> 0.1-1
- Initial commit
+