From add5fa8949521ed30182af8abffbc209d6045f8b Mon Sep 17 00:00:00 2001 From: mufucaw Date: Mon, 19 Dec 2022 12:48:53 -0800 Subject: [PATCH] Try a simple local stat instead. --- src/filecache.c | 8 ++++---- src/stats.c | 5 ----- src/stats.h | 2 -- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/filecache.c b/src/filecache.c index e925652d..8dfb985c 100644 --- a/src/filecache.c +++ b/src/filecache.c @@ -614,9 +614,6 @@ static void get_fresh_fd(filecache_t *cache, bool unlink_old = false; const float samplerate = 1.0; // always sample stat - // For testing purposes ONLY, remove before merging! - BUMP(conflicting_404); - if (pdata == NULL) { *pdatap = calloc(1, sizeof(struct filecache_pdata)); pdata = *pdatap; @@ -755,10 +752,13 @@ static void get_fresh_fd(filecache_t *cache, * Not sure how to remediate without doing way more work and * introducing way more problems than the fix will fix. */ + const float samplerate = 1.0; // always sample stat + stats_counter("unexpected-not-found", 1, samplerate); + log_print(LOG_WARNING, SECTION_FUSEDAV_STAT, "Encountered an unexpected 404/410: Repsonse code: %u: ", response_code); + struct stat_cache_value *value; g_set_error(gerr, filecache_quark(), ENOENT, "%s: File %s expected to exist returns %ld.", funcname, path, response_code); - BUMP(conflicting_404); /* we get a 404 because the stat_cache returned that the file existed, but it * was not on the server. Deleting it from the stat_cache makes the stat_cache * consistent, so the next access to the file will be handled correctly. diff --git a/src/stats.c b/src/stats.c index f18fb0c1..2574ff19 100644 --- a/src/stats.c +++ b/src/stats.c @@ -300,11 +300,6 @@ void dump_stats(bool log, const char *cache_path) { print_line(log, fd, LOG_NOTICE, SECTION_FILECACHE_OUTPUT, str); } - snprintf(str, MAX_LINE_LEN, "Notable Events:"); - print_line(log, fd, LOG_NOTICE, SECTION_FUSEDAV_OUTPUT, str); - snprintf(str, MAX_LINE_LEN, " conflicting 404: %u", FETCH(conflicting_404)); - print_line(log, fd, LOG_NOTICE, SECTION_FUSEDAV_OUTPUT, str); - snprintf(str, MAX_LINE_LEN, "Stat Cache Operations:"); print_line(log, fd, LOG_NOTICE, SECTION_STATCACHE_OUTPUT, str); snprintf(str, MAX_LINE_LEN, " local_gen: %u", FETCH(statcache_local_gen)); diff --git a/src/stats.h b/src/stats.h index 1b8b2d60..d2a33ece 100644 --- a/src/stats.h +++ b/src/stats.h @@ -46,8 +46,6 @@ struct statistics { unsigned propfind_progressive_cache; unsigned propfind_complete_cache; - unsigned conflicting_404; - unsigned filecache_cache_file; unsigned filecache_pdata_set; unsigned filecache_create_file;