]>
Commit | Line | Data |
---|---|---|
72332ee5 AM |
1 | ; https://www.redhat.com/archives/linux-cachefs/2014-February/msg00001.html |
2 | diff -urN cachefilesd-0.10.5.org/cachefilesd.c cachefilesd-0.10.5/cachefilesd.c | |
3 | --- cachefilesd-0.10.5.org/cachefilesd.c 2011-12-06 14:38:00.000000000 +0100 | |
4 | +++ cachefilesd-0.10.5/cachefilesd.c 2014-03-21 18:47:45.739197236 +0100 | |
5 | @@ -98,6 +98,7 @@ | |
6 | static int oldest_build = -1; | |
7 | static int oldest_ready = -1; | |
8 | static int ncullable = 0; | |
9 | +static int cull_delayed = 0; | |
10 | ||
11 | ||
12 | static const char *configfile = "/etc/cachefilesd.conf"; | |
13 | @@ -244,6 +245,7 @@ | |
14 | static void sigalrm(int sig) | |
15 | { | |
16 | jumpstart_scan = 1; | |
17 | + cull_delayed = 0; | |
18 | } | |
19 | ||
20 | /*****************************************************************************/ | |
21 | @@ -605,11 +607,11 @@ | |
22 | ||
23 | /* sleep without racing on reap and cull with the signal | |
24 | * handlers */ | |
25 | - if (!scan && !reap && !cull) { | |
26 | + if (!scan && !reap && !(cull && !cull_delayed)) { | |
27 | if (sigprocmask(SIG_BLOCK, &sigs, &osigs) < 0) | |
28 | oserror("Unable to block signals"); | |
29 | ||
30 | - if (!reap && !cull) { | |
31 | + if (!reap && !stop && !jumpstart_scan) { | |
32 | if (ppoll(pollfds, 1, NULL, &osigs) < 0 && | |
33 | errno != EINTR) | |
34 | oserror("Unable to suspend process"); | |
35 | @@ -636,7 +638,7 @@ | |
36 | if (cull) { | |
37 | if (oldest_ready >= 0) | |
38 | cull_objects(); | |
39 | - else if (oldest_build < 0) | |
40 | + else if (oldest_build < 0 && !cull_delayed) | |
41 | jumpstart_scan = 1; | |
42 | } | |
43 | ||
44 | @@ -1351,6 +1353,7 @@ | |
45 | ||
46 | /* if nothing there, scan again in a short while */ | |
47 | if (oldest_build < 0) { | |
48 | + cull_delayed = 1; | |
49 | signal(SIGALRM, sigalrm); | |
50 | alarm(30); | |
51 | return; |