From 509741bc0ecadf01a9f4c69d5d5be2c4093f1291 Mon Sep 17 00:00:00 2001 From: "yuchen.cc" Date: Fri, 24 Apr 2026 19:50:18 +0800 Subject: [PATCH 1/2] fix(cache): cap actualEvict by totalUsed_ to prevent eviction deadloop Signed-off-by: yuchen.cc --- src/overlaybd/cache/full_file_cache/cache_pool.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/overlaybd/cache/full_file_cache/cache_pool.cpp b/src/overlaybd/cache/full_file_cache/cache_pool.cpp index 25761dbc..ce323e93 100644 --- a/src/overlaybd/cache/full_file_cache/cache_pool.cpp +++ b/src/overlaybd/cache/full_file_cache/cache_pool.cpp @@ -203,13 +203,21 @@ void FileCachePool::eviction() { evictByCache = totalUsed_ - waterMark_; } - auto actualEvict = static_cast(std::max(evictByCache, evictByDisk)); + auto actualEvict = std::min( + static_cast(std::max(evictByCache, evictByDisk)), + totalUsed_ + ); + if (actualEvict <= 0) { return; } isFull_ = true; + if (!lru_.empty() && !exit_) { + LOG_INFO("start eviction ", VALUE(actualEvict), VALUE(evictByCache), VALUE(evictByDisk), VALUE(totalUsed_)); + } + while (actualEvict > 0 && !lru_.empty() && !exit_) { auto fileIter = lru_.back(); const auto &fileName = fileIter->first; From 92a6f0ef9b68bc6bfcd3c83d4bc39a02f6d76224 Mon Sep 17 00:00:00 2001 From: "yuchen.cc" Date: Mon, 27 Apr 2026 20:58:17 +0800 Subject: [PATCH 2/2] use audit instead of info Signed-off-by: yuchen.cc --- src/overlaybd/cache/full_file_cache/cache_pool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlaybd/cache/full_file_cache/cache_pool.cpp b/src/overlaybd/cache/full_file_cache/cache_pool.cpp index ce323e93..006d860f 100644 --- a/src/overlaybd/cache/full_file_cache/cache_pool.cpp +++ b/src/overlaybd/cache/full_file_cache/cache_pool.cpp @@ -215,7 +215,7 @@ void FileCachePool::eviction() { isFull_ = true; if (!lru_.empty() && !exit_) { - LOG_INFO("start eviction ", VALUE(actualEvict), VALUE(evictByCache), VALUE(evictByDisk), VALUE(totalUsed_)); + LOG_AUDIT("eviction", VALUE(actualEvict), VALUE(evictByCache), VALUE(evictByDisk), VALUE(totalUsed_)); } while (actualEvict > 0 && !lru_.empty() && !exit_) {