From 8b29e3f9ce0c1cce55db6df8b9901034de9b5a2d Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Fri, 17 May 2019 12:11:57 -0500 Subject: [PATCH] Fixed a bug where Cache could delete the wrong file after a flush. --- src/Cache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index 1228904ce..db53194f4 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -428,7 +428,8 @@ void Cache::_makeSpace(size_t size) thisMuch -= statbuf.st_size; //logger->log(LOG_WARNING, "Cache: flushing! Try to avoid this, it may deadlock!"); Synchronizer::get()->flushObject(*it); - replicator->remove(cachedFile.string().c_str(), Replicator::LOCAL_ONLY); + cachedFile = prefix / *it; // it might have been renamed by the flush + replicator->remove(cachedFile, Replicator::LOCAL_ONLY); LRU_t::iterator toRemove = it++; m_lru.erase(*toRemove); lru.erase(toRemove);