summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2022-05-08 21:16:10 +0200
committerMark Wielaard <mark@klomp.org>2022-05-15 00:26:31 +0200
commit27414ecffd6cc71c9af7bacc75ce448121ac005f (patch)
treec70ead3679ae13b528fe494a8d2ed5689568da9d
parentdebuginfod: Remove debuginfod_init_cache (diff)
downloadelfutils-27414ecffd6cc71c9af7bacc75ce448121ac005f.tar.gz
elfutils-27414ecffd6cc71c9af7bacc75ce448121ac005f.tar.bz2
elfutils-27414ecffd6cc71c9af7bacc75ce448121ac005f.tar.xz
debuginfod: update mtime of interval_path as early as possible
Call utime on interval_path file as soon as the thread is committed to cleanup the cache files. This will prevent other threads trying to also commit to cleaning the cache files. Having multiple threads try to clean the cache simultaniously doesn't improve cleanup speed because the threads will try to delete the files in the same order. Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--debuginfod/ChangeLog5
-rw-r--r--debuginfod/debuginfod-client.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 93aaedb6..8c54ec21 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,5 +1,10 @@
12022-05-09 Mark Wielaard <mark@klomp.org> 12022-05-09 Mark Wielaard <mark@klomp.org>
2 2
3 * debuginfod-client.c (debuginfod_clean_cache): Move utime call to
4 before fts traversal.
5
62022-05-09 Mark Wielaard <mark@klomp.org>
7
3 * debuginfod-client.c (debuginfod_init_cache): Remove. 8 * debuginfod-client.c (debuginfod_init_cache): Remove.
4 (debuginfod_query_server): Don't call debuginfod_init_cache, call 9 (debuginfod_query_server): Don't call debuginfod_init_cache, call
5 mkdir then debuginfod_clean_cache. 10 mkdir then debuginfod_clean_cache.
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 6bdf1908..b7b65aff 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -297,6 +297,11 @@ debuginfod_clean_cache(debuginfod_client *c,
297 /* Interval has not passed, skip cleaning. */ 297 /* Interval has not passed, skip cleaning. */
298 return 0; 298 return 0;
299 299
300 /* Update timestamp representing when the cache was last cleaned.
301 Do it at the start to reduce the number of threads trying to do a
302 cleanup simultaniously. */
303 utime (interval_path, NULL);
304
300 /* Read max unused age value from config file. */ 305 /* Read max unused age value from config file. */
301 rc = debuginfod_config_cache(max_unused_path, 306 rc = debuginfod_config_cache(max_unused_path,
302 cache_default_max_unused_age_s, &st); 307 cache_default_max_unused_age_s, &st);
@@ -351,8 +356,6 @@ debuginfod_clean_cache(debuginfod_client *c,
351 fts_close (fts); 356 fts_close (fts);
352 regfree (&re); 357 regfree (&re);
353 358
354 /* Update timestamp representing when the cache was last cleaned. */
355 utime (interval_path, NULL);
356 return 0; 359 return 0;
357} 360}
358 361