From e76963a971eb240e490a6a8faf60e8f7007b865a Mon Sep 17 00:00:00 2001 From: Leo Luan Date: Mon, 5 Oct 2020 02:00:00 -0700 Subject: [PATCH] vfs: Add a missed update of used cache space The missed update can cause incorrect before-cleaning cache stats and a pre-mature condition broadcast in purgeOld before the cache space use is reduced below the quota. --- vfs/vfscache/cache.go | 1 + 1 file changed, 1 insertion(+) diff --git a/vfs/vfscache/cache.go b/vfs/vfscache/cache.go index e329bc4b0..5eecf5ed2 100644 --- a/vfs/vfscache/cache.go +++ b/vfs/vfscache/cache.go @@ -609,6 +609,7 @@ func (c *Cache) clean(removeCleanFiles bool) { if os.IsNotExist(err) { return } + c.updateUsed() c.mu.Lock() oldItems, oldUsed := len(c.item), fs.SizeSuffix(c.used) c.mu.Unlock()