summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
2022-05-09 Mark Wielaard <mark@klomp.org>
+ * debuginfod-client.c (debuginfod_clean_cache): Move utime call to
+ before fts traversal.
+
+2022-05-09 Mark Wielaard <mark@klomp.org>
+
* debuginfod-client.c (debuginfod_init_cache): Remove.
(debuginfod_query_server): Don't call debuginfod_init_cache, call
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,
/* Interval has not passed, skip cleaning. */
return 0;
+ /* Update timestamp representing when the cache was last cleaned.
+ Do it at the start to reduce the number of threads trying to do a
+ cleanup simultaniously. */
+ utime (interval_path, NULL);
+
/* Read max unused age value from config file. */
rc = debuginfod_config_cache(max_unused_path,
cache_default_max_unused_age_s, &st);
@@ -351,8 +356,6 @@ debuginfod_clean_cache(debuginfod_client *c,
fts_close (fts);
regfree (&re);
- /* Update timestamp representing when the cache was last cleaned. */
- utime (interval_path, NULL);
return 0;
}