diff -u cachefilesd-0.10.5/debian/changelog cachefilesd-0.10.5/debian/changelog --- cachefilesd-0.10.5/debian/changelog +++ cachefilesd-0.10.5/debian/changelog @@ -1,3 +1,10 @@ +cachefilesd (0.10.5-1ubuntu0.16.04.1) xenial; urgency=medium + + [ Daniel Axtens ] + * cachefilesd can spin when disk space is short (LP: #1810372) + + -- Dan Streetman Fri, 11 Jan 2019 09:22:23 -0500 + cachefilesd (0.10.5-1) unstable; urgency=low * New upstream version only in patch2: unchanged: --- cachefilesd-0.10.5.orig/cachefilesd.c +++ cachefilesd-0.10.5/cachefilesd.c @@ -98,7 +98,7 @@ static int oldest_build = -1; static int oldest_ready = -1; static int ncullable = 0; - +static int cull_delayed = 0; static const char *configfile = "/etc/cachefilesd.conf"; static const char *devfile = "/dev/cachefiles"; @@ -244,6 +244,7 @@ static void sigalrm(int sig) { jumpstart_scan = 1; + cull_delayed = 0; } /*****************************************************************************/ @@ -605,11 +606,11 @@ /* sleep without racing on reap and cull with the signal * handlers */ - if (!scan && !reap && !cull) { + if (!scan && !reap && !(cull && !cull_delayed)) { if (sigprocmask(SIG_BLOCK, &sigs, &osigs) < 0) oserror("Unable to block signals"); - if (!reap && !cull) { + if (!reap && !stop && !jumpstart_scan) { if (ppoll(pollfds, 1, NULL, &osigs) < 0 && errno != EINTR) oserror("Unable to suspend process"); @@ -636,7 +637,7 @@ if (cull) { if (oldest_ready >= 0) cull_objects(); - else if (oldest_build < 0) + else if (oldest_build < 0 && !cull_delayed) jumpstart_scan = 1; } @@ -1351,6 +1352,7 @@ /* if nothing there, scan again in a short while */ if (oldest_build < 0) { + cull_delayed = 1; signal(SIGALRM, sigalrm); alarm(30); return;